diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ae24a5d --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# The Didit backend team reviews every change. +* @didit-protocol/backend diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..ebdc76a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,38 @@ +name: Bug report +description: Something in the Java or Kotlin SDK does not work as documented. +labels: [bug] +body: + - type: markdown + attributes: + value: | + Never paste API keys, webhook secrets, tokens or personal data. Security issues go to + GitHub private vulnerability reporting or support@didit.me (see SECURITY.md). + - type: input + id: version + attributes: + label: SDK version + placeholder: 0.1.0 + validations: + required: true + - type: input + id: runtime + attributes: + label: Java or Kotlin version and OS + placeholder: Java 21, Linux + validations: + required: true + - type: textarea + id: what + attributes: + label: What happened, and what you expected + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Code to reproduce + render: java + - type: input + id: request-id + attributes: + label: Request id from the error, if any diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..b1edbcf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Didit support + url: mailto:support@didit.me + about: Questions about your account, the API or the console. + - name: API reference + url: https://docs.didit.me + about: The documentation of every endpoint. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..ceff9ff --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,14 @@ +name: Feature request +description: Suggest an improvement to the Java or Kotlin SDK. +labels: [enhancement] +body: + - type: textarea + id: need + attributes: + label: What you want to do + validations: + required: true + - type: textarea + id: proposal + attributes: + label: How the SDK could help diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..bf19e6b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ +## What changes + + + +## Checklist + +- [ ] Generated code is untouched by hand (`python3 codegen/generate.py --check` passes) +- [ ] Tests added or updated (`./gradlew build`) +- [ ] README updated for public API changes +- [ ] `docs/DESIGN.md` unchanged, or changed in all seven SDK repositories in the same words + +## Parity + +Parity: same change in the other six SDK repositories (`sdk-python`, `sdk-node`, `sdk-go`, `sdk-php`, `sdk-ruby`, `sdk-dotnet`), or not applicable because ... diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e7a65c8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: + - package-ecosystem: gradle + directory: / + schedule: + interval: weekly + groups: + build-tools: + patterns: ["*errorprone*", "*nullaway*", "*spotless*", "*google-java-format*", "*kotlin*", "*junit*", "*maven-publish*"] + examples: + patterns: ["*spring*", "*javalin*", "*ktor*", "*slf4j*"] + commit-message: + prefix: "chore(deps)" + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + commit-message: + prefix: "ci(deps)" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2bbf19b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,139 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Test (Java ${{ matrix.java }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + java: [11, 17, 21, 25] + include: + - os: macos-latest + java: 21 + - os: windows-latest + java: 21 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + with: + distribution: temurin + # The compiler and Gradle run on 21; the tests run on the matrix version. + java-version: | + ${{ matrix.java }} + 21 + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + - name: Unit, generated, contract, webhook and Authentication tests + run: ./gradlew :test "-PtestJavaVersion=${{ matrix.java }}" "-Porg.gradle.java.installations.fromEnv=JAVA_HOME_${{ matrix.java }}_X64,JAVA_HOME_${{ matrix.java }}_ARM64,JAVA_HOME_21_X64,JAVA_HOME_21_ARM64" + - name: Core coverage of 90 % or more + if: matrix.os == 'ubuntu-latest' && matrix.java == 21 + run: ./gradlew :jacocoTestCoverageVerification + + checks: + name: Static checks, Javadoc and packaging + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + with: + distribution: temurin + java-version: 21 + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + - name: Formatting (google-java-format, ktfmt) + run: ./gradlew spotlessCheck + - name: Compile with -Werror, errorprone and NullAway + run: ./gradlew compileJava compileTestJava + - name: Javadoc (doclint, warnings as errors) + run: ./gradlew javadoc + - name: Package the jars and the POM + run: ./gradlew publishToMavenLocal + + codegen: + name: Generated code is up to date + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: "3.12" + - name: Generator tests + run: python3 -m unittest discover -s codegen/tests -t codegen + - name: Regenerate and compare + run: python3 codegen/generate.py --check + + examples: + name: Examples and Kotlin API tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + with: + distribution: temurin + java-version: | + 17 + 21 + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + - name: Build the examples (Spring Boot, Javalin, Ktor, Kotlin) and run their tests + run: ./gradlew :examples:build "-Porg.gradle.java.installations.fromEnv=JAVA_HOME_17_X64,JAVA_HOME_21_X64" + - name: Quickstart against the local mock API + run: ./gradlew :examples:quickstartDemo "-Porg.gradle.java.installations.fromEnv=JAVA_HOME_17_X64,JAVA_HOME_21_X64" + + secret-scan: + name: Secret scan (gitleaks, full history) + runs-on: ubuntu-latest + env: + GITLEAKS_VERSION: 8.30.1 + GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: Install gitleaks + run: | + curl -sSfL -o gitleaks.tar.gz "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" + echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum -c - + tar -xzf gitleaks.tar.gz gitleaks + - name: Scan every commit + run: ./gitleaks git --config .gitleaks.toml --redact --verbose --no-banner . + + live: + name: Live sandbox smoke tests + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + with: + distribution: temurin + java-version: 21 + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + - name: Smoke tests (skipped without DIDIT_SANDBOX_API_KEY) + env: + DIDIT_SANDBOX_API_KEY: ${{ secrets.DIDIT_SANDBOX_API_KEY }} + DIDIT_SANDBOX_WORKFLOW_ID: ${{ vars.DIDIT_SANDBOX_WORKFLOW_ID }} + run: ./gradlew :liveTest diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..9e3cefc --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,79 @@ +# Release plumbing (DESIGN 13). Off until the repository variable RELEASES_ENABLED is "true": +# nothing is published before Alex approves the first release, and not before 2026-11-01. +# +# On each push to main, release-please keeps a release pull request up to date (version bump and +# CHANGELOG.md from conventional commits). Merging it creates the tag and the GitHub release; the +# publish job then waits for an approval on the "maven-central" environment, builds, signs and +# uploads to Maven Central through the Central Portal, and attests the jars (build provenance). +# Publishing runs in this workflow because a release created with the default token does not +# start other workflows. +name: Release + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release-please: + if: vars.RELEASES_ENABLED == 'true' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + steps: + - id: release + uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + publish: + needs: release-please + if: needs.release-please.outputs.release_created == 'true' + runs-on: ubuntu-latest + environment: maven-central + permissions: + contents: read + id-token: write + attestations: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ needs.release-please.outputs.tag_name }} + persist-credentials: false + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + with: + distribution: temurin + java-version: 21 + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + - name: Check the tag matches the library version + run: | + version=$(grep '^version=' gradle.properties | cut -d= -f2) + grep -q "VERSION = \"${version}\"" src/main/java/me/didit/core/Version.java + test "v${version}" = "${{ needs.release-please.outputs.tag_name }}" + - name: Test + run: ./gradlew check + - name: Sign and upload to Maven Central + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_KEY_PASSWORD }} + run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache + - name: Attest the published jars + uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 + with: + subject-path: build/libs/*.jar diff --git a/.github/workflows/spec-sync.yml b/.github/workflows/spec-sync.yml new file mode 100644 index 0000000..b93c15c --- /dev/null +++ b/.github/workflows/spec-sync.yml @@ -0,0 +1,120 @@ +# DESIGN 3.1: keeps the SDK current with the published API. Daily and on demand, it downloads the +# OpenAPI documents, regenerates the code, runs every check and opens (or updates) a pull request +# titled "chore(spec): sync API spec YYYY-MM-DD" with an operation-level summary. +# +# It never overwrites commits people added to the sync branch: when the open sync pull request has +# a commit not made by this workflow, the run stops and says so. Otherwise it rebuilds the branch +# from main and pushes with --force-with-lease against the head it saw, so a concurrent push wins. +# +# Set the SPEC_SYNC_TOKEN secret (a GitHub App or fine-grained token with contents and pull +# requests write) so CI runs on the sync pull request; with the default token it does not. +name: Spec sync + +on: + schedule: + - cron: "23 6 * * *" + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +concurrency: + group: spec-sync + cancel-in-progress: false + +env: + BRANCH: chore/spec-sync + BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com + BOT_NAME: github-actions[bot] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: main + fetch-depth: 0 + persist-credentials: false + - name: Leave branches with people's commits alone + id: guard + shell: bash + env: + GH_TOKEN: ${{ secrets.SPEC_SYNC_TOKEN || github.token }} + run: | + set -euo pipefail + # The checkout keeps no credentials and the repository may be private, so read with the + # token; a failed read stops the job instead of looking like a missing branch. + remote="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + head=$(git ls-remote --heads "$remote" "refs/heads/${BRANCH}" | cut -f1) + echo "head=${head}" >> "$GITHUB_OUTPUT" + if [ -z "$head" ]; then exit 0; fi + pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number // empty') + if [ -z "$pr" ]; then exit 0; fi + git fetch --quiet "$remote" "+refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}" + authors=$(git log --format='%ae%n%ce' "origin/main..origin/${BRANCH}") + others=$(printf '%s\n' "$authors" | sort -u | grep -vxF -e "$BOT_EMAIL" -e '' || true) + if [ -n "$others" ]; then + echo "::notice::Pull request #${pr} has commits by people; this run does not touch it." + echo "skip=true" >> "$GITHUB_OUTPUT" + fi + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + if: steps.guard.outputs.skip != 'true' + with: + python-version: "3.12" + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + if: steps.guard.outputs.skip != 'true' + with: + distribution: temurin + java-version: 21 + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + if: steps.guard.outputs.skip != 'true' + - name: Download the API documents + id: sync + if: steps.guard.outputs.skip != 'true' + run: python3 codegen/spec_sync.py --summary "$RUNNER_TEMP/summary.md" + - name: Regenerate and run every check + id: checks + if: steps.sync.outputs.changed == 'true' + continue-on-error: true + run: | + python3 codegen/generate.py + python3 -m unittest discover -s codegen/tests -t codegen + ./gradlew build + - name: Push the branch and open or update the pull request + if: steps.sync.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.SPEC_SYNC_TOKEN || github.token }} + PUSH_TOKEN: ${{ secrets.SPEC_SYNC_TOKEN || github.token }} + SEEN_HEAD: ${{ steps.guard.outputs.head }} + BREAKING: ${{ steps.sync.outputs.breaking }} + CHECKS: ${{ steps.checks.outcome }} + run: | + today=$(date -u +%Y-%m-%d) + title="chore(spec): sync API spec ${today}" + body="$RUNNER_TEMP/body.md" + cp "$RUNNER_TEMP/summary.md" "$body" + if [ "$CHECKS" != "success" ]; then + printf '\n**The checks failed on this sync**; see the workflow run %s.\n' \ + "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> "$body" + fi + git config user.name "$BOT_NAME" + git config user.email "$BOT_EMAIL" + git checkout -B "$BRANCH" + git add openapi src codegen + message="$title" + if [ "$BREAKING" = "true" ]; then + message="$(printf '%s\n\nBREAKING CHANGE: the API removed or renamed operations or schemas; see the pull request.' "$title")" + fi + git commit --quiet -m "$message" + remote="https://x-access-token:${PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + git push --force-with-lease="${BRANCH}:${SEEN_HEAD}" "$remote" "HEAD:refs/heads/${BRANCH}" + pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number // empty') + if [ -n "$pr" ]; then + gh pr edit "$pr" --title "$title" --body-file "$body" + elif [ "$CHECKS" = "success" ]; then + gh pr create --base main --head "$BRANCH" --title "$title" --body-file "$body" + else + gh pr create --base main --head "$BRANCH" --title "$title" --body-file "$body" --draft + fi diff --git a/.gitignore b/.gitignore index 2807af6..fbaf7e3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ out/ .DS_Store .env .env.* + +# Python +__pycache__/ +*.pyc diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 0000000..370fd3a --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,21 @@ +# Secret scanning for the whole history (CI job "secret-scan"). The repository goes public on the +# first release, so nothing that looks like a credential may be committed. +# +# Allowed: the upstream API documents copied byte for byte from docs.didit.me (their examples +# hold synthetic placeholder tokens) and the synthetic webhook secrets that start with whsec_test_. +# Test keys for Authentication are generated at test time and never stored. +title = "Didit Java SDK" + +[extend] +useDefault = true + +[allowlist] +description = "Upstream API documents and synthetic test webhook secrets" +paths = [ + '''^openapi/verification\.json$''', + '''^openapi/account\.json$''', + '''^openapi/webhook-vectors\.json$''', +] +regexes = [ + '''whsec_test_[A-Za-z0-9_]+''', +] diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..466df71 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} diff --git a/AGENTS.md b/AGENTS.md index 1ec9412..cc1c5bf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,3 +23,24 @@ Gradle with the Kotlin DSL and the wrapper committed, JUnit 5, errorprone, Spotl - Never commit secrets, API keys or real customer data. Fixtures are synthetic. - `CHANGELOG.md` is generated by release-please from conventional commits; never edit it by hand. - Public API changes need tests, README updates and a conventional commit type that matches their semver impact. + +## Commands + +| Task | Command | +|---|---| +| Install | Nothing to install beyond JDK 21 and Python 3.10+; `./gradlew` downloads Gradle and the dependencies | +| Generate | `python3 codegen/generate.py` (check: `python3 codegen/generate.py --check`) | +| Generator tests | `python3 -m unittest discover -s codegen/tests -t codegen` | +| Test | `./gradlew test` (another JDK: `-PtestJavaVersion=11`; live sandbox: `DIDIT_SANDBOX_API_KEY=... ./gradlew liveTest`) | +| Lint | `./gradlew spotlessCheck` (fix: `./gradlew spotlessApply`) | +| Type-check | `./gradlew compileJava compileTestJava` (javac `-Werror`, errorprone, NullAway with JSpecify) | +| Build | `./gradlew build` (everything above plus Javadoc, coverage gate and the examples) | +| Examples | `./gradlew :examples:build`, `./gradlew :examples:quickstartDemo` | +| Spec sync | `python3 codegen/spec_sync.py --summary /tmp/summary.md` | + +## Layout + +- `codegen/`: the generator (Python, standard library only) and `spec_sync.py`; it reads only `openapi/`. +- Generated: `src/main/java/me/didit/resources`, `src/main/java/me/didit/types`, `src/test/java/me/didit/resources`. +- Hand-written core: `src/main/java/me/didit/Didit.java` and the packages `core`, `errors`, `webhooks`, `authentication`. +- `examples/`: runnable examples, framework webhook receivers and the Kotlin API tests. diff --git a/CLAUDE.md b/CLAUDE.md index 1ec9412..cc1c5bf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,3 +23,24 @@ Gradle with the Kotlin DSL and the wrapper committed, JUnit 5, errorprone, Spotl - Never commit secrets, API keys or real customer data. Fixtures are synthetic. - `CHANGELOG.md` is generated by release-please from conventional commits; never edit it by hand. - Public API changes need tests, README updates and a conventional commit type that matches their semver impact. + +## Commands + +| Task | Command | +|---|---| +| Install | Nothing to install beyond JDK 21 and Python 3.10+; `./gradlew` downloads Gradle and the dependencies | +| Generate | `python3 codegen/generate.py` (check: `python3 codegen/generate.py --check`) | +| Generator tests | `python3 -m unittest discover -s codegen/tests -t codegen` | +| Test | `./gradlew test` (another JDK: `-PtestJavaVersion=11`; live sandbox: `DIDIT_SANDBOX_API_KEY=... ./gradlew liveTest`) | +| Lint | `./gradlew spotlessCheck` (fix: `./gradlew spotlessApply`) | +| Type-check | `./gradlew compileJava compileTestJava` (javac `-Werror`, errorprone, NullAway with JSpecify) | +| Build | `./gradlew build` (everything above plus Javadoc, coverage gate and the examples) | +| Examples | `./gradlew :examples:build`, `./gradlew :examples:quickstartDemo` | +| Spec sync | `python3 codegen/spec_sync.py --summary /tmp/summary.md` | + +## Layout + +- `codegen/`: the generator (Python, standard library only) and `spec_sync.py`; it reads only `openapi/`. +- Generated: `src/main/java/me/didit/resources`, `src/main/java/me/didit/types`, `src/test/java/me/didit/resources`. +- Hand-written core: `src/main/java/me/didit/Didit.java` and the packages `core`, `errors`, `webhooks`, `authentication`. +- `examples/`: runnable examples, framework webhook receivers and the Kotlin API tests. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6d9d049 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,65 @@ +# Contributing + +This is the official Didit Java and Kotlin SDK. It follows [docs/DESIGN.md](docs/DESIGN.md), the contract shared by all seven Didit server SDKs: when the code and the design disagree, the code is wrong. + +## Setup + +- JDK 21 to build (the code compiles to Java 11 bytecode). Gradle downloads other JDKs for the test matrix when they are missing. +- Python 3.10 or newer for the code generator (standard library only). + +## Commands + +| Task | Command | +|---|---| +| Regenerate the generated layer | `python3 codegen/generate.py` | +| Check that it is up to date | `python3 codegen/generate.py --check` | +| Generator tests | `python3 -m unittest discover -s codegen/tests -t codegen` | +| All tests and checks | `./gradlew build` | +| Tests on another Java version | `./gradlew test -PtestJavaVersion=11` | +| Core coverage (90 % gate) | `./gradlew jacocoTestCoverageVerification` | +| Live sandbox smoke tests | `DIDIT_SANDBOX_API_KEY=... ./gradlew liveTest` | +| Format | `./gradlew spotlessApply` | +| Javadoc | `./gradlew javadoc` | +| Examples and Kotlin tests | `./gradlew :examples:build` | +| Quickstart against a local mock | `./gradlew :examples:quickstartDemo` | +| Spec sync, by hand | `python3 codegen/spec_sync.py --summary /tmp/summary.md` | + +## Layout + +- `openapi/`: the API contract. `verification.json`, `account.json` and `webhook-vectors.json` are upstream copies, never edited by hand; `overlay.json` holds the SDK naming (DESIGN 4); `deprecated-operations.json` (when present) keeps removed operations for one minor version. +- `codegen/`: the generator (Python). It reads only `openapi/`. +- `src/main/java/me/didit/resources`, `src/main/java/me/didit/types`, `src/test/java/me/didit/resources`: generated. Every file starts with `Code generated by codegen from openapi/*.json. DO NOT EDIT.` +- `src/main/java/me/didit/core`, `errors`, `webhooks`, `authentication` and `Didit.java`: the hand-written core. +- `examples/`: runnable examples and webhook receivers, built in CI. + +## Changing the SDK + +- Never edit generated files: change `codegen/` or `openapi/overlay.json` and regenerate. CI fails when the committed code is stale. +- A new API operation without a name fails the generator with a message naming it; add an entry to `openapi/overlay.json` (or ask for `x-didit-sdk` upstream). +- Public API changes need tests, README updates and a conventional commit type that matches their semver impact (`feat:`, `fix:`, `feat!:` or a `BREAKING CHANGE:` footer). +- A change to core behaviour that DESIGN.md describes (client options, errors, retries, pagination, webhooks, Authentication) is made in all seven SDK repositories, one pull request each, and DESIGN.md changes in all seven in the same words. +- Unit tests never touch the network. Use synthetic data only; webhook secrets in tests start with `whsec_test_`, and Authentication keys are generated at test time. + +## Spec sync + +`.github/workflows/spec-sync.yml` runs daily. When the published API documents change it regenerates the SDK, runs every check and opens a pull request titled `chore(spec): sync API spec YYYY-MM-DD`, with the added, removed and changed operations and schemas. Removed operations stay, deprecated, until the next minor version; the contract test fails once that version is reached, as a reminder to delete them. + +You can push commits to the sync branch (for example hand-written webhook or Authentication changes): while the open sync pull request has a commit of yours, the workflow leaves it alone. Keep the `BREAKING CHANGE:` footer of the sync commit when you merge. The workflow reads the branch with its token, so it also works while the repository is private; if that read fails, the run fails instead of rebuilding the branch. + +## Releases + +Releases are cut by release-please from conventional commits; `CHANGELOG.md` is generated and never edited by hand. Nothing is published before Alex approves the first release, and not before 2026-11-01; until then versions stay `0.x`. + +1. The workflow `.github/workflows/release-please.yml` is off until the repository variable `RELEASES_ENABLED` is `true`. +2. On each push to `main`, release-please updates a release pull request (version in `gradle.properties`, `Version.java` and the README, plus `CHANGELOG.md`). +3. Merging it creates the `vX.Y.Z` tag and the GitHub release. The `publish` job then waits for a reviewer of the `maven-central` environment, runs `./gradlew check`, signs and uploads to Maven Central (Central Portal), and attests the jars. +4. If a publish fails after the tag exists: when the cause is outside the code (an expired token, a missing secret, a Central Portal outage), fix it and rerun the failed `publish` job of that workflow run. A rerun builds the tag's commit, so it never picks up a fix merged to `main` later; when the code has to change, merge the fix to `main` and release the next patch version instead. + +One-time setup by a repository admin, before the first release: + +- Maven Central: the `me.didit` namespace verified on central.sonatype.com, and a Central Portal user token. +- A GPG signing key, with its public key on a key server. +- Repository secrets `MAVEN_CENTRAL_USERNAME`, `MAVEN_CENTRAL_PASSWORD`, `MAVEN_SIGNING_KEY` (ASCII-armored private key) and `MAVEN_SIGNING_KEY_PASSWORD`. +- A `maven-central` environment with required reviewers and "Prevent self-review". +- Optionally `RELEASE_PLEASE_TOKEN` and `SPEC_SYNC_TOKEN` (a GitHub App or fine-grained token), so CI runs on the release and sync pull requests. +- Finally, the variable `RELEASES_ENABLED=true`. diff --git a/README.md b/README.md index 3427266..29f3e78 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,301 @@ # Didit Java / Kotlin SDK -The official [Didit](https://didit.me) server-side library for Java / Kotlin. -Identity verification (KYC), business verification (KYB), AML screening, biometrics, transaction monitoring, Travel Rule and customer authentication, from your backend. +The official Didit Java library, for Java and Kotlin backends. +Identity verification (KYC), business verification (KYB), AML screening, biometrics, transaction monitoring, Travel Rule and customer authentication, from your server, with a typed method for every endpoint of the [Didit API](https://docs.didit.me). -> In development. Not released yet. +> In development: not released yet. The first release ships with the Didit release of 2026-11-01. +## Install + +Java 11 or newer. Gradle (Kotlin DSL): + + +```kotlin +implementation("me.didit:didit-java:0.1.0") ``` -implementation("me.didit:didit-java:") + +Maven: + +```xml + + me.didit + didit-java + 0.1.0 + ``` + + +The only dependencies are Jackson (`jackson-databind`) and JSpecify annotations. + +## Quickstart + +Create a verification session, read its decision, and verify the webhook Didit sends when it changes: + +```java +import me.didit.Didit; +import me.didit.types.SessionsCreateParams; +import me.didit.types.SessionsCreateResponse; +import me.didit.webhooks.SessionStatusUpdatedEvent; +import me.didit.webhooks.WebhookEvent; +import me.didit.webhooks.Webhooks; + +Didit client = Didit.builder().apiKey(System.getenv("DIDIT_API_KEY")).build(); + +// 1. Create a session and send the user to its URL. +SessionsCreateResponse session = client.sessions().create( + SessionsCreateParams.builder() + .workflowId("your-workflow-id") + .vendorData("user-42") + .callback("https://example.com/verification/done") + .build()); +String url = session.url(); + +// 2. Read the decision. +var decision = client.sessions().retrieveDecision(session.sessionId()); +decision.status().ifPresent(status -> System.out.println("Decision: " + status)); + +// 3. In your webhook endpoint, verify the raw body before trusting it. +WebhookEvent event = Webhooks.verify(rawBody, headers, System.getenv("DIDIT_WEBHOOK_SECRET")); +if (event instanceof SessionStatusUpdatedEvent) { + SessionStatusUpdatedEvent e = (SessionStatusUpdatedEvent) event; + System.out.println(e.sessionId().orElse("?") + " is " + e.status().orElse("?")); +} +``` + +The same in Kotlin: + +```kotlin +val client = Didit.builder().apiKey(System.getenv("DIDIT_API_KEY")).build() +val session = client.sessions().create( + SessionsCreateParams.builder().workflowId("your-workflow-id").vendorData("user-42").build() +) +val id: String = session.sessionId() // required by the API: never null +val vendorData: String? = session.vendorData().getOrNull() // optional: Optional -> T? + +when (val event = Webhooks.verify(rawBody, headers, secret)) { + is SessionStatusUpdatedEvent -> println("${event.sessionId().getOrNull()} is ${event.status().getOrNull()}") + is UnknownEvent -> println("New event type ${event.webhookType()}") + else -> {} +} +``` + +Runnable examples, including webhook receivers for Spring Boot, Javalin, Ktor and the JDK's HTTP server, are in [`examples/`](examples/). + +## The API + +Every endpoint is a method on a resource, named after the API: `client.sessions().imports().create(params)`. +Every method also has an `...Async` variant that returns a `CompletableFuture`, and the parameters and responses are typed classes in `me.didit.types`. + +| Area | Resources | +|---|---| +| Verification sessions | `sessions`, `sessions().imports()`, `sessions().reviews()`, `businessSessions` | +| Standalone checks | `idVerification`, `faceMatch`, `faceSearch`, `passiveLiveness`, `ageEstimation`, `proofOfAddress`, `documentAi`, `aml`, `databaseValidation`, `phone`, `email`, `ip`, `kyb`, `idWallets`, `fraudChecks` | +| Users and businesses | `users`, `businesses`, `amlMonitoring`, `biometricTemplates` | +| Transactions and crypto | `transactions`, `transactions().rules()`, `transactions().travelRule()`, `walletScreening`, `travelRule`, `travelRule().walletAddresses()` | +| Cases and investigations | `cases` (with `notes`, `links`, `checklist`, `requests`, `teams`, `routingRules`, `blueprints`, `regulatoryReports`), `regulatoryReports`, `reportTemplates`, `networks` | +| Configuration | `workflows`, `questionnaires`, `webhooks().destinations()`, `customization`, `billing` | +| Account management | `account` (`login`, `register`, ...), `account().organizations()`, `account().applications()` | + +The full reference of each endpoint is at [docs.didit.me](https://docs.didit.me). + +## Configuration + +```java +Didit client = Didit.builder() + .apiKey("...") // DIDIT_API_KEY + .organizationId("...") // DIDIT_ORGANIZATION_ID, for application-scoped endpoints + .applicationId("...") // DIDIT_APPLICATION_ID, for application-scoped endpoints + .timeout(Duration.ofSeconds(60)) // per attempt; default 60 s + .maxRetries(2) // default 2 + .defaultHeader("X-My-Header", "1") + .build(); +``` + +- Unset values fall back to the environment variables in the comments, so `new Didit()` works with only `DIDIT_API_KEY` set. +- The client is thread-safe: create one per process and reuse it. +- `client.withOptions(o -> o.timeout(Duration.ofMinutes(2)))` derives a client that shares the connection pool. +- Pass your own `java.net.http.HttpClient` with `.httpClient(...)` for proxies or TLS settings; it must not follow redirects. +- Override anything for one call with `RequestOptions`: + + ```java + client.aml().screen(params, RequestOptions.builder() + .idempotencyKey("screen-user-42") // for the endpoints that accept Idempotency-Key + .timeout(Duration.ofSeconds(10)) + .build()); + ``` + +- Application-scoped endpoints (cases, networks, regulatory reports, ...) fill the organization and application ids from the options; calling one without them throws `ConfigurationException` before sending anything. +- The API key is only ever sent to the base URL: it never appears in logs, errors or `toString()`. Plain `http` base URLs are allowed only for `localhost`. +- `DIDIT_LOG=debug` (or `.debugLogging(true)`) logs method, path, status, duration and request id of each request to the `me.didit` `System.Logger`. It never logs bodies or headers. + +## Errors + +Every exception extends `DiditException` (unchecked). + +| Exception | When | +|---|---| +| `ApiConnectionException`, `ApiTimeoutException` | No response | +| `ApiStatusException` | Any non-2xx status, with `statusCode()`, `body()`, `headers()` and `requestId()` | +| `BadRequestException` (400), `AuthenticationException` (401), `PermissionDeniedException` (403), `NotFoundException` (404), `ConflictException` (409), `UnprocessableEntityException` (422), `RateLimitException` (429), `InternalServerException` (5xx) | Subclasses of `ApiStatusException` | +| `ConfigurationException` | A missing API key or id, an empty webhook secret, an empty, `.` or `..` path id | +| `UnexpectedResponseException` | A success body that is not JSON, a field with an unexpected type, a next page link to another origin | +| `WebhookVerificationException` | A webhook failed verification; see `reason()` | +| `TokenVerificationException` | An Authentication token failed verification; see `reason()` | + +```java +try { + client.sessions().retrieveDecision(sessionId); +} catch (NotFoundException e) { + // the session does not exist or is outside the key's scope +} catch (ApiStatusException e) { + log.warn("Didit returned {} (request id {})", e.statusCode(), e.requestId().orElse("none")); +} +``` + +## Retries and timeouts + +Failed requests are retried up to `maxRetries` times (default 2) with exponential backoff (0.5 s, full jitter, at most 8 s), honouring `Retry-After` up to 60 s. +`GET`, `PUT` and `DELETE` are retried on connection errors, timeouts, 408, 429 and 5xx. +`POST` and `PATCH` are retried only when the connection failed before the request was sent, or on 429, so a request is never sent twice after it may have reached Didit. + +## Pagination + +List methods return a `Page`. Iterating a page fetches the following pages as you go: + +```java +for (WorkflowListItem workflow : client.workflows().list()) { + System.out.println(workflow.uuid().orElse("?")); +} + +Page page = client.sessions().list( + SessionsListParams.builder().limit(50).build()); +page.results(); // this page only +page.count(); // total, when the API reports it +page.autoPager().stream().limit(200); // a Stream over every page +page.forEachAsync(item -> { ... }); // fetches the pages asynchronously +``` + +The next page link must point to the API's own origin and never back to a page already read. + +## Files and binary responses + +Upload endpoints take a `Path`, bytes or a stream: + +```java +client.idVerification().verify(IdVerificationVerifyParams.builder() + .frontImage(Path.of("front.jpg")) + .backImage(FileUpload.of(bytes, "back.jpg", "image/jpeg")) + .build()); +``` + +PDF reports, CSV templates and attachments come back as a `BinaryResponse`: call `bytes()`, `writeTo(path)` or `stream()` (and close it). + +## Raw responses + +```java +RawResponse raw = client.sessions().withRawResponse().create(params); +raw.statusCode(); +raw.requestId(); +raw.data(); +``` + +## Webhooks + +```java +WebhookEvent event = Webhooks.verify(rawBody, headers, secret); +``` + +- `headers` is a `Map` (names match any case, values may be lists) or a lookup function such as `request::getHeader` (Servlet) or `headers::getFirst` (Spring). +- Verify the raw request body. If your framework only gives you the parsed JSON, use `Webhooks.verifyParsed(payload, headers, secret)`, which checks `X-Signature-V2` only. +- During a secret rotation pass both secrets: `VerifyOptions.builder().secret(current).secret(previous).build()`. +- Deliveries older or newer than 5 minutes are rejected; change it with `.tolerance(...)`. +- `X-Signature-Simple` is deprecated and covers the envelope only; `Webhooks.verify` accepts it only with `.allowSimple(true)` (`verifyParsed` never does), and then `event.isBodyAuthenticated()` is false: re-fetch the record from the API before acting on it. +- A failed check throws `WebhookVerificationException` with `reason()`: `missing_signature`, `invalid_signature`, `missing_timestamp`, `timestamp_mismatch`, `timestamp_out_of_tolerance` or `invalid_payload`. Answer it with a 4xx status. + +Events are typed: `SessionStatusUpdatedEvent`, `SessionDataUpdatedEvent`, `UserStatusUpdatedEvent`, `UserDataUpdatedEvent`, `BusinessStatusUpdatedEvent`, `BusinessDataUpdatedEvent`, `ActivityCreatedEvent`, `TransactionCreatedEvent`, `TransactionStatusUpdatedEvent`, `TravelRuleStatusUpdatedEvent`, `WorkflowComplianceChangedEvent`, `KybRegistrySearchResolvedEvent`, and `UnknownEvent` for types this version does not know. +Every event has `eventId()`, `webhookType()`, `timestamp()`, `createdAt()`, `applicationId()`, `environment()` and the whole payload in `_json()`. + +## Transactions, wallet screening and Travel Rule + +```java +TransactionDetail tx = client.transactions().create(TransactionsCreateParams.builder() + .transactionId("order-1001") + .transactionCategory(TransactionsCreateParams.TransactionCategory.FINANCE) + .transactionDetails(TransactionsCreateParams.TransactionDetails.builder() + .direction(TransactionsCreateParams.TransactionDetails.Direction.OUTBOUND) + .amount(250.0).currency("EUR").build()) + .subject(TransactionsCreateParams.Subject.builder() + .vendorData("user-42").fullName("Ana Ruiz").build()) + .build()); + +WalletScreeningResult wallet = client.walletScreening().screen( + WalletScreeningScreenParams.builder().walletAddress(address) + .blockchain(WalletScreeningScreenParams.Blockchain.of("bitcoin")).build()); +``` + +Transaction rules are under `client.transactions().rules()`, the Travel Rule under `client.travelRule()` and `client.transactions().travelRule()`. + +## Authentication + +Didit Authentication gives your application its own sign-in (an OpenID Connect issuer). The `Authentication` class checks its tokens on your backend; it never uses the API key. + +```java +Authentication auth = Authentication.builder() + .publishableKey("pk_live_...") // or .issuer("https://your-app.auth.didit.me") + .clientId("your-application-id") // checked as the audience + .build(); + +AccessTokenClaims claims = auth.verifyAccessToken(bearerToken); +String userId = claims.subject(); +``` + +- Verification accepts ES256 only and checks `typ`, `iss`, `aud`, `exp`, `nbf` and `iat` (60 s leeway). Failures throw `TokenVerificationException` with `reason()`. +- The issuer's discovery document and keys are cached as it says (5 minutes today); an unknown key id refetches them at most once a minute. Concurrent verifications share one fetch, and after a failed fetch they fail fast for 5 seconds instead of each calling the issuer. Create one `Authentication` per issuer and reuse it. +- `Authentication.createPkce()`, `createState()` and `createNonce()` start a sign-in; `exchangeCode(code, verifier, redirectUri)` finishes it; `verifyIdToken(idToken, nonce)` checks the ID token (pass `null` for a token from a refresh, which carries no nonce; a token that does carry one is then refused). +- `refresh(refreshToken)` rotates the tokens. Serialise the refreshes of one session: reusing a consumed refresh token revokes the session. +- `getSession(accessToken)` is a live revocation check (rate-limited: do not call it on every request); `revokeSession(accessToken)` signs the user out. +- `createStepUp(accessToken, StepUpParams.builder("payout").amount("250.00").currency("EUR").returnTo(url).build())` asks for a verification before a sensitive action; act only once `retrieveStepUp(accessToken, id).isApproved()`. + +## Account management + +`client.account().login(...)` returns an account token for the account endpoints: pass it as `.accountToken(...)` on the client or per request. +Account calls go to `https://apx.didit.me/auth/v2` and never receive the API key. + +## Language notes + +Choices this SDK makes where the shared design leaves room: + +- **Types.** Parameters and responses are immutable classes with builders. `build()` checks required fields. Inline objects are nested classes (`SessionsCreateParams.ContactDetails`); array items take the property's name (`SessionsListResponse.Results`). +- **Absent and null.** A getter for a required field returns the plain type and throws `UnexpectedResponseException` if the API leaves it out. Optional or nullable fields return `Optional`. The setter of a nullable field accepts `null`, which sends JSON `null`. `_json()` returns the raw JSON, so you can tell absent from `null`. `_additionalProperties()` holds the fields this version does not know yet. +- **Free-form JSON.** Read as `JsonNode` or `Map`; written from plain Java maps, lists and values. +- **Enums are open.** Each enum is a class with constants for the known values. `of(String)` accepts any value, and `isKnown()` says whether this version declares it. +- **Unions** (`oneOf`) have `isX()` and `asX()` per variant, plus getters for the fields every variant shares. Responses whose body depends on the status (200 or 202) have `asOk()` and `asAccepted()`. +- **Numbers and dates.** Integers are `long`, numbers `double`, and amounts that the API sends as strings stay `String`. Date-times are `OffsetDateTime` (a value without an offset is read as UTC), dates `LocalDate`. +- **Exceptions** end in `Exception` (`ApiStatusException`, not `APIStatusError`), because in Java `Error` means an unrecoverable JVM failure. +- **Parameters.** + - Path ids are positional arguments; everything else is in one parameters object. + - A query parameter with the same name as a body field gets a `Query` suffix (`nodeIdQuery`). + - `Idempotency-Key` is a request option. + - Endpoints that take JSON or multipart send multipart only when a file is set. +- **Nullability.** Every package is JSpecify `@NullMarked`, so Kotlin sees `T?` exactly where Java may pass or receive `null`. +- **Async and raw responses.** Every method has an `Async` variant returning a `CompletableFuture`; `withRawResponse()` gives the status, headers and request id. Lists that page with `next_offset` (case action receipts, duplicate search) return plain models. +- **Webhooks.** `Webhooks` is static and needs no client; `client.webhooks().verify(...)` does the same. `created_at` is unix seconds (`Long`). +- **Authentication.** It uses the JDK's own crypto (no JWT library). It never retries, and every call has an `Async` variant. + +## Supported runtimes and versioning + +- Java 11, 17, 21 and 25 on Linux, macOS and Windows; Kotlin 2.x. +- Semantic versioning: a breaking change to the public SDK surface is a major version. Until 1.0.0, versions are `0.x`. +- The SDK is generated from the OpenAPI documents Didit publishes at docs.didit.me and is updated when they change: endpoints the API removes stay one minor version, deprecated, before they go. +- Releases and their notes are in [CHANGELOG.md](CHANGELOG.md). + +## Links -- API reference: https://docs.didit.me -- Design contract shared by every Didit server SDK: [docs/DESIGN.md](docs/DESIGN.md) +- API reference and guides: [docs.didit.me](https://docs.didit.me) +- Webhooks: [docs.didit.me/integration/webhooks](https://docs.didit.me/integration/webhooks) +- Design shared by every Didit server SDK: [docs/DESIGN.md](docs/DESIGN.md) +- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md) ยท Security: [SECURITY.md](SECURITY.md) ## License -MIT +MIT, see [LICENSE](LICENSE). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..cfcabdd --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,10 @@ +# Security + +Please report security issues privately, never in a public issue: + +- GitHub private vulnerability reporting: the "Report a vulnerability" button on this repository's Security tab. +- Email: support@didit.me, with "Security" in the subject. + +Include the SDK version, a description of the issue and the steps to reproduce it. Never send real API keys, webhook secrets, tokens or personal data; use synthetic values. + +We acknowledge reports within three working days and keep you informed until a fix is released. Only the latest released version receives security fixes. diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..0e5e9da --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,207 @@ +import net.ltgt.gradle.errorprone.CheckSeverity +import net.ltgt.gradle.errorprone.errorprone + +plugins { + `java-library` + jacoco + alias(libs.plugins.errorprone) + alias(libs.plugins.spotless) + alias(libs.plugins.maven.publish) +} + +description = "The official Didit Java and Kotlin library for the Didit API." + +// The compiler runs on JDK 21 (errorprone needs it) and emits Java 11 bytecode. Tests run on the +// JDK given by -PtestJavaVersion (CI runs 11, 17, 21 and 25). +val compileJdk = 21 +val testJdk = providers.gradleProperty("testJavaVersion").map(String::toInt).orElse(compileJdk) + +java { toolchain { languageVersion = JavaLanguageVersion.of(compileJdk) } } + +dependencies { + api(libs.jackson.databind) + api(libs.jspecify) + + errorprone(libs.errorprone.core) + errorprone(libs.nullaway) + + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) + testRuntimeOnly(libs.junit.launcher) +} + +tasks.withType().configureEach { + options.release = 11 + options.encoding = "UTF-8" + options.isFork = true + options.forkOptions.memoryMaximumSize = "3g" + options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-processing", "-Werror", "-parameters")) + options.errorprone { + check("NullAway", CheckSeverity.ERROR) + option("NullAway:OnlyNullMarked", "true") + option("NullAway:JSpecifyMode", "true") + // Generated files repeat simple names such as Builder in nested classes on purpose. + disable("SameNameButDifferent") + // Generated builders and union accessors are intentionally symmetric. + disable("InlineMeSuggester") + } +} + +tasks.named("compileTestJava") { + options.errorprone { + // Tests stub nullable values and use reflection over the generated API. + disable("NullAway") + // Style checks that only add noise to test code. + disable("StringSplitter", "CanonicalDuration", "InputStreamSlowMultibyteRead") + } +} + +tasks.withType().configureEach { + (options as StandardJavadocDocletOptions).apply { + encoding = "UTF-8" + addStringOption("Xdoclint:all,-missing", "-quiet") + addBooleanOption("Xwerror", true) + links("https://docs.oracle.com/en/java/javase/11/docs/api/") + } + isFailOnError = true + maxMemory = "2g" +} + +tasks.test { + useJUnitPlatform { excludeTags("live") } + javaLauncher = javaToolchains.launcherFor { + languageVersion = testJdk.map(JavaLanguageVersion::of) + } + maxHeapSize = "1g" + systemProperty("didit.repoRoot", rootDir.absolutePath) + testLogging { + events("failed", "skipped") + exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL + } + finalizedBy(tasks.jacocoTestReport) +} + +// Opt-in smoke tests against a sandbox application; they skip themselves without +// DIDIT_SANDBOX_API_KEY. +tasks.register("liveTest") { + description = "Runs the live sandbox smoke tests (needs DIDIT_SANDBOX_API_KEY)." + group = "verification" + testClassesDirs = sourceSets.test.get().output.classesDirs + classpath = sourceSets.test.get().runtimeClasspath + useJUnitPlatform { includeTags("live") } + systemProperty("didit.repoRoot", rootDir.absolutePath) +} + +// Coverage gate for the hand-written core (DESIGN 11): 90 % of lines. +val coreClasses = + sourceSets.main.map { main -> + main.output.classesDirs.asFileTree.matching { + include( + "me/didit/*.class", + "me/didit/core/**", + "me/didit/errors/**", + "me/didit/webhooks/**", + "me/didit/authentication/**", + ) + } + } + +tasks.jacocoTestReport { + dependsOn(tasks.test) + classDirectories.setFrom(coreClasses) + reports { + xml.required = true + html.required = true + } +} + +tasks.jacocoTestCoverageVerification { + dependsOn(tasks.test) + classDirectories.setFrom(coreClasses) + violationRules { + rule { + limit { + counter = "LINE" + minimum = "0.90".toBigDecimal() + } + } + } +} + +tasks.check { dependsOn(tasks.jacocoTestCoverageVerification) } + +// The generated layer is checked by regenerating it (codegen/generate.py --check), not formatted. +spotless { + java { + target("src/**/*.java", "examples/src/**/*.java") + targetExclude( + "src/main/java/me/didit/resources/**", + "src/main/java/me/didit/types/**", + "src/test/java/me/didit/resources/**", + ) + googleJavaFormat(libs.versions.google.java.format.get()) + } + kotlin { + target("examples/src/**/*.kt") + ktfmt().googleStyle() + } + kotlinGradle { + target("*.gradle.kts", "examples/*.gradle.kts") + ktfmt().googleStyle() + } +} + +tasks.register("generate") { + description = "Regenerates the generated layer from openapi/." + group = "build" + commandLine("python3", "codegen/generate.py") +} + +tasks.register("checkGenerated") { + description = "Fails when the committed generated code differs from openapi/." + group = "verification" + commandLine("python3", "codegen/generate.py", "--check") +} + +mavenPublishing { + publishToMavenCentral() + if (providers.gradleProperty("signingInMemoryKey").isPresent) { + signAllPublications() + } + coordinates("me.didit", "didit-java", version.toString()) + pom { + name = "Didit Java SDK" + description = project.description + inceptionYear = "2026" + url = "https://didit.me" + licenses { + license { + name = "MIT" + url = "https://opensource.org/licenses/MIT" + distribution = "repo" + } + } + developers { + developer { + id = "didit" + name = "Didit" + email = "support@didit.me" + organization = "Didit" + organizationUrl = "https://didit.me" + } + } + scm { + url = "https://github.com/didit-protocol/sdk-java" + connection = "scm:git:https://github.com/didit-protocol/sdk-java.git" + developerConnection = "scm:git:ssh://git@github.com/didit-protocol/sdk-java.git" + } + issueManagement { + system = "GitHub" + url = "https://github.com/didit-protocol/sdk-java/issues" + } + properties.put( + "keywords", + "identity verification, KYC, KYB, AML, liveness, transaction monitoring, Travel Rule, Didit", + ) + } +} diff --git a/codegen/didit_codegen/__init__.py b/codegen/didit_codegen/__init__.py new file mode 100644 index 0000000..fe43858 --- /dev/null +++ b/codegen/didit_codegen/__init__.py @@ -0,0 +1,6 @@ +"""Java code generator for the Didit server SDK. + +Reads only the files in ``openapi/`` and writes the generated layer of the SDK +(``src/main/java/me/didit/resources``, ``src/main/java/me/didit/types``) and +the generated operation tests (``src/test/java/me/didit/resources``). +""" diff --git a/codegen/didit_codegen/javadoc.py b/codegen/didit_codegen/javadoc.py new file mode 100644 index 0000000..1ec52ac --- /dev/null +++ b/codegen/didit_codegen/javadoc.py @@ -0,0 +1,83 @@ +"""Turns spec descriptions (Markdown) into safe Javadoc text.""" + +from __future__ import annotations + +import html +import re + +_CODE = re.compile(r"`([^`]+)`") +_LINK = re.compile(r"\[([^\]]+)\]\((https?://[^)\s]+)\)") +_BOLD = re.compile(r"\*\*([^*]+)\*\*") + + +def escape(text: str) -> str: + """Escapes text for a Javadoc comment: HTML, ``*/``, ``@`` and unicode escapes.""" + out = html.escape(text, quote=False) + out = out.replace("*/", "*/").replace("@", "@").replace("\\u", "\u") + return out + + +def render(text: str) -> list[str]: + """Renders Markdown-ish text as Javadoc lines (without the leading `` * ``).""" + text = text.strip() + if not text: + return [] + paragraphs = re.split(r"\n\s*\n", text) + lines: list[str] = [] + for i, para in enumerate(paragraphs): + para = para.strip() + if not para: + continue + rendered = _inline(para) + if i > 0: + lines.append("") + lines.append("

" + rendered[0] if rendered else "

") + lines.extend(rendered[1:]) + else: + lines.extend(rendered) + return lines + + +def _inline(para: str) -> list[str]: + parts: list[str] = [] + for raw_line in para.splitlines(): + line = raw_line.rstrip() + if re.match(r"^\s*[-*] ", line): + line = "- " + line.split(" ", 1)[1].lstrip() if " " in line.strip() else line + segments: list[str] = [] + pos = 0 + for match in _CODE.finditer(line): + segments.append(_plain(line[pos : match.start()])) + segments.append("" + escape(match.group(1)) + "") + pos = match.end() + segments.append(_plain(line[pos:])) + parts.append("".join(segments)) + return parts + + +def _plain(text: str) -> str: + out = [] + pos = 0 + for match in _LINK.finditer(text): + out.append(_bold(escape(text[pos : match.start()]))) + out.append(f'{escape(match.group(1))}') + pos = match.end() + out.append(_bold(escape(text[pos:]))) + return "".join(out) + + +def _bold(text: str) -> str: + return _BOLD.sub(lambda m: "" + m.group(1) + "", text) + + +def block(lines: list[str], indent: str) -> str: + """A ``/** ... */`` block, or an empty string when there is nothing to say.""" + lines = [line for line in lines] + while lines and not lines[-1].strip(): + lines.pop() + if not lines: + return "" + if len(lines) == 1 and len(lines[0]) < 90: + return f"{indent}/** {lines[0]} */\n" + body = "".join(f"{indent} *{(' ' + line) if line else ''}\n" for line in lines) + return f"{indent}/**\n{body}{indent} */\n" diff --git a/codegen/didit_codegen/javagen.py b/codegen/didit_codegen/javagen.py new file mode 100644 index 0000000..2cd670c --- /dev/null +++ b/codegen/didit_codegen/javagen.py @@ -0,0 +1,953 @@ +"""Java source emission for the generated layer: types, resources and the root accessors.""" + +from __future__ import annotations + +from dataclasses import dataclass, field + +from . import javadoc, names +from .model import JClass, Model, OpModel, Prop, TypeRef, Variant + +HEADER = "// Code generated by codegen from openapi/*.json. DO NOT EDIT.\n" +TYPES_PKG = "me.didit.types" +RESOURCES_PKG = "me.didit.resources" +CORE_PKG = "me.didit.core" + +# Hand-written core classes a generated resource extends (DESIGN 9: the webhook +# verifier lives in the core and is reachable as client.webhooks().verify(...)). +RESOURCE_BASES = {"webhooks": "me.didit.webhooks.WebhookMethods"} + +DETECT_JSON_TYPE = { + "string": "json.isTextual()", + "integer": "json.isIntegralNumber()", + "number": "json.isNumber()", + "boolean": "json.isBoolean()", + "array": "json.isArray()", + "any": "!json.isNull()", +} + + +@dataclass +class Ctx: + """Emission context of one Java file: package, top-level class and imports.""" + + package: str + top: JClass | None + imports: set[str] = field(default_factory=set) + + def use(self, qualified: str) -> str: + self.imports.add(qualified) + return qualified.rsplit(".", 1)[1] + + def ref(self, cls: JClass) -> str: + if self.top is not None and cls.top is self.top: + return cls.qualified + top = cls.top + shadowed = self.top is not None and top.name in self.top.nested_names() + if shadowed: + return f"{TYPES_PKG}.{cls.qualified}" + if self.package != TYPES_PKG: + self.imports.add(f"{TYPES_PKG}.{top.name}") + return cls.qualified + + def java_type(self, t: TypeRef, boxed: bool = True) -> str: + k = t.kind + if k == "string": + return "String" + if k == "long": + return "Long" if boxed else "long" + if k == "double": + return "Double" if boxed else "double" + if k == "boolean": + return "Boolean" if boxed else "boolean" + if k == "datetime": + return self.use("java.time.OffsetDateTime") + if k == "date": + return self.use("java.time.LocalDate") + if k == "any": + return self.use("com.fasterxml.jackson.databind.JsonNode") + if k == "object": + self.use("java.util.Map") + return f"Map" + if k == "file": + return self.use("me.didit.core.FileUpload") + if k == "list": + assert t.item is not None + self.use("java.util.List") + return f"List<{self.java_type(t.item)}>" + if k == "map": + assert t.item is not None + self.use("java.util.Map") + return f"Map" + if k == "class": + assert t.cls is not None + return self.ref(t.cls) + raise ValueError(f"unknown type kind {k}") + + def input_type(self, t: TypeRef) -> str: + """The setter parameter type of a container holding free-form JSON.""" + if t.kind == "any": + return "Object" + if t.kind == "object": + self.use("java.util.Map") + return "Map" + if t.kind == "list": + assert t.item is not None + self.use("java.util.List") + inner = self.input_type(t.item) if has_untyped(t.item) else self.java_type(t.item) + return f"List" if inner != "Object" else "List" + if t.kind == "map": + assert t.item is not None + self.use("java.util.Map") + inner = self.input_type(t.item) if has_untyped(t.item) else self.java_type(t.item) + return f"Map" if inner != "Object" else "Map" + return self.java_type(t) + + def conv(self, t: TypeRef) -> str: + self.use("me.didit.core.Conv") + k = t.kind + simple = { + "string": "Conv.STRING", + "long": "Conv.LONG", + "double": "Conv.DOUBLE", + "boolean": "Conv.BOOLEAN", + "datetime": "Conv.DATE_TIME", + "date": "Conv.DATE", + "any": "Conv.ANY", + "object": "Conv.OBJECT", + } + if k in simple: + return simple[k] + if k == "list": + assert t.item is not None + return f"Conv.list({self.conv(t.item)})" + if k == "map": + assert t.item is not None + return f"Conv.map({self.conv(t.item)})" + if k == "class": + assert t.cls is not None + ref = self.ref(t.cls) + if t.cls.kind == "enum": + return f"Conv.enumeration({ref}::of)" + if t.cls.kind == "union": + return f"Conv.union({ref}::fromJson)" + return f"Conv.model({ref}::fromJson)" + raise ValueError(f"no converter for {k}") + + +def has_untyped(t: TypeRef) -> bool: + if t.kind in ("any", "object"): + return True + return t.item is not None and has_untyped(t.item) + + +def imports_block(ctx: Ctx, own_package: str) -> str: + lines = sorted( + imp for imp in ctx.imports if imp.rsplit(".", 1)[0] != own_package and not imp.startswith("java.lang.") + ) + if not lines: + return "" + return "".join(f"import {imp};\n" for imp in lines) + "\n" + + +def file_text(ctx: Ctx, body: str) -> str: + return f"{HEADER}package {ctx.package};\n\n{imports_block(ctx, ctx.package)}{body}" + + +def nullable_type(java_type: str) -> str: + """Annotates a type with JSpecify @Nullable; nested types take it on the last segment.""" + head = java_type.split("<", 1)[0] + if "." in head: + dot = head.rfind(".") + return f"{java_type[: dot + 1]}@Nullable {java_type[dot + 1:]}" + return f"@Nullable {java_type}" + + +def deprecated_lines(text: str = "") -> list[str]: + return ["", "@deprecated " + (javadoc.escape(text) if text else "Deprecated by the API.")] + + +# -- types ------------------------------------------------------------------------ + + +def emit_class(cls: JClass, ctx: Ctx, indent: str) -> str: + if cls.kind == "model": + return emit_model(cls, ctx, indent) + if cls.kind == "enum": + return emit_enum(cls, ctx, indent) + if cls.kind == "union": + return emit_union(cls, ctx, indent) + if cls.kind == "status": + return emit_status(cls, ctx, indent) + raise ValueError(cls.kind) + + +def class_doc(cls: JClass, indent: str) -> str: + lines = javadoc.render(cls.description) + if cls.deprecated: + lines += deprecated_lines() + return javadoc.block(lines, indent) + + +def modifiers(cls: JClass) -> str: + return "public final class" if cls.outer is None else "public static final class" + + +def emit_model(cls: JClass, ctx: Ctx, indent: str) -> str: + i1 = indent + " " + i2 = indent + " " + ref = ctx.ref(cls) + ctx.use("me.didit.core.JsonModel") + ctx.use("me.didit.core.Json") + ctx.use("java.util.Set") + ctx.use("java.util.List") + ctx.use("java.util.Map") + ctx.use("com.fasterxml.jackson.databind.JsonNode") + ctx.use("com.fasterxml.jackson.databind.node.ObjectNode") + ctx.use("me.didit.core.FileUpload") + out: list[str] = [] + out.append(class_doc(cls, indent)) + if cls.deprecated: + out.append(f"{indent}@Deprecated\n") + out.append(f"{indent}{modifiers(cls)} {cls.name} extends JsonModel {{\n") + known = ", ".join(f'"{p.json_name}"' for p in cls.props) + out.append(f"{i1}private static final Set KNOWN_FIELDS = Set.of({known});\n\n") + out.append(f"{i1}private {cls.name}(ObjectNode json, Map> files) {{\n") + out.append(f"{i2}super(json, files);\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * Reads a {{@code {cls.name}}} from JSON. Unknown fields are kept and readable\n" + f"{i1} * through {{@link #_additionalProperties()}}.\n{i1} *\n" + f"{i1} * @param json a JSON object\n{i1} * @return the parsed value\n{i1} */\n" + ) + out.append(f"{i1}public static {cls.name} fromJson(JsonNode json) {{\n") + out.append(f"{i2}return new {cls.name}(Json.copyObject(json), Map.of());\n{i1}}}\n\n") + out.append(f"{i1}/**\n{i1} * Returns an empty builder.\n{i1} *\n{i1} * @return a new builder\n{i1} */\n") + out.append(f"{i1}public static Builder builder() {{\n{i2}return new Builder();\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * Returns a builder holding a copy of every field of this value.\n{i1} *\n" + f"{i1} * @return a new builder\n{i1} */\n" + ) + out.append(f"{i1}public Builder toBuilder() {{\n{i2}return new Builder(this);\n{i1}}}\n") + for prop in cls.props: + out.append("\n") + out.append(emit_getter(prop, ctx, i1)) + out.append(f"\n{i1}@Override\n{i1}protected Set knownFields() {{\n{i2}return KNOWN_FIELDS;\n{i1}}}\n") + # Builder + out.append(f"\n{i1}/** Builds a {{@link {cls.name}}}. */\n") + out.append(f"{i1}public static final class Builder extends JsonModel.BaseBuilder {{\n") + out.append(f"{i2}private Builder() {{}}\n\n") + out.append(f"{i2}private Builder({cls.name} from) {{\n{i2} super(from);\n{i2}}}\n") + for prop in cls.props: + out.append("\n") + out.append(emit_setter(prop, ctx, i2)) + required = [p for p in cls.props if p.required] + out.append( + f"\n{i2}/**\n{i2} * Builds the value.\n{i2} *\n{i2} * @return a new immutable {{@code {cls.name}}}\n" + ) + if required: + out.append(f"{i2} * @throws IllegalStateException when a required field is missing\n") + out.append(f"{i2} */\n{i2}public {cls.name} build() {{\n") + for prop in required: + if prop.type.kind == "file" or (prop.type.kind == "list" and prop.type.item and prop.type.item.kind == "file"): + out.append(f'{i2} requireFile("{prop.json_name}");\n') + else: + out.append(f'{i2} require("{prop.json_name}", {"true" if prop.nullable else "false"});\n') + out.append(f"{i2} return new {cls.name}(buildJson(), buildFiles());\n{i2}}}\n") + out.append(f"\n{i2}@Override\n{i2}protected Builder self() {{\n{i2} return this;\n{i2}}}\n") + out.append(f"{i1}}}\n") + for nested in cls.nested: + out.append("\n") + out.append(emit_class(nested, ctx, i1)) + out.append(f"{indent}}}\n") + _ = ref + return "".join(out) + + +def prop_doc(prop: Prop, extra: list[str], indent: str) -> str: + lines = javadoc.render(prop.description) + if not lines: + lines = [f"The {javadoc.escape(prop.json_name)} field."] + lines += extra + if prop.deprecated: + lines += deprecated_lines() + return javadoc.block(lines, indent) + + +def is_file(t: TypeRef) -> bool: + return t.kind == "file" or (t.kind == "list" and t.item is not None and t.item.kind == "file") + + +def emit_getter(prop: Prop, ctx: Ctx, indent: str) -> str: + out: list[str] = [] + required = prop.required and not prop.nullable + if is_file(prop.type): + jt = ctx.java_type(prop.type) + ctx.use("java.util.Optional") + returns = f"Optional<{jt}>" + accessor = "file" if prop.type.kind == "file" else "fileList" + body = f'return {accessor}("{prop.json_name}");' + extra = ["", "@return the file to upload, if set"] + elif required: + returns = ctx.java_type(prop.type, boxed=False) + body = f'return Json.required(json, "{prop.json_name}", {ctx.conv(prop.type)});' + extra = ["", "@return the value", "@throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type"] + else: + ctx.use("java.util.Optional") + returns = f"Optional<{ctx.java_type(prop.type)}>" + body = f'return Json.optional(json, "{prop.json_name}", {ctx.conv(prop.type)});' + extra = ["", "@return the value, or empty when the field is absent or null", + "@throws me.didit.errors.UnexpectedResponseException when the field has another type"] + out.append(prop_doc(prop, extra, indent)) + if prop.deprecated: + out.append(f"{indent}@Deprecated\n") + out.append(f"{indent}public {returns} {prop.java_name}() {{\n{indent} {body}\n{indent}}}\n") + return "".join(out) + + +def emit_setter(prop: Prop, ctx: Ctx, indent: str) -> str: + out: list[str] = [] + name = prop.java_name + param = names.safe_param(name) + nullable = prop.nullable and not is_file(prop.type) + if is_file(prop.type): + jt = ctx.java_type(prop.type) + call = "setFile" if prop.type.kind == "file" else "setFiles" + decl = f"{jt} {param}" + body = f'return {call}("{prop.json_name}", {param});' + elif prop.type.kind in ("list", "map") and has_untyped(prop.type): + # Lists and maps of free-form JSON accept plain Java maps, lists and values. + jt = ctx.input_type(prop.type) + if nullable: + ctx.use("org.jspecify.annotations.Nullable") + decl = f"{nullable_type(jt)} {param}" + else: + decl = f"{jt} {param}" + body = f'return setAny("{prop.json_name}", {param});' + elif prop.type.kind in ("any",): + ctx.use("org.jspecify.annotations.Nullable") + decl = f"@Nullable Object {param}" + body = f'return setAny("{prop.json_name}", {param});' + elif prop.type.kind == "object": + ctx.use("java.util.Map") + if nullable: + ctx.use("org.jspecify.annotations.Nullable") + decl = f"@Nullable Map {param}" + else: + decl = f"Map {param}" + body = f'return setAny("{prop.json_name}", {param});' + else: + jt = ctx.java_type(prop.type, boxed=nullable) + if nullable: + ctx.use("org.jspecify.annotations.Nullable") + decl = f"{nullable_type(jt)} {param}" + body = f'return setNullable("{prop.json_name}", {ctx.conv(prop.type)}, {param});' + else: + decl = f"{jt} {param}" + body = f'return set("{prop.json_name}", {ctx.conv(prop.type)}, {param});' + extra = ["", f"@param {param} the value" + (", or {@code null} to send JSON null" if nullable else ""), + "@return this builder"] + out.append(prop_doc(prop, extra, indent)) + if prop.deprecated: + out.append(f"{indent}@Deprecated\n") + out.append(f"{indent}public Builder {name}({decl}) {{\n{indent} {body}\n{indent}}}\n") + if prop.type.kind == "file": + ctx.use("me.didit.core.FileUpload") + out.append( + f"\n{indent}/**\n{indent} * Uploads the file at {{@code path}} as {{@code {prop.json_name}}}.\n{indent} *\n" + f"{indent} * @param path the file to read when the request is sent\n{indent} * @return this builder\n{indent} */\n" + ) + if prop.deprecated: + out.append(f"{indent}@Deprecated\n") + path = ctx.use("java.nio.file.Path") + out.append( + f"{indent}public Builder {name}({path} path) {{\n{indent} return setFile(\"{prop.json_name}\", FileUpload.of(path));\n{indent}}}\n" + ) + return "".join(out) + + +def emit_enum(cls: JClass, ctx: Ctx, indent: str) -> str: + i1 = indent + " " + i2 = indent + " " + ctx.use("me.didit.core.StringEnum") + ctx.use("java.util.List") + out: list[str] = [] + doc = javadoc.render(cls.description) + [ + "", + "

An open enum: {@link #of(String)} accepts values this SDK version does not know yet.", + ] + out.append(javadoc.block(doc, indent)) + out.append(f"{indent}{modifiers(cls)} {cls.name} extends StringEnum {{\n") + used: set[str] = {"KNOWN_VALUES"} + consts: list[str] = [] + for value in cls.values: + const = names.constant(value) + base = const + n = 2 + while const in used: + const = f"{base}_{n}" + n += 1 + used.add(const) + consts.append(const) + literal = java_string(value) + out.append(f"{i1}/** The value {{@code {javadoc.escape(literal)}}}. */\n") + out.append(f"{i1}public static final {cls.name} {const} = new {cls.name}({literal});\n\n") + out.append(f"{i1}private static final List<{cls.name}> KNOWN_VALUES = List.of({', '.join(consts)});\n\n") + out.append(f"{i1}private {cls.name}(String value) {{\n{i2}super(value);\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * Returns the constant for a known value, or a new instance for any other value.\n{i1} *\n" + f"{i1} * @param value the string value\n{i1} * @return the enum value\n{i1} */\n" + ) + out.append(f"{i1}public static {cls.name} of(String value) {{\n") + out.append(f"{i2}return StringEnum.lookup(KNOWN_VALUES, value, {cls.name}::new);\n{i1}}}\n\n") + out.append(f"{i1}/**\n{i1} * Returns the values known to this SDK version.\n{i1} *\n{i1} * @return the known values\n{i1} */\n") + out.append(f"{i1}public static List<{cls.name}> knownValues() {{\n{i2}return KNOWN_VALUES;\n{i1}}}\n\n") + out.append(f"{i1}@Override\n{i1}public boolean isKnown() {{\n{i2}return KNOWN_VALUES.contains(this);\n{i1}}}\n") + out.append(f"{indent}}}\n") + return "".join(out) + + +def java_string(value: str) -> str: + out = ['"'] + for ch in value: + code = ord(ch) + if ch == '"': + out.append('\\"') + elif ch == "\\": + out.append("\\\\") + elif ch == "\n": + out.append("\\n") + elif ch == "\r": + out.append("\\r") + elif ch == "\t": + out.append("\\t") + elif code < 0x20 or code > 0x7E: + if code > 0xFFFF: + code -= 0x10000 + out.append(f"\\u{0xD800 + (code >> 10):04x}\\u{0xDC00 + (code & 0x3FF):04x}") + else: + out.append(f"\\u{code:04x}") + else: + out.append(ch) + out.append('"') + return "".join(out) + + +def detect_expr(variant: Variant) -> str: + kind = variant.detect[0] + if kind == "discriminator": + return f'Json.hasValue(json, {java_string(variant.detect[1])}, {java_string(str(variant.detect[2]))})' + if kind == "shape": + required, unique = variant.detect[1], variant.detect[2] + if required: + return "Json.hasFields(json, " + ", ".join(java_string(r) for r in required) + ")" + if unique: + return "Json.hasAnyField(json, " + ", ".join(java_string(r) for r in unique) + ")" + return "json.isObject()" + if kind == "json_type": + return DETECT_JSON_TYPE[variant.detect[1]] + if kind == "status": + return f"statusCode() == {variant.detect[1]}" + raise ValueError(kind) + + +def variant_type_text(variant: Variant, ctx: Ctx) -> str: + return ctx.java_type(variant.type) + + +def emit_union(cls: JClass, ctx: Ctx, indent: str) -> str: + i1 = indent + " " + i2 = indent + " " + ctx.use("me.didit.core.JsonUnion") + ctx.use("me.didit.core.Json") + ctx.use("java.util.Optional") + ctx.use("com.fasterxml.jackson.databind.JsonNode") + out: list[str] = [] + doc = javadoc.render(cls.description) + [ + "", + "

One of: " + ", ".join(f"{{@code {v.name}}}" for v in cls.variants) + ". Check with the {@code is...}", + "methods and read with the {@code as...} methods" + + ("; the fields every variant has are readable directly." if cls.props else "."), + ] + out.append(javadoc.block(doc, indent)) + out.append(f"{indent}{modifiers(cls)} {cls.name} extends JsonUnion {{\n") + out.append(f"{i1}private {cls.name}(JsonNode json) {{\n{i2}super(json);\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * Reads a {{@code {cls.name}}} from JSON.\n{i1} *\n{i1} * @param json any JSON value\n" + f"{i1} * @return the union\n{i1} */\n" + ) + out.append(f"{i1}public static {cls.name} fromJson(JsonNode json) {{\n{i2}return new {cls.name}(json.deepCopy());\n{i1}}}\n") + for prop in cls.props: + out.append("\n") + out.append(emit_getter(prop, ctx, i1)) + for v in cls.variants: + jt = variant_type_text(v, ctx) + conv = ctx.conv(v.type) + vdesc = javadoc.render(v.description) + out.append(f"\n{i1}/**\n{i1} * Wraps a {{@code {v.name}}} value.\n{i1} *\n") + out.append(f"{i1} * @param value the value\n{i1} * @return the union\n{i1} */\n") + out.append(f"{i1}public static {cls.name} of{v.name}({jt} value) {{\n") + out.append(f"{i2}return new {cls.name}({conv}.write(value));\n{i1}}}\n\n") + lines = [f"Whether this value is a {{@code {v.name}}}."] + ([""] + vdesc if vdesc else []) + ["", "@return true when it matches"] + out.append(javadoc.block(lines, i1)) + out.append(f"{i1}public boolean is{v.name}() {{\n{i2}return {detect_expr(v)};\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * Reads this value as a {{@code {v.name}}}.\n{i1} *\n" + f"{i1} * @return the value, or empty when {{@link #is{v.name}()}} is false\n{i1} */\n" + ) + out.append(f"{i1}public Optional<{jt}> as{v.name}() {{\n") + out.append(f"{i2}return is{v.name}() ? Optional.of({conv}.read(json)) : Optional.empty();\n{i1}}}\n") + for nested in cls.nested: + out.append("\n") + out.append(emit_class(nested, ctx, i1)) + out.append(f"{indent}}}\n") + return "".join(out) + + +def emit_status(cls: JClass, ctx: Ctx, indent: str) -> str: + i1 = indent + " " + i2 = indent + " " + ctx.use("me.didit.core.MultiStatusResponse") + ctx.use("java.util.Optional") + ctx.use("com.fasterxml.jackson.databind.JsonNode") + out: list[str] = [] + out.append(javadoc.block(javadoc.render(cls.description), indent)) + out.append(f"{indent}{modifiers(cls)} {cls.name} extends MultiStatusResponse {{\n") + out.append(f"{i1}private {cls.name}(int statusCode, JsonNode json) {{\n{i2}super(statusCode, json);\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * Reads the response body received with {{@code statusCode}}.\n{i1} *\n" + f"{i1} * @param statusCode the HTTP status\n{i1} * @param json the response body\n{i1} * @return the response\n{i1} */\n" + ) + out.append( + f"{i1}public static {cls.name} fromResponse(int statusCode, JsonNode json) {{\n" + f"{i2}return new {cls.name}(statusCode, json.deepCopy());\n{i1}}}\n" + ) + for v in cls.variants: + jt = variant_type_text(v, ctx) + conv = ctx.conv(v.type) + out.append( + f"\n{i1}/**\n{i1} * Whether the API answered {v.detect[1]}.\n{i1} *\n{i1} * @return true for status {v.detect[1]}\n{i1} */\n" + ) + out.append(f"{i1}public boolean is{v.name}() {{\n{i2}return {detect_expr(v)};\n{i1}}}\n\n") + out.append( + f"{i1}/**\n{i1} * The body of a {v.detect[1]} response.\n{i1} *\n" + f"{i1} * @return the body, or empty for another status\n{i1} */\n" + ) + out.append(f"{i1}public Optional<{jt}> as{v.name}() {{\n") + out.append(f"{i2}return is{v.name}() ? Optional.of({conv}.read(json)) : Optional.empty();\n{i1}}}\n") + for nested in cls.nested: + out.append("\n") + out.append(emit_class(nested, ctx, i1)) + out.append(f"{indent}}}\n") + return "".join(out) + + +def emit_type_file(cls: JClass) -> tuple[str, str]: + ctx = Ctx(TYPES_PKG, cls) + body = emit_class(cls, ctx, "") + return f"{cls.name}.java", file_text(ctx, body) + + +def emit_types(model: Model) -> dict[str, str]: + files = {} + for cls in model.classes: + name, text = emit_type_file(cls) + files[name] = text + files["package-info.java"] = ( + HEADER + + "/** Request and response types of the Didit API, generated from the OpenAPI documents. */\n" + + "@NullMarked\npackage me.didit.types;\n\nimport org.jspecify.annotations.NullMarked;\n" + ) + return files + + +# -- resources -------------------------------------------------------------------- + + +@dataclass(frozen=True) +class Signature: + """One overload of an operation method.""" + + with_params: bool + with_options: bool + + +def params_type(om: OpModel, ctx: Ctx) -> str | None: + if om.params_class is not None: + return ctx.ref(om.params_class) + if om.body_type is not None: + return ctx.java_type(om.body_type) + return None + + +def signatures(om: OpModel) -> list[Signature]: + has_params = om.params_class is not None or om.body_type is not None + if not has_params: + return [Signature(False, True), Signature(False, False)] + sigs = [Signature(True, True), Signature(True, False)] + if not om.params_required: + sigs += [Signature(False, True), Signature(False, False)] + return sigs + + +def result_type(om: OpModel, ctx: Ctx) -> tuple[str, str]: + """(data type, boxed data type) of the method result.""" + r = om.response + if r.kind == "none": + return "void", "@Nullable Void" + if r.kind == "binary": + t = ctx.use("me.didit.core.BinaryResponse") + return t, t + if r.kind == "json_node": + t = ctx.use("com.fasterxml.jackson.databind.JsonNode") + return t, t + if r.kind == "page": + assert r.type is not None + ctx.use("me.didit.core.Page") + t = f"Page<{ctx.java_type(r.type)}>" + return t, t + assert r.type is not None + t = ctx.java_type(r.type) + return t, t + + +def handler_expr(om: OpModel, ctx: Ctx) -> str: + ctx.use("me.didit.core.Responses") + r = om.response + if r.kind == "none": + return "Responses.none()" + if r.kind == "binary": + return "Responses.binary()" + if r.kind == "json_node": + return "Responses.jsonNode()" + if r.kind == "page": + assert r.type is not None + return f"Responses.page({ctx.conv(r.type)})" + assert r.type is not None + if r.type.kind == "class" and r.type.cls is not None and r.type.cls.kind == "status": + return f"Responses.byStatus({ctx.ref(r.type.cls)}::fromResponse)" + return f"Responses.json({ctx.conv(r.type)})" + + +def handler_type(om: OpModel, ctx: Ctx) -> str: + _, boxed = result_type(om, ctx) + ctx.use("me.didit.core.ResponseHandler") + return f"ResponseHandler<{boxed}>" + + +def constant_name(java_method: str) -> str: + return names.constant(java_method) + "_RESPONSE" + + +def link_target(om: OpModel, sig: Signature, ptype: str | None, async_: bool) -> str: + args = ["String"] * len(om.path_params) + if sig.with_params and ptype is not None: + args.append(ptype.split("<", 1)[0]) + if sig.with_options: + args.append("RequestOptions") + return f"#{om.java_method}{'Async' if async_ else ''}({', '.join(args)})" + + +def short_doc(om: OpModel, sig: Signature, ctx: Ctx, variant: str, ptype: str | None, full: Signature) -> str: + """A short Javadoc for an overload: it points at the fully documented one.""" + target = link_target(om, full, ptype, False) + head = { + "sync": f"Same as {{@link {target}}}", + "async": f"Asynchronous {{@link {target}}}", + "raw": f"{{@link {target}}} with the raw response", + "raw_async": f"Asynchronous {{@link {target}}} with the raw response", + }[variant] + if not sig.with_params and full.with_params: + head += ", without parameters" + if not sig.with_options: + head += ", with the client's options" + lines = [head + "."] + lines.append("") + for pp in om.path_params: + lines.append(f"@param {pp.java_name} the {{@code {pp.json_name}}}") + if sig.with_params: + lines.append("@param params the request parameters") + if sig.with_options: + lines.append("@param options per-request options") + data, _ = result_type(om, ctx) + if variant != "sync" or data != "void": + lines.append("@return " + ("a future completed with the result" if "async" in variant else "the result")) + if om.op.deprecated: + lines += ["", "@deprecated The API removed this operation."] + return javadoc.block(lines, " " if variant in ("sync", "async") else " ") + + +def op_doc(om: OpModel, sig: Signature, ctx: Ctx, variant: str, ptype: str | None) -> str: + full = signatures(om)[0] + if variant != "sync" or sig != full: + return short_doc(om, sig, ctx, variant, ptype, full) + lines = javadoc.render(om.summary or "") + desc = javadoc.render(om.description) if om.description and om.description != om.summary else [] + if desc: + lines = lines + ([""] if lines else []) + (["

" + desc[0]] + desc[1:] if lines else desc) + if lines: + lines.append("") + lines.append(f"

{{@code {om.op.http_method.upper()} {javadoc.escape(om.op.path)}}}") + if om.op.application_scoped: + lines.append( + "

Application scoped: the organization and application ids come from the client options." + ) + if om.idempotency: + lines.append( + "

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}." + ) + if om.response.kind == "binary": + lines.append("

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it.") + if om.response.kind == "page": + lines.append("

Returns one page; iterate it to fetch every following page automatically.") + lines.append("") + for pp in om.path_params: + text = javadoc.escape(pp.description.splitlines()[0]) if pp.description else f"the {{@code {pp.json_name}}}" + lines.append(f"@param {pp.java_name} {text}") + if sig.with_params: + lines.append("@param params the request parameters") + if sig.with_options: + lines.append("@param options per-request options that override the client options") + data, _ = result_type(om, ctx) + if variant == "sync" and data != "void": + lines.append("@return the response body") + elif variant == "async": + lines.append("@return a future completed with the response body") + elif variant == "raw": + lines.append("@return the HTTP status, headers and request id with the parsed body") + elif variant == "raw_async": + lines.append("@return a future completed with the raw response") + if om.op.deprecated: + info = om.op.deprecated + note = f"The API removed this operation; it goes away in version {info.get('remove_in', 'the next minor version')}." + if info.get("replacement"): + note += f" Use {{@code {info['replacement']}}} instead." + lines += ["", "@deprecated " + note] + return javadoc.block(lines, " " if variant in ("sync", "async") else " ") + + +def request_args(om: OpModel, sig: Signature, ptype: str | None) -> str: + args = [pp.java_name for pp in om.path_params] + if ptype is not None: + if sig.with_params: + args.append("params") + elif om.params_class is not None or (om.body_type is not None and om.body_type.cls and not any(p.required for p in om.body_type.cls.props)): + args.append(f"{ptype}.builder().build()") + else: + args.append("null") + return ", ".join(args) + + +def decl_args(om: OpModel, sig: Signature, ptype: str | None) -> str: + args = [f"String {pp.java_name}" for pp in om.path_params] + if sig.with_params and ptype is not None: + args.append(f"{ptype} params") + if sig.with_options: + args.append("RequestOptions options") + return ", ".join(args) + + +def emit_operation(om: OpModel, ctx: Ctx) -> tuple[str, str, str]: + """Returns (outer methods, raw methods, private request builder and handler).""" + ctx.use("me.didit.core.RequestOptions") + ctx.use("me.didit.core.RawResponse") + ctx.use("java.util.concurrent.CompletableFuture") + ptype = params_type(om, ctx) + data, boxed = result_type(om, ctx) + if boxed.startswith("@Nullable"): + ctx.use("org.jspecify.annotations.Nullable") + m = om.java_method + const = constant_name(m) + deprecated = " @Deprecated\n" if om.op.deprecated else "" + raw_deprecated = " @Deprecated\n" if om.op.deprecated else "" + outer: list[str] = [] + raw: list[str] = [] + for sig in signatures(om): + decl = decl_args(om, sig, ptype) + call = f"client.execute({m}Request({request_args(om, sig, ptype)}), {'options' if sig.with_options else 'RequestOptions.none()'}, {const})" + call_async = call.replace("client.execute(", "client.executeAsync(", 1) + # sync + outer.append(op_doc(om, sig, ctx, "sync", ptype)) + outer.append(deprecated) + if data == "void": + outer.append(f" public void {m}({decl}) {{\n {call};\n }}\n\n") + else: + outer.append(f" public {data} {m}({decl}) {{\n return {call}.data();\n }}\n\n") + # async + outer.append(op_doc(om, sig, ctx, "async", ptype)) + outer.append(deprecated) + if data == "void": + outer.append( + f" public CompletableFuture {m}Async({decl}) {{\n return {call_async}.thenAccept(response -> {{}});\n }}\n\n" + ) + else: + outer.append( + f" public CompletableFuture<{boxed}> {m}Async({decl}) {{\n return {call_async}.thenApply(RawResponse::data);\n }}\n\n" + ) + # raw + raw.append(op_doc(om, sig, ctx, "raw", ptype)) + raw.append(raw_deprecated) + raw.append(f" public RawResponse<{boxed}> {m}({decl}) {{\n return {call};\n }}\n\n") + raw.append(op_doc(om, sig, ctx, "raw_async", ptype)) + raw.append(raw_deprecated) + raw.append( + f" public CompletableFuture> {m}Async({decl}) {{\n return {call_async};\n }}\n\n" + ) + + # Request builder + ctx.use("me.didit.core.ApiRequest") + req_args = [f"String {pp.java_name}" for pp in om.path_params] + if ptype is not None: + nullable_body = om.body_type is not None and om.body_type.cls is not None and any( + p.required for p in om.body_type.cls.props + ) and not om.body_required + if nullable_body: + ctx.use("org.jspecify.annotations.Nullable") + req_args.append(f"{nullable_type(ptype)} params") + else: + req_args.append(f"{ptype} params") + lines = [f"ApiRequest.builder({java_string(om.op.http_method.upper())}, {java_string(om.op.path)})"] + if om.op.spec == "account": + lines.append(".account()") + auth = om.op.sdk.get("auth") + if auth == "account_token": + lines.append(".auth(ApiRequest.Auth.ACCOUNT_TOKEN)") + elif auth == "none": + lines.append(".auth(ApiRequest.Auth.NONE)") + if om.op.application_scoped: + lines.append(".applicationScoped()") + for pp in om.path_params: + lines.append(f".pathParam({java_string(pp.json_name)}, {pp.java_name})") + if ptype is not None: + lines.append(".params(params)") + same = [q for q, f in om.query_fields if q == f] + if same: + lines.append(".queryFields(" + ", ".join(java_string(q) for q in same) + ")") + for q, f in om.query_fields: + if q != f: + lines.append(f".queryField({java_string(q)}, {java_string(f)})") + for header, field_name in om.header_fields: + lines.append(f".headerField({java_string(header)}, {java_string(field_name)})") + if om.body_encoding == "multipart": + lines.append(".body(ApiRequest.BodyEncoding.MULTIPART)") + elif om.body_encoding == "json_or_multipart": + lines.append(".body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART)") + elif om.body_encoding == "json": + lines.append(".body(ApiRequest.BodyEncoding.JSON)") + if om.response.kind == "binary": + lines.append(f".accept({java_string(om.response.content_type)})") + builder = "\n ".join(lines) + private = ( + f" private static final {handler_type(om, ctx)} {const} = {handler_expr(om, ctx)};\n\n" + f" private static ApiRequest {m}Request({', '.join(req_args)}) {{\n" + f" return {builder}\n .build();\n }}\n\n" + ) + return "".join(outer), "".join(raw), private + + +def emit_resource(resource: str, ops: list[OpModel], children: list[str]) -> tuple[str, str]: + cls_name = names.resource_class(resource) + ctx = Ctx(RESOURCES_PKG, None) + ctx.use("me.didit.core.ApiClient") + out: list[str] = [] + base = RESOURCE_BASES.get(resource) + extends = f" extends {ctx.use(base)}" if base else "" + has_ops = bool(ops) + any_deprecated = any(om.op.deprecated for om in ops) + out.append(f"/** The {{@code {resource}}} resource: {{@code client.{'().'.join(names.camel(s) for s in resource.split('.'))}()}}. */\n") + if any_deprecated: + out.append('@SuppressWarnings("deprecation")\n') + out.append(f"public final class {cls_name}{extends} {{\n") + if has_ops: + out.append(" private final ApiClient client;\n") + out.append(" private final WithRawResponse withRawResponse;\n") + for child in children: + out.append(f" private final {names.resource_class(child)} {names.camel(child.split('.')[-1])};\n") + out.append("\n") + ctor = [f" {cls_name}(ApiClient client) {{\n"] + if has_ops: + ctor.append(" this.client = client;\n this.withRawResponse = new WithRawResponse(client);\n") + for child in children: + ctor.append(f" this.{names.camel(child.split('.')[-1])} = new {names.resource_class(child)}(client);\n") + if not has_ops and not children: + ctor.append(" // No operations.\n") + if not has_ops: + # Keeps the constructor signature uniform for resources that only group others. + ctor.append(" java.util.Objects.requireNonNull(client, \"client\");\n") + ctor.append(" }\n\n") + out.extend(ctor) + for child in children: + accessor = names.camel(child.split(".")[-1]) + out.append(f" /**\n * The {{@code {child}}} resource.\n *\n * @return the resource\n */\n") + out.append(f" public {names.resource_class(child)} {accessor}() {{\n return {accessor};\n }}\n\n") + raws: list[str] = [] + privates: list[str] = [] + if has_ops: + out.append( + " /**\n * The same operations, returning the HTTP status, headers and request id with the parsed body.\n" + " *\n * @return the raw response view\n */\n" + ) + out.append(" public WithRawResponse withRawResponse() {\n return withRawResponse;\n }\n\n") + for om in ops: + o, r, p = emit_operation(om, ctx) + out.append(o) + raws.append(r) + privates.append(p) + out.extend(privates) + out.append( + f" /** The {{@code {resource}}} operations returning {{@link RawResponse}}. */\n" + " public static final class WithRawResponse {\n" + " private final ApiClient client;\n\n" + " WithRawResponse(ApiClient client) {\n this.client = client;\n }\n\n" + ) + body = "".join(raws).rstrip("\n") + "\n" + out.append(body) + out.append(" }\n") + text = "".join(out).rstrip("\n") + "\n}\n" + return f"{cls_name}.java", file_text(ctx, text) + + +def resource_children(model: Model) -> dict[str, list[str]]: + children: dict[str, list[str]] = {res: [] for res in model.resources} + roots: list[str] = [] + for res in model.resources: + if "." in res: + parent = res.rsplit(".", 1)[0] + children[parent].append(res) + else: + roots.append(res) + children[""] = roots + return children + + +def emit_resources(model: Model) -> dict[str, str]: + files: dict[str, str] = {} + children = resource_children(model) + for res, ops in model.resources.items(): + name, text = emit_resource(res, ops, sorted(children[res])) + files[name] = text + # Root accessors, extended by the hand-written me.didit.Didit client. + ctx = Ctx(RESOURCES_PKG, None) + ctx.use("me.didit.core.ApiClient") + out = [ + "/**\n * The top-level resources of the Didit API. The hand-written {@code me.didit.Didit} client\n" + " * extends this class; use the client, not this class.\n */\n", + "public abstract class DiditResources {\n", + ] + roots = sorted(children[""]) + for res in roots: + out.append(f" private final {names.resource_class(res)} {names.camel(res)};\n") + out.append("\n /**\n * Creates the resource tree.\n *\n * @param client the HTTP client shared by every resource\n */\n") + out.append(" protected DiditResources(ApiClient client) {\n") + for res in roots: + out.append(f" this.{names.camel(res)} = new {names.resource_class(res)}(client);\n") + out.append(" }\n") + for res in roots: + out.append(f"\n /**\n * The {{@code {res}}} resource.\n *\n * @return the resource\n */\n") + out.append(f" public final {names.resource_class(res)} {names.camel(res)}() {{\n return {names.camel(res)};\n }}\n") + out.append("}\n") + files["DiditResources.java"] = file_text(ctx, "".join(out)) + files["package-info.java"] = ( + HEADER + + "/** The resources of the Didit API, one class per resource, generated from the OpenAPI documents. */\n" + + "@NullMarked\npackage me.didit.resources;\n\nimport org.jspecify.annotations.NullMarked;\n" + ) + return files diff --git a/codegen/didit_codegen/model.py b/codegen/didit_codegen/model.py new file mode 100644 index 0000000..af30d26 --- /dev/null +++ b/codegen/didit_codegen/model.py @@ -0,0 +1,903 @@ +"""Turns OpenAPI schemas and operations into a Java type model (DESIGN 5 and 5.1).""" + +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Any + +from . import names +from .spec import Document, Operation, Spec, SpecError, pointer_escape + +SKIPPED_HEADERS = {"authorization", "content-type", "idempotency-key", "accept", "x-api-key"} + + +@dataclass(eq=False) +class TypeRef: + """A Java type: a scalar, a container or a generated class.""" + + kind: str # string long double boolean datetime date any object file list map class + item: "TypeRef | None" = None + cls: "JClass | None" = None + + def __repr__(self) -> str: # pragma: no cover - debugging aid + if self.kind == "class" and self.cls is not None: + return f"TypeRef({self.cls.qualified})" + if self.item is not None: + return f"TypeRef({self.kind}<{self.item!r}>)" + return f"TypeRef({self.kind})" + + +@dataclass(eq=False) +class Prop: + json_name: str + java_name: str + type: TypeRef + required: bool + nullable: bool + description: str + deprecated: bool + schema: dict[str, Any] + location: str = "body" # body query header + wire_name: str = "" # query or header name when it differs from json_name + + @property + def wire(self) -> str: + return self.wire_name or self.json_name + + +@dataclass(eq=False) +class Variant: + name: str + type: TypeRef + detect: tuple[Any, ...] + description: str = "" + + +@dataclass(eq=False) +class JClass: + kind: str # model enum union status + name: str + outer: "JClass | None" + description: str = "" + deprecated: bool = False + props: list[Prop] = field(default_factory=list) + values: list[str] = field(default_factory=list) + variants: list[Variant] = field(default_factory=list) + nested: list["JClass"] = field(default_factory=list) + origin: str = "inline" # component params response inline + pointer: str = "" + doc_name: str = "" + complete: bool = False + + @property + def qualified(self) -> str: + """Name relative to the package: ``Outer.Inner``.""" + return self.name if self.outer is None else f"{self.outer.qualified}.{self.name}" + + @property + def top(self) -> "JClass": + return self if self.outer is None else self.outer.top + + def nested_names(self) -> set[str]: + out = {self.name} + for cls in self.nested: + out |= cls.nested_names() + return out + + def has_files(self) -> bool: + return any(contains_file(p.type) for p in self.props) + + +def contains_file(t: TypeRef) -> bool: + return t.kind == "file" or (t.item is not None and contains_file(t.item)) + + +@dataclass(eq=False) +class PathParam: + json_name: str + java_name: str + description: str + + +@dataclass(eq=False) +class ResponseModel: + kind: str # json none binary page json_node status + type: TypeRef | None = None + page_style: str = "" # next | next_offset + statuses: list[str] = field(default_factory=list) + content_type: str = "" + + +@dataclass(eq=False) +class OpModel: + op: Operation + java_method: str + path_params: list[PathParam] + params_class: JClass | None + body_type: TypeRef | None + body_required: bool + body_encoding: str | None # json multipart json_or_multipart + query_fields: list[tuple[str, str]] # (query name, params field) + header_fields: list[tuple[str, str]] + response: ResponseModel + idempotency: bool + summary: str + description: str + + @property + def params_required(self) -> bool: + if self.params_class is not None: + return any(p.required for p in self.params_class.props) + return self.body_type is not None and self.body_required + + +@dataclass +class Model: + spec: Spec + classes: list[JClass] # top-level classes, in emission order + operations: list[OpModel] + resources: dict[str, list[OpModel]] + + +def is_nullable(schema: dict[str, Any]) -> bool: + if schema.get("nullable") is True: + return True + t = schema.get("type") + if isinstance(t, list) and "null" in t: + return True + for key in ("oneOf", "anyOf"): + for part in schema.get(key, []) or []: + if isinstance(part, dict) and (part.get("type") == "null" or part.get("enum") == [None]): + return True + return False + + +def description_of(schema: dict[str, Any]) -> str: + text = schema.get("description") or schema.get("title") or "" + return str(text).strip() + + +class Builder: + """Walks the spec and builds the Java type model.""" + + def __init__(self, spec: Spec) -> None: + self.spec = spec + self.by_pointer: dict[tuple[str, str], TypeRef] = {} + self.top_names: dict[str, JClass] = {} + self.top_classes: list[JClass] = [] + self.component_names: dict[tuple[str, str], str] = {} + self._plan_component_names() + + # -- naming ----------------------------------------------------------------- + + def _plan_component_names(self) -> None: + taken: set[str] = set() + for spec_name in ("verification", "account"): + doc = self.spec.docs[spec_name] + for comp in sorted(doc.data.get("components", {}).get("schemas", {})): + java = names.pascal(comp) + if java in taken or java in names.RESERVED_TYPE_NAMES: + java = ("Account" if spec_name == "account" else "Api") + java + if java in taken: + raise SpecError(f"component {comp!r} cannot get a unique Java name") + taken.add(java) + self.component_names[(spec_name, comp)] = java + + def _new_class( + self, kind: str, name: str, outer: JClass | None, doc: Document, pointer: str, origin: str + ) -> JClass: + if outer is None: + if name in self.top_names or name in names.RESERVED_TYPE_NAMES: + raise SpecError(f"two generated types are both named {name} ({pointer})") + cls = JClass(kind, name, None, origin=origin, pointer=pointer, doc_name=doc.name) + self.top_names[name] = cls + self.top_classes.append(cls) + return cls + used = {c.name for c in outer.nested} + enclosing = set() + o: JClass | None = outer + while o is not None: + enclosing.add(o.name) + o = o.outer + base = name + candidate = base + counter = 2 + while candidate in used or candidate in enclosing or candidate in names.RESERVED_TYPE_NAMES: + candidate = f"{base}Value" if counter == 2 else f"{base}{counter}" + counter += 1 + cls = JClass(kind, candidate, outer, origin=origin, pointer=pointer, doc_name=doc.name) + outer.nested.append(cls) + return cls + + # -- schemas ---------------------------------------------------------------- + + def component(self, doc: Document, comp: str) -> TypeRef: + spec_name = "account" if doc.name == "account.json" else "verification" + pointer = f"#/components/schemas/{pointer_escape(comp)}" + key = (doc.name, pointer) + if key in self.by_pointer: + return self.by_pointer[key] + schema = doc.data["components"]["schemas"][comp] + java = self.component_names[(spec_name, comp)] + return self.schema_type(doc, schema, pointer, None, java, origin="component") + + def ref_type(self, doc: Document, ref: str, outer: JClass | None, hint: str) -> TypeRef: + prefix = "#/components/schemas/" + if ref.startswith(prefix) and "/" not in ref[len(prefix):]: + comp = ref[len(prefix):].replace("~1", "/").replace("~0", "~") + return self.component(doc, comp) + key = (doc.name, ref) + if key in self.by_pointer: + return self.by_pointer[key] + target = doc.resolve_pointer(ref) + return self.schema_type(doc, target, ref, outer, hint) + + def schema_type( + self, + doc: Document, + schema: Any, + pointer: str, + outer: JClass | None, + hint: str, + origin: str = "inline", + context: str = "json", + ) -> TypeRef: + """Java type for ``schema`` found at ``pointer``; ``hint`` names new classes.""" + if not isinstance(schema, dict): + return TypeRef("any") + key = (doc.name, pointer) + if key in self.by_pointer: + return self.by_pointer[key] + if "$ref" in schema: + return self.ref_type(doc, schema["$ref"], outer, hint) + + all_of = schema.get("allOf") + if all_of: + structural = [k for k in ("properties", "oneOf", "anyOf", "items", "enum") if k in schema] + if len(all_of) == 1 and not structural: + part = all_of[0] + return self.schema_type(doc, part, f"{pointer}/allOf/0", outer, hint, origin, context) + return self._model(doc, schema, pointer, outer, hint, origin) + + variants = schema.get("oneOf") or schema.get("anyOf") + if variants: + word = "oneOf" if "oneOf" in schema else "anyOf" + non_null = [ + (i, v) + for i, v in enumerate(variants) + if not (isinstance(v, dict) and (v.get("type") == "null" or v.get("enum") == [None])) + ] + if len(non_null) == 1: + i, v = non_null[0] + return self.schema_type(doc, v, f"{pointer}/{word}/{i}", outer, hint, origin, context) + return self._union(doc, schema, pointer, outer, hint, origin, word, context) + + if "enum" in schema: + values = [v for v in schema["enum"] if v is not None] + if values and all(isinstance(v, str) for v in values) and schema.get("type") in (None, "string"): + return self._enum(doc, schema, pointer, outer, hint, origin) + if all(isinstance(v, bool) for v in values): + return TypeRef("boolean") + if all(isinstance(v, int) and not isinstance(v, bool) for v in values): + return TypeRef("long") + return TypeRef("any") + + t = schema.get("type") + if isinstance(t, list): + non_null_types = [x for x in t if x != "null"] + t = non_null_types[0] if len(non_null_types) == 1 else None + if t == "object" or (t is None and "properties" in schema): + if schema.get("properties"): + return self._model(doc, schema, pointer, outer, hint, origin) + extra = schema.get("additionalProperties") + if isinstance(extra, dict) and extra: + item = self.schema_type( + doc, extra, f"{pointer}/additionalProperties", outer, hint + "Value", context=context + ) + return self._remember(key, TypeRef("map", item=item)) + return self._remember(key, TypeRef("object")) + if t == "array": + item_schema = schema.get("items", {}) + item = self.schema_type(doc, item_schema, f"{pointer}/items", outer, hint, context=context) + return self._remember(key, TypeRef("list", item=item)) + if t == "string": + fmt = schema.get("format") + if fmt == "date-time": + return TypeRef("datetime") + if fmt == "date": + return TypeRef("date") + if fmt == "binary": + return TypeRef("file") if context == "multipart" else TypeRef("string") + return TypeRef("string") + if t == "integer": + return TypeRef("long") + if t == "number": + return TypeRef("double") + if t == "boolean": + return TypeRef("boolean") + return TypeRef("any") + + def _remember(self, key: tuple[str, str], t: TypeRef) -> TypeRef: + self.by_pointer[key] = t + return t + + def _enum( + self, doc: Document, schema: dict[str, Any], pointer: str, outer: JClass | None, hint: str, origin: str + ) -> TypeRef: + cls = self._new_class("enum", hint, outer, doc, pointer, origin) + t = self._remember((doc.name, pointer), TypeRef("class", cls=cls)) + seen: list[str] = [] + for v in schema["enum"]: + if isinstance(v, str) and v not in seen: + seen.append(v) + cls.values = seen + cls.description = description_of(schema) + cls.deprecated = bool(schema.get("deprecated")) + cls.complete = True + return t + + def _collect_object( + self, doc: Document, schema: dict[str, Any], pointer: str, depth: int = 0 + ) -> tuple[list[tuple[str, dict[str, Any], str, Document]], set[str], list[TypeRef]]: + """Flattens allOf. Returns (name, schema, pointer, doc) per property, required names, $ref parts.""" + if depth > 20: + raise SpecError(f"allOf nesting too deep at {pointer}") + props: list[tuple[str, dict[str, Any], str, Document]] = [] + required: set[str] = set(schema.get("required", []) or []) + refs: list[TypeRef] = [] + for i, part in enumerate(schema.get("allOf", []) or []): + part_pointer = f"{pointer}/allOf/{i}" + if "$ref" in part: + target, last = doc.deref(part) + target_pointer = last or part_pointer + sub_props, sub_required, sub_refs = self._collect_object(doc, target, target_pointer, depth + 1) + refs.append(self.ref_type(doc, part["$ref"], None, "Part")) + refs.extend(sub_refs) + else: + sub_props, sub_required, sub_refs = self._collect_object(doc, part, part_pointer, depth + 1) + refs.extend(sub_refs) + for item in sub_props: + props = [p for p in props if p[0] != item[0]] + props.append(item) + required |= sub_required + for prop_name, prop_schema in (schema.get("properties") or {}).items(): + props = [p for p in props if p[0] != prop_name] + props.append((prop_name, prop_schema, f"{pointer}/properties/{pointer_escape(prop_name)}", doc)) + return props, required, refs + + def _model( + self, + doc: Document, + schema: dict[str, Any], + pointer: str, + outer: JClass | None, + hint: str, + origin: str, + context: str = "json", + skip_read_only: bool = False, + extra_props: list[Prop] | None = None, + ) -> TypeRef: + cls = self._new_class("model", hint, outer, doc, pointer, origin) + t = self._remember((doc.name, pointer), TypeRef("class", cls=cls)) + cls.description = description_of(schema) + cls.deprecated = bool(schema.get("deprecated")) + flat, required, _ = self._collect_object(doc, schema, pointer) + used: set[str] = set() + for prop in extra_props or []: + used.add(prop.java_name) + cls.props.append(prop) + for prop_name, prop_schema, prop_pointer, prop_doc in flat: + resolved, _ = prop_doc.deref(prop_schema) + if skip_read_only and isinstance(resolved, dict) and resolved.get("readOnly"): + continue + if any(p.json_name == prop_name for p in cls.props): + raise SpecError(f"{pointer}: property {prop_name!r} is both a parameter and a body field") + java = names.safe_member(names.camel(prop_name)) + base = java + n = 2 + while java in used: + java = f"{base}{n}" + n += 1 + used.add(java) + owner = cls + ptype = self.schema_type( + prop_doc, prop_schema, prop_pointer, owner, names.pascal(prop_name), context=context + ) + wrapper = prop_schema if isinstance(prop_schema, dict) else {} + nullable = is_nullable(wrapper) or (isinstance(resolved, dict) and is_nullable(resolved)) + desc = description_of(wrapper) or (description_of(resolved) if isinstance(resolved, dict) else "") + deprecated = bool(wrapper.get("deprecated")) or ( + isinstance(resolved, dict) and bool(resolved.get("deprecated")) + ) + cls.props.append( + Prop(prop_name, java, ptype, prop_name in required, nullable, desc, deprecated, resolved) + ) + cls.complete = True + return t + + def _union( + self, + doc: Document, + schema: dict[str, Any], + pointer: str, + outer: JClass | None, + hint: str, + origin: str, + word: str, + context: str, + ) -> TypeRef: + cls = self._new_class("union", hint, outer, doc, pointer, origin) + t = self._remember((doc.name, pointer), TypeRef("class", cls=cls)) + cls.description = description_of(schema) + raw_variants = schema[word] + resolved = [] + for i, v in enumerate(raw_variants): + target, last = doc.deref(v) + if isinstance(target, dict) and (target.get("type") == "null" or target.get("enum") == [None]): + continue + resolved.append((i, v, target, last)) + + # An implicit discriminator: every variant is an object with a one-value enum + # on the same property. + disc_prop = None + candidates = None + for _, _, target, _ in resolved: + props = target.get("properties", {}) if isinstance(target, dict) else {} + singles = { + k for k, s in props.items() if isinstance(s, dict) and len([e for e in s.get("enum", []) if e is not None]) == 1 + } + candidates = singles if candidates is None else candidates & singles + if candidates: + disc_prop = sorted(candidates)[0] + values = [target["properties"][disc_prop]["enum"][0] for _, _, target, _ in resolved] + if len(set(values)) != len(values): + disc_prop = None + + used: set[str] = set() + for index, (i, v, target, last) in enumerate(resolved): + vpointer = f"{pointer}/{word}/{i}" + vtype_kind = target.get("type") if isinstance(target, dict) else None + if disc_prop: + vname = names.pascal(str(target["properties"][disc_prop]["enum"][0])) + detect: tuple[Any, ...] = ("discriminator", disc_prop, target["properties"][disc_prop]["enum"][0]) + elif "$ref" in v: + ref_t = self.ref_type(doc, v["$ref"], None, "Variant") + vname = ref_t.cls.name if ref_t.cls is not None else names.pascal(v["$ref"].rsplit("/", 1)[-1]) + detect = self._shape_detect(target) + elif isinstance(target, dict) and target.get("title") and len(names.words(target["title"])) <= 4: + vname = names.pascal(target["title"]) + detect = self._shape_detect(target) + elif vtype_kind in ("string", "integer", "number", "boolean", "array"): + vname = {"string": "String", "integer": "Long", "number": "Double", "boolean": "Boolean", "array": "List"}[ + vtype_kind + ] + detect = ("json_type", vtype_kind) + else: + first = (description_of(target) if isinstance(target, dict) else "").split(".")[0] + vname = names.pascal(first) if first and len(names.words(first)) <= 3 else f"Variant{index + 1}" + detect = self._shape_detect(target) + base = vname + n = 2 + while vname in used: + vname = f"{base}{n}" + n += 1 + used.add(vname) + vt = self.schema_type(doc, v, vpointer, cls, vname, context=context) + desc = description_of(target) if isinstance(target, dict) else "" + cls.variants.append(Variant(vname, vt, detect, desc)) + cls.props = self._common_props(cls) + # Shape detection needs the properties unique to each object variant. + for variant in cls.variants: + if variant.detect[0] == "shape": + others: set[str] = set() + for other in cls.variants: + if other is not variant and other.detect[0] == "shape": + others |= set(other.detect[2]) + unique = [p for p in variant.detect[2] if p not in others] + variant.detect = ("shape", variant.detect[1], tuple(unique)) + cls.complete = True + return t + + def _common_props(self, cls: JClass) -> list[Prop]: + """Fields every object variant declares, readable without picking a variant.""" + models = [v.type.cls for v in cls.variants if v.type.kind == "class" and v.type.cls is not None] + if len(models) != len(cls.variants) or not models or any(m.kind != "model" for m in models): + return [] + out: list[Prop] = [] + for prop in models[0].props: + others = [next((p for p in m.props if p.json_name == prop.json_name), None) for m in models[1:]] + if any(o is None for o in others): + continue + ptype: TypeRef | None = prop.type + for other in others: + assert other is not None + ptype = _common_type(ptype, other.type) if ptype is not None else None + if ptype is None: + continue + required = prop.required and all(o is not None and o.required for o in others) + nullable = prop.nullable or any(o is not None and o.nullable for o in others) + out.append( + Prop(prop.json_name, prop.java_name, ptype, required, nullable, prop.description, prop.deprecated, prop.schema) + ) + return out + + def _shape_detect(self, target: Any) -> tuple[Any, ...]: + if not isinstance(target, dict): + return ("json_type", "any") + t = target.get("type") + if t in ("string", "integer", "number", "boolean", "array"): + return ("json_type", t) + required = tuple(target.get("required", []) or []) + props = tuple((target.get("properties") or {}).keys()) + return ("shape", required, props) + + # -- operations ------------------------------------------------------------- + + def operation(self, op: Operation) -> OpModel: + doc = op.doc + prefix = names.type_prefix(op.resource, op.method) + java_method = names.safe_method(names.camel(op.method)) + params = op.parameters() + + path_params: list[PathParam] = [] + for segment in _path_names(op.path): + if op.application_scoped and segment in ("organization_id", "application_id"): + continue + param = next((p for p in params if p["in"] == "path" and p["name"] == segment), None) + if param is None: + raise SpecError(f"{op.key}: path parameter {segment!r} is not declared") + path_params.append( + PathParam(segment, names.safe_param(names.camel(segment)), str(param.get("description", "")).strip()) + ) + + query_props: list[Prop] = [] + header_fields: list[tuple[str, str]] = [] + idempotency = False + params_cls_holder: dict[str, JClass] = {} + + def params_owner() -> JClass: + if "cls" not in params_cls_holder: + params_cls_holder["cls"] = self._new_class( + "model", prefix + "Params", None, doc, f"{op.pointer}/x-params", "params" + ) + return params_cls_holder["cls"] + + raw_query: list[dict[str, Any]] = [] + for param in params: + location = param["in"] + if location == "header": + if param["name"].lower() == "idempotency-key": + idempotency = True + if param["name"].lower() in SKIPPED_HEADERS: + continue + if location in ("query", "header"): + raw_query.append(param) + + body = op.raw.get("requestBody") + body_schema = None + body_pointer = "" + body_encoding = None + body_required = False + content_type = None + if body is not None: + body, body_ref = doc.deref(body) + base_pointer = body_ref or f"{op.pointer}/requestBody" + body_required = bool(body.get("required")) + content = body.get("content", {}) + content_type, body_encoding = choose_request_content(doc, content, op) + if content_type is not None: + body_schema = content[content_type].get("schema", {}) + body_pointer = f"{base_pointer}/content/{pointer_escape(content_type)}/schema" + + params_class: JClass | None = None + body_type: TypeRef | None = None + context = "multipart" if body_encoding in ("multipart", "json_or_multipart") else "json" + if body_schema is not None: + target, _ = doc.deref(body_schema) + direct = _direct_ref(body_schema) + if direct is not None and not raw_query: + body_type = self.ref_type(doc, direct, None, prefix + "Params") + if body_type.kind != "class" or body_type.cls is None or body_type.cls.kind != "model": + raise SpecError(f"{op.key}: request body must be an object") + if context == "multipart" and not body_type.cls.has_files(): + pass + else: + if not isinstance(target, dict) or not ( + target.get("type") == "object" or "properties" in target or "allOf" in target + ): + raise SpecError(f"{op.key}: request body schema must be an object") + cls_owner = params_owner() + self.by_pointer[(doc.name, f"{op.pointer}/x-params")] = TypeRef("class", cls=cls_owner) + query_props = self._params_props(doc, op, raw_query, cls_owner) + self._fill_params(cls_owner, doc, target, body_pointer, query_props, context) + params_class = cls_owner + elif raw_query: + cls_owner = params_owner() + query_props = self._params_props(doc, op, raw_query, cls_owner) + cls_owner.props = query_props + cls_owner.complete = True + params_class = cls_owner + + if params_class is not None: + params_class.description = f"Parameters for {{@code {op.resource}.{op.method}}}." + for prop in params_class.props: + if prop.location == "header": + header_fields.append((prop.wire, prop.json_name)) + + response = self._response(op, prefix) + summary = str(op.raw.get("summary", "")).strip() + description = str(op.raw.get("description", "")).strip() + return OpModel( + op, + java_method, + path_params, + params_class, + body_type, + body_required, + body_encoding, + [(p.wire, p.json_name) for p in query_props if p.location == "query"], + header_fields, + response, + idempotency, + summary, + description, + ) + + def _params_props( + self, doc: Document, op: Operation, raw: list[dict[str, Any]], owner: JClass + ) -> list[Prop]: + props: list[Prop] = [] + used: set[str] = set() + for param in raw: + schema = param.get("schema", {}) + target, _ = doc.deref(schema) + pointer = f"{op.pointer}/x-param-{param['in']}-{pointer_escape(param['name'])}" + ptype = self.schema_type(doc, schema, pointer, owner, names.pascal(param["name"])) + java = names.safe_member(names.camel(param["name"])) + base = java + n = 2 + while java in used: + java = f"{base}{n}" + n += 1 + used.add(java) + props.append( + Prop( + param["name"], + java, + ptype, + bool(param.get("required")), + is_nullable(target) if isinstance(target, dict) else False, + str(param.get("description", "")).strip(), + bool(param.get("deprecated")), + target if isinstance(target, dict) else {}, + location=param["in"], + ) + ) + return props + + def _fill_params( + self, + cls: JClass, + doc: Document, + schema: dict[str, Any], + pointer: str, + query_props: list[Prop], + context: str, + ) -> None: + # A query parameter named like a body field keeps both: the query one gets a + # "_query" suffix (Java name nodeIdQuery), like the other SDKs. + body_names = {name for name, _, _, _ in self._collect_object(doc, schema, pointer)[0]} + for prop in query_props: + if prop.json_name in body_names: + prop.wire_name = prop.json_name + prop.json_name = prop.json_name + "_query" + prop.java_name = names.safe_member(names.camel(prop.json_name)) + temp = self._model(doc, schema, pointer + "#tmp", cls, "Tmp", "params", context, True, query_props) + tmp_cls = temp.cls + assert tmp_cls is not None + # Move the flattened properties and nested classes into the Params class. + cls.props = tmp_cls.props + cls.nested.remove(tmp_cls) + for nested in tmp_cls.nested: + nested.outer = cls + cls.nested.append(nested) + cls.description = tmp_cls.description + cls.complete = True + self.by_pointer[(doc.name, pointer)] = TypeRef("class", cls=cls) + + def _response(self, op: Operation, prefix: str) -> ResponseModel: + doc = op.doc + responses = op.raw.get("responses", {}) + codes = sorted(c for c in responses if str(c).startswith("2")) + if not codes: + return ResponseModel("none") + entries = [] + for code in codes: + resp, resp_ref = doc.deref(responses[code]) + base = resp_ref or f"{op.pointer}/responses/{code}" + content = resp.get("content") or {} + json_ct = next((ct for ct in content if ct == "application/json" or ct.endswith("+json")), None) + if json_ct is not None: + schema = content[json_ct].get("schema") + if schema is None: + entries.append((code, "json_node", None, base, json_ct)) + else: + entries.append((code, "json", schema, f"{base}/content/{pointer_escape(json_ct)}/schema", json_ct)) + elif content: + ct = next(iter(content)) + entries.append((code, "binary", None, base, ct)) + elif code == "204": + entries.append((code, "none", None, base, "")) + else: + entries.append((code, "json_node", None, base, "")) + + kinds = {e[1] for e in entries} + if kinds == {"binary"}: + return ResponseModel("binary", statuses=codes, content_type=entries[0][4]) + if kinds == {"none"}: + return ResponseModel("none", statuses=codes) + json_entries = [e for e in entries if e[1] == "json"] + if not json_entries: + return ResponseModel("json_node", statuses=codes) + + # Same schema for every JSON success status: one type. + targets = [] + for e in json_entries: + target, last = doc.deref(e[2]) + targets.append((id(target), e)) + unique = {t for t, _ in targets} + if len(unique) == 1 and len(json_entries) == len(entries): + code, _, schema, pointer, _ = json_entries[0] + hint = prefix + "Response" + rtype = self._response_type(doc, schema, pointer, hint) + page = self._page(op, doc, schema, rtype) + if page is not None: + style, item = page + return ResponseModel("page", type=item, page_style=style, statuses=codes) + return ResponseModel("json", type=rtype, statuses=codes) + + # Different shapes per status: a status union. + cls = self._new_class("status", prefix + "Response", None, doc, f"{op.pointer}/x-status", "response") + for code, kind, schema, pointer, _ in entries: + vname = STATUS_NAMES.get(code, f"Status{code}") + if kind == "json": + vt = self.schema_type(doc, schema, pointer, cls, vname) + else: + vt = TypeRef("any") + cls.variants.append(Variant(vname, vt, ("status", int(code)))) + cls.description = f"Response of {{@code {op.resource}.{op.method}}}; the shape depends on the HTTP status." + cls.complete = True + return ResponseModel("json", type=TypeRef("class", cls=cls), statuses=codes) + + def _response_type(self, doc: Document, schema: dict[str, Any], pointer: str, hint: str) -> TypeRef: + if "$ref" in schema: + return self.ref_type(doc, schema["$ref"], None, hint) + return self.schema_type(doc, schema, pointer, None, hint, origin="response") + + def _page( + self, op: Operation, doc: Document, schema: dict[str, Any], rtype: TypeRef + ) -> tuple[str, TypeRef] | None: + if op.http_method != "get" or rtype.kind != "class" or rtype.cls is None or rtype.cls.kind != "model": + return None + props = {p.json_name: p for p in rtype.cls.props} + query = {p["name"] for p in op.parameters() if p["in"] == "query"} + results = props.get("results") + if results is None or "offset" not in query: + return None + if results.type.kind != "list" or results.type.item is None: + return None + if "next" in props and "count" in props: + return "next", results.type.item + return None + + def build(self) -> Model: + # Components first, so their names are stable. + for spec_name in ("verification", "account"): + doc = self.spec.docs[spec_name] + for comp in sorted(doc.data.get("components", {}).get("schemas", {})): + self.component(doc, comp) + ops: list[OpModel] = [] + for op in self.spec.server_operations(): + ops.append(self.operation(op)) + resources: dict[str, list[OpModel]] = {} + for om in ops: + resources.setdefault(om.op.resource, []).append(om) + for res in list(resources): + parts = res.split(".") + for i in range(1, len(parts)): + resources.setdefault(".".join(parts[:i]), []) + check_resource_names(resources) + return Model(self.spec, sorted(self.top_classes, key=lambda c: c.name), ops, dict(sorted(resources.items()))) + + +def _common_type(a: TypeRef, b: TypeRef) -> TypeRef | None: + """The type two variants' fields share, or None when they differ.""" + if a.kind != b.kind: + return None + if a.kind in ("list", "map"): + assert a.item is not None and b.item is not None + item = _common_type(a.item, b.item) + return None if item is None else TypeRef(a.kind, item=item) + if a.kind == "class": + if a.cls is b.cls: + return a + if a.cls is not None and b.cls is not None and a.cls.kind == "enum" and b.cls.kind == "enum": + return TypeRef("string") + return None + return a + + +STATUS_NAMES = {"200": "Ok", "201": "Created", "202": "Accepted", "203": "NonAuthoritative", "206": "PartialContent"} + + +def _direct_ref(schema: dict[str, Any]) -> str | None: + if "$ref" in schema: + return str(schema["$ref"]) + all_of = schema.get("allOf") + structural = [k for k in ("properties", "oneOf", "anyOf", "items", "enum") if k in schema] + if all_of and len(all_of) == 1 and "$ref" in all_of[0] and not structural: + return str(all_of[0]["$ref"]) + return None + + +def _path_names(path: str) -> list[str]: + out = [] + for segment in path.split("/"): + if segment.startswith("{") and segment.endswith("}"): + out.append(segment[1:-1]) + return out + + +def _schema_has_files(doc: Document, schema: Any) -> bool: + target, _ = doc.deref(schema) + if not isinstance(target, dict): + return False + if target.get("format") == "binary": + return True + for part in target.get("allOf", []) or []: + if _schema_has_files(doc, part): + return True + for prop in (target.get("properties") or {}).values(): + resolved, _ = doc.deref(prop) + if isinstance(resolved, dict): + if resolved.get("format") == "binary": + return True + if resolved.get("type") == "array" and _schema_has_files(doc, resolved.get("items", {})): + return True + return False + + +def choose_request_content( + doc: Document, content: dict[str, Any], op: Operation +) -> tuple[str | None, str | None]: + """Picks the request body encoding: JSON, unless only multipart can carry the files.""" + has_json = "application/json" in content + multipart = content.get("multipart/form-data") + if multipart is not None and _schema_has_files(doc, multipart.get("schema", {})): + return "multipart/form-data", ("json_or_multipart" if has_json else "multipart") + if has_json: + return "application/json", "json" + if multipart is not None: + return "multipart/form-data", "multipart" + if "application/x-www-form-urlencoded" in content: + raise SpecError(f"{op.key}: form-urlencoded only bodies are not supported") + if content: + raise SpecError(f"{op.key}: unsupported request content types {sorted(content)}") + return None, None + + +def check_resource_names(resources: dict[str, list[OpModel]]) -> None: + for res, ops in resources.items(): + children = {r.split(".")[-1] for r in resources if r.startswith(res + ".") and r.count(".") == res.count(".") + 1} + methods = [om.java_method for om in ops] + dupes = {m for m in methods if methods.count(m) > 1} + if dupes: + raise SpecError(f"resource {res} has duplicate methods {sorted(dupes)}") + child_java = {names.camel(c) for c in children} + clash = (set(methods) & child_java) | ({"withRawResponse", "withOptions"} & set(methods)) + if clash: + raise SpecError(f"resource {res}: method names clash with sub-resources: {sorted(clash)}") + + +def build(spec: Spec) -> Model: + return Builder(spec).build() diff --git a/codegen/didit_codegen/names.py b/codegen/didit_codegen/names.py new file mode 100644 index 0000000..0eff0a6 --- /dev/null +++ b/codegen/didit_codegen/names.py @@ -0,0 +1,121 @@ +"""Name conversion from the spec's snake_case to Java idiom (DESIGN 4 and 5.1).""" + +from __future__ import annotations + +import re +import unicodedata + +JAVA_KEYWORDS = frozenset( + """ + abstract assert boolean break byte case catch char class const continue default do double + else enum extends final finally float for goto if implements import instanceof int interface + long native new package private protected public return short static strictfp super switch + synchronized this throw throws transient try void volatile while true false null var yield + record sealed permits non-sealed when _ + """.split() +) + +# Methods every generated model, union or builder already has. A property whose +# Java name equals one of these gets a trailing underscore. +RESERVED_MODEL_METHODS = frozenset( + """ + equals hashCode toString getClass notify notifyAll wait clone finalize + builder toBuilder fromJson build validate + """.split() +) + +# Simple names used unqualified inside generated files. A nested class must not +# shadow them. +RESERVED_TYPE_NAMES = frozenset( + """ + Builder Optional List Map Set String Long Double Boolean Integer Object Override Deprecated + Nullable JsonNode ObjectNode Json Conv JsonModel JsonUnion StringEnum MultiStatusResponse + FileUpload OffsetDateTime LocalDate Collections Objects Class Void Iterable Function + CompletableFuture RequestOptions RawResponse Page BinaryResponse ApiClient ApiRequest + Responses NullMarked Generated Arrays Math System Thread Exception RuntimeException + """.split() +) + + +def words(name: str) -> list[str]: + """Splits an identifier or free text into words, keeping inner camelCase.""" + text = unicodedata.normalize("NFKD", name) + text = "".join(ch for ch in text if ord(ch) < 128) + parts = re.split(r"[^A-Za-z0-9]+", text) + out: list[str] = [] + for part in parts: + if not part: + continue + # Split lowerUpper boundaries ("lastName" -> "last", "Name"), keep acronyms. + out.extend(re.findall(r"[A-Z]+(?=[A-Z][a-z]|[0-9]|$)|[A-Z]?[a-z]+|[A-Z]+|[0-9]+", part)) + return out + + +def pascal(name: str) -> str: + """``contact_details`` -> ``ContactDetails``; ``SessionDecision`` stays as is.""" + if re.fullmatch(r"[A-Z][A-Za-z0-9]*", name): + return name + result = "".join(w[:1].upper() + w[1:] for w in words(name)) + if not result: + return "Value" + if result[0].isdigit(): + result = "V" + result + return result + + +def camel(name: str) -> str: + """``session_id`` -> ``sessionId``; ``lastName`` stays as is.""" + ws = words(name) + if not ws: + return "value" + first = ws[0] + first = first.lower() if first.isupper() and len(first) > 1 else first[:1].lower() + first[1:] + result = first + "".join(w[:1].upper() + w[1:] for w in ws[1:]) + if result[0].isdigit(): + result = "_" + result + return result + + +def constant(value: str) -> str: + """Enum constant for a value: ``Not Started`` -> ``NOT_STARTED``.""" + ws = words(value) + if not ws: + return "EMPTY" if value == "" else "VALUE" + result = "_".join(w.upper() for w in ws) + if result[0].isdigit(): + result = "_" + result + return result + + +def safe_member(name: str) -> str: + """A Java method or parameter name that is not a keyword or a reserved method.""" + if name in JAVA_KEYWORDS or name in RESERVED_MODEL_METHODS: + return name + "_" + return name + + +OBJECT_METHODS = frozenset("equals hashCode toString getClass notify notifyAll wait clone finalize".split()) + + +def safe_method(name: str) -> str: + """A resource method name: not a keyword and not a method of java.lang.Object.""" + if name in JAVA_KEYWORDS or name in OBJECT_METHODS: + return name + "_" + return name + + +def safe_param(name: str) -> str: + """A Java parameter name that is not a keyword and not used by generated code.""" + if name in JAVA_KEYWORDS or name in ("params", "options", "client"): + return name + "_" + return name + + +def resource_class(resource: str) -> str: + """``sessions.imports`` -> ``SessionsImportsResource``.""" + return "".join(pascal(seg) for seg in resource.split(".")) + "Resource" + + +def type_prefix(resource: str, method: str) -> str: + """``sessions.imports`` + ``create`` -> ``SessionsImportsCreate`` (DESIGN 5.1).""" + return "".join(pascal(seg) for seg in resource.split(".")) + pascal(method) diff --git a/codegen/didit_codegen/spec.py b/codegen/didit_codegen/spec.py new file mode 100644 index 0000000..b10e793 --- /dev/null +++ b/codegen/didit_codegen/spec.py @@ -0,0 +1,224 @@ +"""Loads ``openapi/`` and resolves the SDK naming of every operation (DESIGN 3 and 4).""" + +from __future__ import annotations + +import copy +import json +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any + +HTTP_METHODS = ("get", "post", "put", "patch", "delete") +SPECS = (("verification", "verification.json", ""), ("account", "account.json", "account ")) +AUTH_KINDS = ("api_key", "account_token", "none", "device_token", "public") +APPLICATION_PREFIX = "/v3/organization/{organization_id}/application/{application_id}/" + + +class SpecError(Exception): + """The OpenAPI documents cannot be turned into an SDK; the message says why.""" + + +def pointer_escape(token: str) -> str: + return token.replace("~", "~0").replace("/", "~1") + + +def pointer_unescape(token: str) -> str: + return token.replace("~1", "/").replace("~0", "~") + + +@dataclass +class Document: + """One OpenAPI document with JSON pointer resolution.""" + + name: str + data: dict[str, Any] + + def resolve_pointer(self, ref: str) -> Any: + if not ref.startswith("#/"): + raise SpecError(f"{self.name}: only local $ref values are supported, got {ref!r}") + node: Any = self.data + for token in ref[2:].split("/"): + token = pointer_unescape(token) + if isinstance(node, list): + node = node[int(token)] + elif isinstance(node, dict) and token in node: + node = node[token] + else: + raise SpecError(f"{self.name}: unresolvable $ref {ref!r}") + return node + + def deref(self, node: Any) -> tuple[Any, str | None]: + """Follows ``$ref`` chains. Returns the target and the last pointer followed.""" + last = None + seen = set() + while isinstance(node, dict) and "$ref" in node: + ref = node["$ref"] + if ref in seen: + raise SpecError(f"{self.name}: $ref cycle at {ref!r}") + seen.add(ref) + last = ref + node = self.resolve_pointer(ref) + return node, last + + +@dataclass +class Operation: + spec: str + doc: Document + http_method: str + path: str + raw: dict[str, Any] + path_item: dict[str, Any] + sdk: dict[str, Any] + pointer: str + deprecated: dict[str, Any] | None = None + extra: dict[str, Any] = field(default_factory=dict) + + @property + def key(self) -> str: + prefix = "" if self.spec == "verification" else "account " + return f"{prefix}{self.http_method.upper()} {self.path}" + + @property + def resource(self) -> str: + return str(self.sdk["resource"]) + + @property + def method(self) -> str: + return str(self.sdk["method"]) + + @property + def full_name(self) -> str: + return f"{self.resource}.{self.method}" + + @property + def application_scoped(self) -> bool: + return self.sdk.get("scope") == "application" + + def parameters(self) -> list[dict[str, Any]]: + merged: dict[tuple[str, str], dict[str, Any]] = {} + for raw in list(self.path_item.get("parameters", [])) + list(self.raw.get("parameters", [])): + param, _ = self.doc.deref(raw) + merged[(param["in"], param["name"])] = param + return list(merged.values()) + + +@dataclass +class Spec: + root: Path + docs: dict[str, Document] + overlay: dict[str, Any] + operations: list[Operation] + deprecated_file: dict[str, Any] + + def server_operations(self) -> list[Operation]: + return [op for op in self.operations if op.sdk.get("server")] + + +def load_json(path: Path) -> Any: + with path.open(encoding="utf-8") as handle: + return json.load(handle) + + +def validate_sdk(key: str, sdk: Any, origin: str) -> dict[str, Any]: + if not isinstance(sdk, dict): + raise SpecError(f"{key}: x-didit-sdk from {origin} must be an object") + for required in ("resource", "method", "auth", "server"): + if required not in sdk: + raise SpecError(f"{key}: x-didit-sdk from {origin} lacks {required!r}") + if sdk["auth"] not in AUTH_KINDS: + raise SpecError(f"{key}: unknown auth {sdk['auth']!r} in x-didit-sdk from {origin}") + for segment in str(sdk["resource"]).split("."): + if not segment or not segment.replace("_", "a").isalnum() or not segment[0].isalpha(): + raise SpecError(f"{key}: resource {sdk['resource']!r} is not a dot path of snake_case names") + if not str(sdk["method"]).replace("_", "a").isalnum(): + raise SpecError(f"{key}: method {sdk['method']!r} is not snake_case") + return sdk + + +def load(root: Path) -> Spec: + """Reads ``openapi/`` under ``root`` and returns every operation with its SDK naming.""" + openapi = root / "openapi" + overlay = load_json(openapi / "overlay.json") + overlay_ops: dict[str, Any] = overlay.get("operations", {}) + deprecated_path = openapi / "deprecated-operations.json" + deprecated_file = load_json(deprecated_path) if deprecated_path.exists() else {"version": 1, "methods": {}} + + docs: dict[str, Document] = {} + operations: list[Operation] = [] + missing: list[str] = [] + for spec_name, file_name, key_prefix in SPECS: + data = load_json(openapi / file_name) + doc = Document(file_name, data) + docs[spec_name] = doc + for path, path_item in data.get("paths", {}).items(): + for http_method in HTTP_METHODS: + raw = path_item.get(http_method) + if raw is None: + continue + key = f"{key_prefix}{http_method.upper()} {path}" + if "x-didit-sdk" in raw: + sdk = validate_sdk(key, raw["x-didit-sdk"], file_name) + elif key in overlay_ops: + sdk = validate_sdk(key, overlay_ops[key], "overlay.json") + else: + missing.append(key) + continue + pointer = f"#/paths/{pointer_escape(path)}/{http_method}" + operations.append( + Operation(spec_name, doc, http_method, path, raw, path_item, sdk, pointer) + ) + if missing: + lines = "\n".join(f" - {key}" for key in sorted(missing)) + raise SpecError( + "These operations have no SDK naming (x-didit-sdk). Add an entry for each to " + "openapi/overlay.json (or upstream), see docs/DESIGN.md section 4:\n" + lines + ) + + stale = sorted(set(overlay_ops) - {op.key for op in operations}) + if stale: + lines = "\n".join(f" - {key}" for key in stale) + raise SpecError("openapi/overlay.json names operations the spec no longer has:\n" + lines) + + current = {op.full_name for op in operations if op.sdk.get("server")} + for full_name, entry in sorted(deprecated_file.get("methods", {}).items()): + if full_name in current: + continue + spec_name = entry.get("spec", "verification") + doc = docs[spec_name] + doc.data.setdefault("x-deprecated-operations", {}) + components = doc.data.setdefault("components", {}).setdefault("schemas", {}) + for name, schema in entry.get("components", {}).items(): + components.setdefault(name, copy.deepcopy(schema)) + doc.data["x-deprecated-operations"][full_name] = { + "operation": copy.deepcopy(entry["operation"]), + "path_item": {"parameters": copy.deepcopy(entry.get("path_parameters", []))}, + } + sdk = validate_sdk(full_name, entry["x-didit-sdk"], "deprecated-operations.json") + pointer = f"#/x-deprecated-operations/{pointer_escape(full_name)}/operation" + stored = doc.data["x-deprecated-operations"][full_name] + operations.append( + Operation( + spec_name, + doc, + entry["http_method"].lower(), + entry["path"], + stored["operation"], + stored["path_item"], + sdk, + pointer, + deprecated=entry, + ) + ) + + seen: dict[str, Operation] = {} + for op in operations: + if not op.sdk.get("server"): + continue + if op.application_scoped and not op.path.startswith(APPLICATION_PREFIX): + raise SpecError(f"{op.key}: scope application needs a path under {APPLICATION_PREFIX}") + other = seen.get(op.full_name) + if other is not None: + raise SpecError(f"{op.key} and {other.key} both map to {op.full_name}") + seen[op.full_name] = op + return Spec(root, docs, overlay, operations, deprecated_file) diff --git a/codegen/didit_codegen/testgen.py b/codegen/didit_codegen/testgen.py new file mode 100644 index 0000000..ab56675 --- /dev/null +++ b/codegen/didit_codegen/testgen.py @@ -0,0 +1,605 @@ +"""Generated operation tests (DESIGN 11): one test per server operation. + +Each test stubs the HTTP layer, calls the SDK method with synthetic parameters for every +top-level field, and asserts the method, path (ids filled, application scope expanded), query, +headers, body encoding and the parsed response. Response bodies come from the spec's own +examples, read from openapi/ at test time (so no example value is copied into the repository); +an operation without an example gets a synthetic body. +""" + +from __future__ import annotations + +import datetime as _dt +import json +import re +from typing import Any + +from . import names +from .javagen import HEADER, RESOURCES_PKG, Ctx, file_text, java_string, params_type +from .model import JClass, Model, OpModel, Prop, TypeRef +from .spec import Document + +ORG_ID = "00000000-0000-4000-8000-0000000000a1" +APP_ID = "00000000-0000-4000-8000-0000000000a2" +DATE_TIME = "2026-11-01T10:15:30Z" +DATE = "2026-11-01" +FILE_BYTES = [37, 80, 68, 70] # "%PDF" + + +class Unsupported(Exception): + """A synthetic value cannot be built for this type.""" + + +def _uuid(seed: str) -> str: + n = sum(ord(c) * (i + 1) for i, c in enumerate(seed)) % 0xFFFFFFFFFFFF + return f"00000000-0000-4000-8000-{n:012x}" + + +def string_value(schema: dict[str, Any], name: str) -> str: + fmt = schema.get("format") if isinstance(schema, dict) else None + if fmt == "uuid": + return _uuid(name) + if fmt == "email": + return "user@example.com" + if fmt in ("uri", "url"): + return "https://example.com/callback" + if fmt in ("ip", "ipv4"): + return "192.0.2.10" + pattern = schema.get("pattern") if isinstance(schema, dict) else None + if pattern == "^[A-Z]{3}$": + return "USD" + return "value-" + re.sub(r"[^a-z0-9]+", "-", name.lower()).strip("-") + + +class Synth: + """Builds a Java expression and the JSON it must produce, for a type.""" + + def __init__(self, ctx: Ctx) -> None: + self.ctx = ctx + + def value(self, t: TypeRef, schema: dict[str, Any], name: str, depth: int) -> tuple[str, Any]: + k = t.kind + if k == "string": + v = string_value(schema, name) + return java_string(v), v + if k == "long": + return "1L", 1 + if k == "double": + return "1.5", 1.5 + if k == "boolean": + return "true", True + if k == "datetime": + self.ctx.use("java.time.OffsetDateTime") + return f'OffsetDateTime.parse("{DATE_TIME}")', DATE_TIME + if k == "date": + self.ctx.use("java.time.LocalDate") + return f'LocalDate.parse("{DATE}")', DATE + if k == "any": + return java_string("value"), "value" + if k == "object": + self.ctx.use("java.util.Map") + return 'Map.of("key", "value")', {"key": "value"} + if k == "file": + self.ctx.use("me.didit.core.FileUpload") + return ( + 'FileUpload.of(new byte[] {37, 80, 68, 70}, "' + name + '.pdf", "application/pdf")', + {"$file": name + ".pdf"}, + ) + if k == "list": + assert t.item is not None + self.ctx.use("java.util.List") + items = schema.get("items", {}) if isinstance(schema, dict) else {} + expr, val = self.value(t.item, items if isinstance(items, dict) else {}, name, depth + 1) + return f"List.of({expr})", [val] + if k == "map": + assert t.item is not None + self.ctx.use("java.util.Map") + expr, val = self.value(t.item, {}, name, depth + 1) + return f'Map.of("key", {expr})', {"key": val} + if k == "class": + assert t.cls is not None + return self.cls_value(t.cls, name, depth) + raise Unsupported(k) + + def cls_value(self, cls: JClass, name: str, depth: int) -> tuple[str, Any]: + ref = self.ctx.ref(cls) + if cls.kind == "enum": + if not cls.values: + return f'{ref}.of("value")', "value" + const = enum_constant(cls, 0) + return f"{ref}.{const}", cls.values[0] + if cls.kind == "union": + variant = cls.variants[0] + expr, val = self.value(variant.type, {}, name, depth + 1) + return f"{ref}.of{variant.name}({expr})", val + if cls.kind == "model": + if depth > 6: + if any(p.required for p in cls.props): + raise Unsupported("required fields too deep") + return f"{ref}.builder().build()", {} + calls, value = self.model_calls(cls, depth, all_props=depth <= 1) + return f"{ref}.builder(){calls}.build()", value + raise Unsupported(cls.kind) + + def model_calls(self, cls: JClass, depth: int, all_props: bool) -> tuple[str, dict[str, Any]]: + calls = [] + value: dict[str, Any] = {} + chosen = [p for p in cls.props if p.required] + if all_props: + chosen = list(cls.props) + else: + chosen += [p for p in cls.props if not p.required][:2] + chosen = [p for p in cls.props if p in chosen] + for prop in chosen: + expr, val = self.value(prop.type, prop.schema, prop.json_name, depth + 1) + calls.append(f".{prop.java_name}({expr})") + value[prop.json_name] = val + return "".join(calls), value + + +def enum_constant(cls: JClass, index: int) -> str: + used: set[str] = {"KNOWN_VALUES"} + consts: list[str] = [] + for value in cls.values: + const = names.constant(value) + base = const + n = 2 + while const in used: + const = f"{base}_{n}" + n += 1 + used.add(const) + consts.append(const) + return consts[index] + + +# -- examples ---------------------------------------------------------------------- + + +def find_example(doc: Document, op: OpModel, status: str) -> Any: + """The spec example the Java test helper finds for this response, or None.""" + response = op.op.raw.get("responses", {}).get(status) + if response is None: + return None + response, _ = doc.deref(response) + media = (response.get("content") or {}).get("application/json") + if not isinstance(media, dict): + return None + if "example" in media: + return media["example"] + examples = media.get("examples") + if isinstance(examples, dict) and examples: + first = next(iter(examples.values())) + first, _ = doc.deref(first) + if isinstance(first, dict) and "value" in first: + return first["value"] + schema = media.get("schema") + if isinstance(schema, dict): + target, _ = doc.deref(schema) + if isinstance(target, dict) and "example" in target: + return target["example"] + return None + + +def readable(t: TypeRef, value: Any, required: bool, nullable: bool) -> bool: + """Whether every getter the Java walker calls on ``value`` succeeds.""" + if value is None: + return not required or nullable + k = t.kind + if k == "string": + return isinstance(value, (str, int, float, bool)) + if k == "long": + if isinstance(value, bool): + return False + if isinstance(value, int): + return -(2**63) <= value < 2**63 + if isinstance(value, float): + return value.is_integer() + if isinstance(value, str): + return bool(re.fullmatch(r"\s*-?\d+(\.0*)?\s*", value)) + return False + if k == "double": + if isinstance(value, bool): + return False + if isinstance(value, (int, float)): + return True + if isinstance(value, str): + try: + float(value) + return True + except ValueError: + return False + return False + if k == "boolean": + return isinstance(value, bool) or value in ("true", "false") + if k == "datetime": + if isinstance(value, (int, float)) and not isinstance(value, bool): + return True + if not isinstance(value, str): + return False + return _datetime_ok(value) + if k == "date": + if not isinstance(value, str): + return False + try: + _dt.date.fromisoformat(value[:10]) + return True + except ValueError: + return False + if k == "any": + return True + if k == "object": + return isinstance(value, dict) + if k == "list": + assert t.item is not None + return isinstance(value, list) and all(v is not None and readable(t.item, v, True, False) for v in value) + if k == "map": + assert t.item is not None + return isinstance(value, dict) and all(v is None or readable(t.item, v, True, False) for v in value.values()) + if k == "class": + assert t.cls is not None + return cls_readable(t.cls, value) + return True + + +def _datetime_ok(value: str) -> bool: + for candidate in (value, value.replace("Z", "+00:00")): + try: + _dt.datetime.fromisoformat(candidate) + return True + except ValueError: + continue + try: + _dt.date.fromisoformat(value) + return True + except ValueError: + return False + + +def detect(variant_detect: tuple[Any, ...], value: Any, status: int | None = None) -> bool: + kind = variant_detect[0] + if kind == "discriminator": + return isinstance(value, dict) and value.get(variant_detect[1]) == variant_detect[2] + if kind == "shape": + if not isinstance(value, dict): + return False + required, unique = variant_detect[1], variant_detect[2] + if required: + return all(r in value for r in required) + if unique: + return any(u in value for u in unique) + return True + if kind == "json_type": + jt = variant_detect[1] + if jt == "string": + return isinstance(value, str) + if jt == "integer": + return isinstance(value, int) and not isinstance(value, bool) + if jt == "number": + return isinstance(value, (int, float)) and not isinstance(value, bool) + if jt == "boolean": + return isinstance(value, bool) + if jt == "array": + return isinstance(value, list) + return value is not None + if kind == "status": + return status == variant_detect[1] + return False + + +def cls_readable(cls: JClass, value: Any, status: int | None = None) -> bool: + if cls.kind == "enum": + return isinstance(value, str) + if cls.kind == "model": + if not isinstance(value, dict): + return False + return all( + readable(p.type, value.get(p.json_name), p.required and not p.nullable, p.nullable or not p.required) + and (not (p.required and not p.nullable) or value.get(p.json_name) is not None) + for p in cls.props + if p.type.kind != "file" + ) + if cls.kind in ("union", "status"): + if cls.kind == "union" and cls.props: + if not isinstance(value, dict): + return False + for p in cls.props: + v = value.get(p.json_name) + if p.required and not p.nullable and v is None: + return False + if v is not None and not readable(p.type, v, True, False): + return False + for variant in cls.variants: + if detect(variant.detect, value, status) and not readable(variant.type, value, True, False): + return False + return True + return True + + +def synthetic_response(t: TypeRef | None, depth: int = 0) -> Any: + """A minimal JSON value the type reads without errors.""" + if t is None: + return {} + k = t.kind + if k == "string": + return "value" + if k == "long": + return 1 + if k == "double": + return 1.5 + if k == "boolean": + return True + if k == "datetime": + return DATE_TIME + if k == "date": + return DATE + if k in ("any", "object"): + return {} + if k == "list": + return [] + if k == "map": + return {} + if k == "class": + assert t.cls is not None + cls = t.cls + if cls.kind == "enum": + return cls.values[0] if cls.values else "value" + if cls.kind == "status": + return synthetic_response(cls.variants[0].type, depth + 1) + if cls.kind == "union": + v = synthetic_response(cls.variants[0].type, depth + 1) + if isinstance(v, dict): + for p in cls.props: + if p.required and p.json_name not in v: + v[p.json_name] = synthetic_response(p.type, depth + 1) + if cls.variants[0].detect[0] == "discriminator": + v[cls.variants[0].detect[1]] = cls.variants[0].detect[2] + return v + if cls.kind == "model": + if depth > 8: + return {} + return { + p.json_name: synthetic_response(p.type, depth + 1) + for p in cls.props + if p.required and p.type.kind != "file" + } + return {} + + +# -- emission ---------------------------------------------------------------------- + + +def expected_query_value(val: Any) -> list[str]: + if isinstance(val, bool): + return ["true" if val else "false"] + if isinstance(val, list): + out: list[str] = [] + for v in val: + out += expected_query_value(v) + return out + if isinstance(val, (dict,)): + return [json.dumps(val, separators=(",", ":"))] + return [str(val)] + + +def multipart_expectation(body: dict[str, Any]) -> tuple[dict[str, list[str]], dict[str, list[str]]]: + fields: dict[str, list[str]] = {} + files: dict[str, list[str]] = {} + + def add(name: str, val: Any) -> None: + if val is None: + return + if isinstance(val, dict) and "$file" in val: + files.setdefault(name, []).append(val["$file"]) + return + if isinstance(val, list): + if all(isinstance(v, dict) and "$file" in v for v in val): + for v in val: + add(name, v) + return + if all(not isinstance(v, (dict, list)) for v in val): + for v in val: + add(name, v) + return + fields.setdefault(name, []).append(json.dumps(val, separators=(",", ":"), ensure_ascii=False)) + return + if isinstance(val, dict): + fields.setdefault(name, []).append(json.dumps(val, separators=(",", ":"), ensure_ascii=False)) + return + if isinstance(val, bool): + fields.setdefault(name, []).append("true" if val else "false") + return + fields.setdefault(name, []).append(str(val)) + + for name, val in body.items(): + add(name, val) + return fields, files + + +def java_map_of_lists(d: dict[str, list[str]], ctx: Ctx) -> str: + ctx.use("java.util.Map") + ctx.use("java.util.List") + if not d: + return "Map.of()" + entries = ", ".join( + f"Map.entry({java_string(k)}, List.of({', '.join(java_string(v) for v in vs)}))" for k, vs in d.items() + ) + return f"Map.ofEntries({entries})" + + +def emit_test(om: OpModel, ctx: Ctx) -> str: + op = om.op + synth = Synth(ctx) + resource_chain = "".join(f".{names.camel(seg)}()" for seg in op.resource.split(".")) + lines: list[str] = [] + args: list[str] = [] + path = op.path + for segment in re.findall(r"\{([^}]+)\}", op.path): + if op.application_scoped and segment == "organization_id": + path = path.replace("{organization_id}", ORG_ID) + continue + if op.application_scoped and segment == "application_id": + path = path.replace("{application_id}", APP_ID) + continue + value = _uuid(op.full_name + segment) + path = path.replace("{" + segment + "}", value) + args.append(java_string(value)) + + query: dict[str, list[str]] = {} + headers: dict[str, str] = {} + body: dict[str, Any] | None = None + ptype = params_type(om, ctx) + if ptype is not None: + cls = om.params_class or (om.body_type.cls if om.body_type is not None else None) + assert cls is not None + calls, value = synth.model_calls(cls, 1, all_props=True) + lines.append(f" {ptype} params = {ptype}.builder(){calls}.build();") + args.append("params") + props = {p.json_name: p for p in cls.props} + body = {} + for key, val in value.items(): + prop: Prop = props[key] + if om.params_class is not None and prop.location == "query": + query[prop.wire] = expected_query_value(val) + elif om.params_class is not None and prop.location == "header": + headers[prop.wire] = expected_query_value(val)[0] + else: + body[key] = val + if om.idempotency: + ctx.use("me.didit.core.RequestOptions") + lines.append(' RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build();') + args.append("options") + headers["Idempotency-Key"] = "idem-1" + + # Response stub + r = om.response + status = r.statuses[0] if r.statuses else "200" + example = None + if r.kind in ("json", "page", "json_node"): + example = find_example(op.doc, om, status) + if r.kind == "none": + lines.append(f" transport.respond({status}, \"\");") + elif r.kind == "binary": + lines.append(f" transport.respondBinary({status}, {java_string(r.content_type)}, new byte[] {{37, 80, 68, 70}});") + else: + if example is not None: + lines.append( + f" JsonNode example = SpecExamples.response({java_string(op.doc.name)}, " + f"{java_string(op.http_method.upper())}, {java_string(op.path)}, {java_string(status)});" + ) + else: + synthetic = synthetic_response(r.type) if r.kind in ("json", "page") else {"ok": True} + if r.kind == "page": + synthetic = {"count": 0, "next": None, "previous": None, "results": []} + example = synthetic + text = json.dumps(synthetic, separators=(",", ":"), sort_keys=True) + lines.append(f" JsonNode example = TestJson.parse({java_string(text)});") + ctx.use("com.fasterxml.jackson.databind.JsonNode") + lines.append(f" transport.respondJson({status}, example);") + + call = f"client{resource_chain}.{om.java_method}({', '.join(args)})" + if r.kind == "none": + lines.append(f" {call};") + else: + lines.append(f" var result = {call};") + + lines.append(" RecordedRequest request = transport.only();") + lines.append(f" assertEquals({java_string(op.http_method.upper())}, request.method());") + lines.append(f" assertEquals({java_string(path)}, request.path());") + lines.append(f" assertEquals({java_map_of_lists(query, ctx)}, request.query());") + auth = op.sdk.get("auth") + if auth == "api_key": + lines.append(' assertEquals("test-api-key", request.header("x-api-key"));') + lines.append(' assertEquals("https://verification.didit.me", request.origin());') + elif auth == "account_token": + lines.append(' assertEquals("Bearer test-account-token", request.header("Authorization"));') + lines.append(' assertEquals(null, request.header("x-api-key"));') + lines.append(' assertEquals("https://apx.didit.me", request.origin());') + else: + lines.append(' assertEquals(null, request.header("x-api-key"));') + lines.append(' assertEquals(null, request.header("Authorization"));') + for name, value in headers.items(): + lines.append(f" assertEquals({java_string(value)}, request.header({java_string(name)}));") + if r.kind == "binary": + lines.append(f" assertEquals({java_string(r.content_type + ', application/json')}, request.header(\"Accept\"));") + + if body is not None and (om.body_encoding is not None): + has_files = any(isinstance(v, dict) and "$file" in v or isinstance(v, list) and v and isinstance(v[0], dict) and "$file" in v[0] for v in body.values()) + if om.body_encoding == "multipart" or (om.body_encoding == "json_or_multipart" and has_files): + fields, files = multipart_expectation(body) + lines.append(f" assertEquals({java_map_of_lists(fields, ctx)}, request.multipartFields());") + lines.append(f" assertEquals({java_map_of_lists(files, ctx)}, request.multipartFiles());") + else: + text = json.dumps(body, separators=(",", ":"), ensure_ascii=False) + lines.append(f" TestJson.assertJsonEquals({java_string(text)}, request.body());") + else: + lines.append(" assertEquals(0, request.body().length);") + + # Response checks + if r.kind == "binary": + lines.append(" assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes());") + elif r.kind == "page": + lines.append(" TestJson.assertJsonEquals(example, result._json());") + lines.append(' assertEquals(example.path("results").size(), result.results().size());') + if _response_readable(om, example, status): + lines.append(" TestModels.readAll(result.results());") + elif r.kind == "json": + lines.append(" TestJson.assertJsonEquals(example, Json.toNode(result));") + if r.type is not None and r.type.kind == "class" and r.type.cls is not None and r.type.cls.kind == "status": + lines.append(f" assertEquals({status}, result.statusCode());") + if _response_readable(om, example, status): + lines.append(" TestModels.readAll(result);") + elif r.kind == "json_node": + lines.append(" TestJson.assertJsonEquals(example, result);") + + body_text = "\n".join(lines) + return f" @Test\n void {om.java_method}() {{\n{body_text}\n }}\n" + + +def _response_readable(om: OpModel, example: Any, status: str) -> bool: + r = om.response + if r.kind == "page": + assert r.type is not None + items = example.get("results") if isinstance(example, dict) else None + return isinstance(items, list) and all(readable(r.type, v, True, False) for v in items) + if r.type is None: + return True + if r.type.kind == "class" and r.type.cls is not None and r.type.cls.kind == "status": + return cls_readable(r.type.cls, example, int(status)) + return readable(r.type, example, True, False) + + +def emit_tests(model: Model) -> dict[str, str]: + files: dict[str, str] = {} + for resource, ops in model.resources.items(): + if not ops: + continue + ctx = Ctx(RESOURCES_PKG, None) + for imp in ( + "org.junit.jupiter.api.Test", + "me.didit.Didit", + "me.didit.testing.MockTransport", + "me.didit.testing.RecordedRequest", + "me.didit.testing.SpecExamples", + "me.didit.testing.TestJson", + "me.didit.testing.TestModels", + "me.didit.core.Json", + ): + ctx.use(imp) + tests = [emit_test(om, ctx) for om in ops] + cls_name = names.resource_class(resource) + "Test" + statics = ( + "import static org.junit.jupiter.api.Assertions.assertArrayEquals;\n" + "import static org.junit.jupiter.api.Assertions.assertEquals;\n\n" + ) + body = ( + f"/** One test per operation of {{@code {resource}}}, against a stubbed HTTP layer. */\n" + '@SuppressWarnings({"deprecation", "unused"})\n' + f"final class {cls_name} {{\n" + " private final MockTransport transport = new MockTransport();\n" + " private final Didit client = transport.client();\n\n" + "\n".join(tests) + "}\n" + ) + text = file_text(ctx, body) + text = text.replace(f"package {RESOURCES_PKG};\n\n", f"package {RESOURCES_PKG};\n\n{statics}", 1) + files[f"{cls_name}.java"] = text + _ = HEADER + return files diff --git a/codegen/generate.py b/codegen/generate.py new file mode 100644 index 0000000..5f48b49 --- /dev/null +++ b/codegen/generate.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""Generates the Java SDK's generated layer from openapi/ (DESIGN 3 and 5). + +Usage: + python3 codegen/generate.py # write the generated files + python3 codegen/generate.py --check # fail when the committed files differ + +It reads only openapi/ and writes: + src/main/java/me/didit/types/ one file per top-level type + src/main/java/me/didit/resources/ one file per resource, plus DiditResources + src/test/java/me/didit/resources/ one generated test class per resource +""" + +from __future__ import annotations + +import argparse +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) + +from didit_codegen import javagen, model, spec, testgen # noqa: E402 + +ROOT = Path(__file__).resolve().parent.parent +OUTPUTS = { + "src/main/java/me/didit/types": javagen.emit_types, + "src/main/java/me/didit/resources": javagen.emit_resources, + "src/test/java/me/didit/resources": testgen.emit_tests, +} + + +def render(root: Path) -> dict[Path, str]: + """Every generated file, by path relative to ``root``.""" + loaded = spec.load(root) + built = model.build(loaded) + files: dict[Path, str] = {} + for directory, emit in OUTPUTS.items(): + for name, text in emit(built).items(): + files[Path(directory) / name] = text + return files + + +def existing(root: Path) -> dict[Path, str]: + out: dict[Path, str] = {} + for directory in OUTPUTS: + base = root / directory + if not base.exists(): + continue + for path in sorted(base.rglob("*.java")): + out[path.relative_to(root)] = path.read_text(encoding="utf-8") + return out + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--check", action="store_true", help="fail when the generated files are stale") + parser.add_argument("--root", type=Path, default=ROOT, help="repository root") + args = parser.parse_args(argv) + root: Path = args.root.resolve() + try: + wanted = render(root) + except spec.SpecError as error: + print(f"codegen: error: {error}", file=sys.stderr) + return 2 + current = existing(root) + changed = sorted(p for p, text in wanted.items() if current.get(p) != text) + removed = sorted(p for p in current if p not in wanted) + if args.check: + if changed or removed: + print("codegen: the generated code is stale; run python3 codegen/generate.py", file=sys.stderr) + for path in changed[:50]: + print(f" changed: {path}", file=sys.stderr) + for path in removed[:50]: + print(f" removed: {path}", file=sys.stderr) + extra = len(changed) + len(removed) - 100 + if extra > 0: + print(f" ... and {extra} more", file=sys.stderr) + return 1 + print(f"codegen: {len(wanted)} generated files are up to date") + return 0 + for path in changed: + target = root / path + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(wanted[path], encoding="utf-8", newline="\n") + for path in removed: + (root / path).unlink() + print(f"codegen: wrote {len(changed)} files, removed {len(removed)}, {len(wanted)} generated files in total") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/codegen/spec_sync.py b/codegen/spec_sync.py new file mode 100644 index 0000000..0758d9b --- /dev/null +++ b/codegen/spec_sync.py @@ -0,0 +1,314 @@ +#!/usr/bin/env python3 +"""Syncs openapi/ with the published API documents (DESIGN 3.1). + +Usage: + python3 codegen/spec_sync.py [--from-dir DIR] [--summary FILE] [--today YYYY-MM-DD] + +It downloads https://docs.didit.me/openapi-25.json and openapi-auth.json (or reads them from +--from-dir), and when either changed it: + - copies them byte for byte into openapi/ and updates openapi/SOURCE.json; + - drops overlay.json entries that upstream now carries (identically or not: upstream wins); + - records server operations that disappeared, or whose SDK name changed, in + openapi/deprecated-operations.json so the SDK keeps them, deprecated, for one minor version; + - writes a Markdown summary of added, removed and changed operations and schemas. + +It prints changed=true|false and breaking=true|false, also to $GITHUB_OUTPUT when set. +The generator and the tests run afterwards in the workflow; this script never edits code. +""" + +from __future__ import annotations + +import argparse +import copy +import datetime as dt +import hashlib +import json +import os +import re +import sys +import urllib.request +from pathlib import Path +from typing import Any + +ROOT = Path(__file__).resolve().parent.parent +UPSTREAM = { + "verification.json": "https://docs.didit.me/openapi-25.json", + "account.json": "https://docs.didit.me/openapi-auth.json", +} +PREFIX = {"verification.json": "", "account.json": "account "} +HTTP_METHODS = ("get", "post", "put", "patch", "delete") + + +def fetch(url: str) -> bytes: + request = urllib.request.Request(url, headers={"User-Agent": "didit-sdk-java-spec-sync"}) + with urllib.request.urlopen(request, timeout=60) as response: # noqa: S310 (fixed https URLs) + return response.read() + + +def operations(doc: dict[str, Any], prefix: str) -> dict[str, dict[str, Any]]: + out = {} + for path, item in (doc.get("paths") or {}).items(): + for method in HTTP_METHODS: + if method in item: + out[f"{prefix}{method.upper()} {path}"] = item[method] + return out + + +def naming(key: str, op: dict[str, Any], overlay: dict[str, Any]) -> dict[str, Any] | None: + return op.get("x-didit-sdk") or overlay.get(key) + + +def refs(node: Any) -> set[str]: + found: set[str] = set() + if isinstance(node, dict): + ref = node.get("$ref") + if isinstance(ref, str) and ref.startswith("#/components/schemas/"): + found.add(ref.rsplit("/", 1)[1]) + for value in node.values(): + found |= refs(value) + elif isinstance(node, list): + for value in node: + found |= refs(value) + return found + + +def component_closure(doc: dict[str, Any], start: set[str]) -> dict[str, Any]: + schemas = (doc.get("components") or {}).get("schemas") or {} + out: dict[str, Any] = {} + todo = sorted(start) + while todo: + name = todo.pop() + if name in out or name not in schemas: + continue + out[name] = schemas[name] + todo.extend(sorted(refs(schemas[name]) - set(out))) + return out + + +def next_minor(version: str) -> str: + match = re.match(r"(\d+)\.(\d+)\.(\d+)", version) + if not match: + return "the next minor version" + major, minor = int(match.group(1)), int(match.group(2)) + return f"{major}.{minor + 1}.0" + + +def current_version(root: Path) -> str: + props = root / "gradle.properties" + if props.exists(): + for line in props.read_text(encoding="utf-8").splitlines(): + if line.startswith("version="): + return line.split("=", 1)[1].strip() + return "0.0.0" + + +def describe(key: str, op: dict[str, Any], overlay: dict[str, Any]) -> str: + sdk = naming(key, op, overlay) + name = f"`{sdk['resource']}.{sdk['method']}`" if sdk else "(no SDK name)" + return f"{name} `{key}`" + + +def sync( + root: Path, + new_files: dict[str, bytes], + today: str, + now: str, +) -> tuple[bool, bool, str]: + """Applies the new upstream files to ``root``. Returns (changed, breaking, summary).""" + openapi = root / "openapi" + old_files = {name: (openapi / name).read_bytes() for name in UPSTREAM} + changed_files = [name for name in UPSTREAM if new_files[name] != old_files[name]] + if not changed_files: + return False, False, "The upstream API documents are unchanged.\n" + + overlay_path = openapi / "overlay.json" + overlay_doc = json.loads(overlay_path.read_text(encoding="utf-8")) + overlay: dict[str, Any] = overlay_doc.get("operations", {}) + deprecated_path = openapi / "deprecated-operations.json" + deprecated_doc = ( + json.loads(deprecated_path.read_text(encoding="utf-8")) + if deprecated_path.exists() + else { + "description": "Server operations that left the API, kept deprecated for one minor version (DESIGN 3.1). Written by codegen/spec_sync.py.", + "version": 1, + "methods": {}, + } + ) + remove_in = next_minor(current_version(root)) + + added: list[str] = [] + removed: list[str] = [] + changed_ops: list[str] = [] + renamed: list[str] = [] + dropped_overlay: list[str] = [] + schema_added: list[str] = [] + schema_removed: list[str] = [] + schema_changed: list[str] = [] + needs_naming: list[str] = [] + breaking = False + + new_names: set[str] = set() + for name in UPSTREAM: + new_doc = json.loads(new_files[name]) + for key, op in operations(new_doc, PREFIX[name]).items(): + sdk = naming(key, op, overlay) + if sdk and sdk.get("server"): + new_names.add(f"{sdk['resource']}.{sdk['method']}") + + for name in UPSTREAM: + old_doc = json.loads(old_files[name]) + new_doc = json.loads(new_files[name]) + old_ops = operations(old_doc, PREFIX[name]) + new_ops = operations(new_doc, PREFIX[name]) + for key in sorted(set(new_ops) - set(old_ops)): + added.append(describe(key, new_ops[key], overlay)) + if not naming(key, new_ops[key], overlay): + needs_naming.append(key) + for key in sorted(set(old_ops) & set(new_ops)): + old_op, new_op = old_ops[key], new_ops[key] + upstream_sdk = new_op.get("x-didit-sdk") + if upstream_sdk is not None and key in overlay: + if overlay[key] != upstream_sdk: + renamed.append( + f"`{key}`: `{overlay[key]['resource']}.{overlay[key]['method']}` is now " + f"`{upstream_sdk['resource']}.{upstream_sdk['method']}`" + ) + if overlay[key].get("server") and ( + f"{overlay[key]['resource']}.{overlay[key]['method']}" not in new_names + ): + record_deprecation( + deprecated_doc, old_doc, name, key, old_op, overlay[key], "renamed", + f"{upstream_sdk['resource']}.{upstream_sdk['method']}", remove_in, + ) + breaking = True + del overlay[key] + dropped_overlay.append(key) + if json.dumps(old_op, sort_keys=True) != json.dumps(new_op, sort_keys=True): + changed_ops.append(describe(key, new_op, overlay)) + for key in sorted(set(old_ops) - set(new_ops)): + sdk = naming(key, old_ops[key], overlay) + removed.append(describe(key, old_ops[key], overlay)) + if sdk and sdk.get("server") and f"{sdk['resource']}.{sdk['method']}" not in new_names: + record_deprecation(deprecated_doc, old_doc, name, key, old_ops[key], sdk, "removed", None, remove_in) + breaking = True + overlay.pop(key, None) + + old_schemas = (old_doc.get("components") or {}).get("schemas") or {} + new_schemas = (new_doc.get("components") or {}).get("schemas") or {} + schema_added += [f"`{s}` ({name})" for s in sorted(set(new_schemas) - set(old_schemas))] + for s in sorted(set(old_schemas) - set(new_schemas)): + schema_removed.append(f"`{s}` ({name})") + breaking = True + for s in sorted(set(old_schemas) & set(new_schemas)): + if json.dumps(old_schemas[s], sort_keys=True) != json.dumps(new_schemas[s], sort_keys=True): + schema_changed.append(f"`{s}` ({name})") + old_props = set((old_schemas[s].get("properties") or {})) + new_props = set((new_schemas[s].get("properties") or {})) + if old_props - new_props: + breaking = True + + # Write the files. + for name in changed_files: + (openapi / name).write_bytes(new_files[name]) + source_path = openapi / "SOURCE.json" + source = json.loads(source_path.read_text(encoding="utf-8")) + for name in UPSTREAM: + entry = source.setdefault(name, {"url": UPSTREAM[name]}) + entry["sha256"] = hashlib.sha256(new_files[name]).hexdigest() + if name in changed_files: + entry["fetched_at"] = now + source_path.write_text(json.dumps(source, indent=1, ensure_ascii=False) + "\n", encoding="utf-8") + overlay_doc["operations"] = dict(sorted(overlay.items())) + overlay_path.write_text(json.dumps(overlay_doc, indent=1, ensure_ascii=False) + "\n", encoding="utf-8") + if deprecated_doc["methods"] or deprecated_path.exists(): + deprecated_doc["methods"] = dict(sorted(deprecated_doc["methods"].items())) + deprecated_path.write_text(json.dumps(deprecated_doc, indent=1, ensure_ascii=False) + "\n", encoding="utf-8") + + lines = [f"Automated sync of the API documents on {today}: {', '.join(changed_files)}.", ""] + + def section(title: str, items: list[str]) -> None: + if items: + lines.append(f"### {title} ({len(items)})") + lines.extend(f"- {item}" for item in items[:200]) + if len(items) > 200: + lines.append(f"- ... and {len(items) - 200} more") + lines.append("") + + if breaking: + lines += [ + "**Breaking:** operations or schemas were removed or renamed. Removed SDK methods stay, " + f"deprecated, until version {remove_in} (openapi/deprecated-operations.json).", + "", + ] + if needs_naming: + lines += [ + "**Action needed:** these new operations have no SDK name; add them to openapi/overlay.json " + "(or upstream) or the generator fails:", + "", + ] + lines += [f"- `{k}`" for k in needs_naming] + [""] + section("Added operations", added) + section("Removed operations", removed) + section("Renamed operations", renamed) + section("Changed operations", changed_ops) + section("Added schemas", schema_added) + section("Removed schemas", schema_removed) + section("Changed schemas", schema_changed) + section("Overlay entries dropped because upstream carries x-didit-sdk", [f"`{k}`" for k in dropped_overlay]) + return True, breaking, "\n".join(lines).rstrip() + "\n" + + +def record_deprecation( + doc: dict[str, Any], + old_doc: dict[str, Any], + file_name: str, + key: str, + op: dict[str, Any], + sdk: dict[str, Any], + reason: str, + replacement: str | None, + remove_in: str, +) -> None: + method, path = key.split(" ", 1) if not key.startswith("account ") else key[len("account ") :].split(" ", 1) + path_item = (old_doc.get("paths") or {}).get(path, {}) + entry = { + "reason": reason, + "replacement": replacement, + "remove_in": remove_in, + "spec": "verification" if file_name == "verification.json" else "account", + "http_method": method, + "path": path, + "x-didit-sdk": copy.deepcopy(sdk), + "operation": copy.deepcopy(op), + "path_parameters": copy.deepcopy(path_item.get("parameters", [])), + "components": component_closure(old_doc, refs(op) | refs(path_item.get("parameters", []))), + } + doc.setdefault("methods", {})[f"{sdk['resource']}.{sdk['method']}"] = entry + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--from-dir", type=Path, help="read the upstream files from this directory") + parser.add_argument("--summary", type=Path, help="write the Markdown summary here") + parser.add_argument("--today", default=dt.date.today().isoformat()) + parser.add_argument("--root", type=Path, default=ROOT) + args = parser.parse_args(argv) + new_files: dict[str, bytes] = {} + for name, url in UPSTREAM.items(): + new_files[name] = (args.from_dir / name).read_bytes() if args.from_dir else fetch(url) + json.loads(new_files[name]) # refuse anything that is not JSON + now = dt.datetime.now(dt.timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z") + changed, breaking, summary = sync(args.root.resolve(), new_files, args.today, now) + if args.summary: + args.summary.write_text(summary, encoding="utf-8") + outputs = f"changed={'true' if changed else 'false'}\nbreaking={'true' if breaking else 'false'}\n" + sys.stdout.write(outputs) + github_output = os.environ.get("GITHUB_OUTPUT") + if github_output: + with open(github_output, "a", encoding="utf-8") as handle: + handle.write(outputs) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/codegen/tests/__init__.py b/codegen/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/codegen/tests/fixtures.py b/codegen/tests/fixtures.py new file mode 100644 index 0000000..d18c6f4 --- /dev/null +++ b/codegen/tests/fixtures.py @@ -0,0 +1,172 @@ +"""Small synthetic OpenAPI documents for the generator tests (independent of openapi/).""" + +from __future__ import annotations + +import copy +import json +from pathlib import Path +from typing import Any + +VERIFICATION: dict[str, Any] = { + "openapi": "3.0.0", + "info": {"title": "Test", "version": "1"}, + "paths": { + "/v3/pets/": { + "get": { + "summary": "List pets", + "parameters": [ + {"name": "limit", "in": "query", "schema": {"type": "integer"}}, + {"name": "offset", "in": "query", "schema": {"type": "integer"}}, + {"name": "kind", "in": "query", "schema": {"type": "string", "enum": ["cat", "dog"]}}, + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "count": {"type": "integer"}, + "next": {"type": "string", "nullable": True}, + "previous": {"type": "string", "nullable": True}, + "results": {"type": "array", "items": {"$ref": "#/components/schemas/Pet"}}, + }, + } + } + }, + } + }, + }, + "post": { + "summary": "Create a pet", + "parameters": [ + {"name": "Idempotency-Key", "in": "header", "schema": {"type": "string"}}, + {"name": "node_id", "in": "query", "schema": {"type": "string"}}, + ], + "requestBody": { + "required": True, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "required": ["name"], + "properties": { + "name": {"type": "string"}, + "node_id": {"type": "string"}, + "photo": {"type": "string", "format": "binary"}, + "tags": {"type": "array", "items": {"type": "string"}}, + }, + } + }, + "application/json": { + "schema": { + "type": "object", + "required": ["name"], + "properties": {"name": {"type": "string"}, "node_id": {"type": "string"}}, + } + }, + }, + }, + "responses": { + "200": {"description": "", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Pet"}}}}, + "202": { + "description": "", + "content": {"application/json": {"schema": {"type": "object", "properties": {"job_id": {"type": "string"}}}}}, + }, + }, + }, + }, + "/v3/pets/{pet_id}/": { + "parameters": [{"name": "pet_id", "in": "path", "required": True, "schema": {"type": "string"}}], + "get": { + "responses": { + "200": { + "description": "", + "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PetOrRow"}}}, + } + } + }, + "delete": {"responses": {"204": {"description": ""}}}, + }, + "/v3/pets/{pet_id}/report/": { + "get": { + "parameters": [{"name": "pet_id", "in": "path", "required": True, "schema": {"type": "string"}}], + "responses": {"200": {"description": "", "content": {"application/pdf": {"schema": {"type": "string", "format": "binary"}}}}}, + } + }, + "/v3/device/": {"post": {"responses": {"200": {"description": ""}}}}, + }, + "components": { + "schemas": { + "Pet": { + "type": "object", + "required": ["name", "builder"], + "properties": { + "name": {"type": "string"}, + "class": {"type": "string"}, + "builder": {"type": "string"}, + "status": {"type": "string", "enum": ["Not Started", "Approved", "approved"], "nullable": True}, + "born_at": {"type": "string", "format": "date-time"}, + "owner": {"type": "object", "properties": {"name": {"type": "string"}, "pet": {"type": "string"}}}, + "extra": {"type": "object", "additionalProperties": True}, + "scores": {"type": "object", "additionalProperties": {"type": "number"}}, + }, + }, + "PetOrRow": { + "oneOf": [ + {"type": "object", "properties": {"kind": {"type": "string", "enum": ["pet"]}, "name": {"type": "string"}}, "required": ["name"]}, + {"type": "object", "properties": {"kind": {"type": "string", "enum": ["row"]}, "name": {"type": "string"}, "row": {"type": "integer"}}}, + ] + }, + "Base": {"type": "object", "properties": {"id": {"type": "string"}}}, + "Child": {"allOf": [{"$ref": "#/components/schemas/Base"}, {"type": "object", "properties": {"age": {"type": "integer"}}}]}, + } + }, +} + +ACCOUNT: dict[str, Any] = { + "openapi": "3.0.0", + "info": {"title": "Account", "version": "1"}, + "paths": { + "/programmatic/login/": { + "post": { + "requestBody": { + "content": {"application/json": {"schema": {"type": "object", "properties": {"email": {"type": "string"}}}}} + }, + "responses": {"200": {"description": "", "content": {"application/json": {"schema": {"type": "object", "properties": {"access_token": {"type": "string"}}}}}}}, + } + } + }, + "components": {"schemas": {}}, +} + +OVERLAY: dict[str, Any] = { + "description": "test", + "version": 1, + "operations": { + "GET /v3/pets/": {"resource": "pets", "method": "list", "auth": "api_key", "server": True}, + "POST /v3/pets/": {"resource": "pets", "method": "create", "auth": "api_key", "server": True}, + "GET /v3/pets/{pet_id}/": {"resource": "pets", "method": "retrieve", "auth": "api_key", "server": True}, + "DELETE /v3/pets/{pet_id}/": {"resource": "pets", "method": "delete", "auth": "api_key", "server": True}, + "GET /v3/pets/{pet_id}/report/": {"resource": "pets.reports", "method": "download", "auth": "api_key", "server": True}, + "POST /v3/device/": {"resource": "device", "method": "send", "auth": "device_token", "server": False}, + "account POST /programmatic/login/": {"resource": "account", "method": "login", "auth": "none", "server": True}, + }, +} + + +def write(root: Path, verification: dict[str, Any] | None = None, account: dict[str, Any] | None = None, + overlay: dict[str, Any] | None = None) -> Path: + openapi = root / "openapi" + openapi.mkdir(parents=True, exist_ok=True) + (openapi / "verification.json").write_text(json.dumps(verification or VERIFICATION), encoding="utf-8") + (openapi / "account.json").write_text(json.dumps(account or ACCOUNT), encoding="utf-8") + (openapi / "overlay.json").write_text(json.dumps(overlay or OVERLAY, indent=1), encoding="utf-8") + (openapi / "SOURCE.json").write_text(json.dumps({"verification.json": {}, "account.json": {}}), encoding="utf-8") + (root / "gradle.properties").write_text("version=0.3.0\n", encoding="utf-8") + return root + + +def clone(value: dict[str, Any]) -> dict[str, Any]: + return copy.deepcopy(value) diff --git a/codegen/tests/test_codegen.py b/codegen/tests/test_codegen.py new file mode 100644 index 0000000..da7dfcd --- /dev/null +++ b/codegen/tests/test_codegen.py @@ -0,0 +1,199 @@ +"""Unit tests of the generator, on synthetic specs (python3 -m unittest discover codegen/tests).""" + +from __future__ import annotations + +import json +import sys +import tempfile +import unittest +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) + +from didit_codegen import javagen, model, names, spec, testgen # noqa: E402 + +from tests import fixtures # noqa: E402 + +import generate # noqa: E402 + + +class NamesTest(unittest.TestCase): + def test_conversions(self) -> None: + self.assertEqual("ContactDetails", names.pascal("contact_details")) + self.assertEqual("SessionDecision", names.pascal("SessionDecision")) + self.assertEqual("V3DsCheck", names.pascal("3ds_check")) + self.assertEqual("sessionId", names.camel("session_id")) + self.assertEqual("lastName", names.camel("lastName")) + self.assertEqual("statusIn", names.camel("status__in")) + self.assertEqual("xRequestId", names.camel("X-Request-Id")) + self.assertEqual("_3Ds", names.camel("3ds")) + self.assertEqual("NOT_STARTED", names.constant("Not Started")) + self.assertEqual("DRIVER_S_LICENSE", names.constant("Driver's License")) + self.assertEqual("EMPTY", names.constant("")) + self.assertEqual("_1_DAY", names.constant("1-day")) + self.assertEqual("class_", names.safe_member("class")) + self.assertEqual("builder_", names.safe_member("builder")) + self.assertEqual("params_", names.safe_param("params")) + self.assertEqual("validate", names.safe_method("validate")) + self.assertEqual("finalize_", names.safe_method("finalize")) + self.assertEqual("CasesNotesResource", names.resource_class("cases.notes")) + self.assertEqual("SessionsImportsCreate", names.type_prefix("sessions.imports", "create")) + + def test_java_strings_and_nullable_types(self) -> None: + self.assertEqual('"a\\"b\\\\c\\n\\u00e9\\ud83d\\ude00"', javagen.java_string('a"b\\c\nรฉ\U0001F600')) + self.assertEqual("Outer.@Nullable Inner", javagen.nullable_type("Outer.Inner")) + self.assertEqual("@Nullable List", javagen.nullable_type("List")) + self.assertEqual("@Nullable String", javagen.nullable_type("String")) + + +class ModelTest(unittest.TestCase): + def build(self, **kwargs) -> model.Model: + tmp = Path(tempfile.mkdtemp()) + fixtures.write(tmp, **kwargs) + return model.build(spec.load(tmp)) + + def test_operations_and_resources(self) -> None: + m = self.build() + self.assertEqual( + ["account.login", "pets.create", "pets.delete", "pets.list", "pets.reports.download", "pets.retrieve"], + sorted(om.op.full_name for om in m.operations), + ) + self.assertIn("pets.reports", m.resources) + by_name = {om.op.full_name: om for om in m.operations} + self.assertEqual("page", by_name["pets.list"].response.kind) + self.assertEqual("binary", by_name["pets.reports.download"].response.kind) + self.assertEqual("none", by_name["pets.delete"].response.kind) + self.assertEqual(["pet_id"], [p.json_name for p in by_name["pets.retrieve"].path_params]) + + def test_body_encoding_query_collisions_and_idempotency(self) -> None: + create = next(om for om in self.build().operations if om.op.full_name == "pets.create") + self.assertEqual("json_or_multipart", create.body_encoding) + self.assertTrue(create.idempotency) + assert create.params_class is not None + props = {p.json_name: p for p in create.params_class.props} + self.assertEqual("file", props["photo"].type.kind) + self.assertEqual("nodeIdQuery", props["node_id_query"].java_name) + self.assertEqual([("node_id", "node_id_query")], create.query_fields) + self.assertEqual("status", create.response.type.cls.kind) + + def test_types(self) -> None: + m = self.build() + classes = {c.name: c for c in m.classes} + pet = classes["Pet"] + props = {p.json_name: p for p in pet.props} + self.assertEqual("class_", props["class"].java_name) + self.assertEqual("builder_", props["builder"].java_name) + self.assertTrue(props["status"].nullable) + self.assertEqual(["Not Started", "Approved", "approved"], props["status"].type.cls.values) + self.assertEqual("datetime", props["born_at"].type.kind) + self.assertEqual("object", props["extra"].type.kind) + self.assertEqual("map", props["scores"].type.kind) + self.assertEqual("Pet.Owner", props["owner"].type.cls.qualified) + union = classes["PetOrRow"] + self.assertEqual("union", union.kind) + self.assertEqual(["Pet", "Row"], [v.name for v in union.variants]) + self.assertEqual(("discriminator", "kind", "pet"), union.variants[0].detect) + self.assertEqual(["kind", "name"], [p.json_name for p in union.props]) + child = classes["Child"] + self.assertEqual(["id", "age"], [p.json_name for p in child.props]) + + def test_missing_naming_fails_with_the_operation(self) -> None: + overlay = fixtures.clone(fixtures.OVERLAY) + del overlay["operations"]["GET /v3/pets/"] + with self.assertRaises(spec.SpecError) as ctx: + self.build(overlay=overlay) + self.assertIn("GET /v3/pets/", str(ctx.exception)) + self.assertIn("overlay.json", str(ctx.exception)) + + def test_stale_overlay_entry_fails(self) -> None: + overlay = fixtures.clone(fixtures.OVERLAY) + overlay["operations"]["GET /v3/gone/"] = {"resource": "gone", "method": "list", "auth": "api_key", "server": True} + with self.assertRaises(spec.SpecError) as ctx: + self.build(overlay=overlay) + self.assertIn("GET /v3/gone/", str(ctx.exception)) + + def test_upstream_naming_wins(self) -> None: + verification = fixtures.clone(fixtures.VERIFICATION) + verification["paths"]["/v3/pets/"]["get"]["x-didit-sdk"] = { + "resource": "animals", "method": "list", "auth": "api_key", "server": True + } + overlay = fixtures.clone(fixtures.OVERLAY) + del overlay["operations"]["GET /v3/pets/"] + names_ = sorted(om.op.full_name for om in self.build(verification=verification, overlay=overlay).operations) + self.assertIn("animals.list", names_) + + def test_duplicate_method_names_fail(self) -> None: + overlay = fixtures.clone(fixtures.OVERLAY) + overlay["operations"]["DELETE /v3/pets/{pet_id}/"]["method"] = "retrieve" + with self.assertRaises(spec.SpecError): + self.build(overlay=overlay) + + def test_deprecated_operations_are_generated(self) -> None: + tmp = Path(tempfile.mkdtemp()) + fixtures.write(tmp) + (tmp / "openapi" / "deprecated-operations.json").write_text(json.dumps({ + "version": 1, + "methods": { + "pets.archive": { + "reason": "removed", "replacement": None, "remove_in": "0.4.0", "spec": "verification", + "http_method": "POST", "path": "/v3/pets/{pet_id}/archive/", + "x-didit-sdk": {"resource": "pets", "method": "archive", "auth": "api_key", "server": True}, + "operation": {"responses": {"200": {"description": "", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Archived"}}}}}}, + "path_parameters": [{"name": "pet_id", "in": "path", "required": True, "schema": {"type": "string"}}], + "components": {"Archived": {"type": "object", "properties": {"at": {"type": "string"}}}}, + } + }, + }), encoding="utf-8") + m = model.build(spec.load(tmp)) + archive = next(om for om in m.operations if om.op.full_name == "pets.archive") + self.assertIsNotNone(archive.op.deprecated) + resources = javagen.emit_resources(m) + self.assertIn("@Deprecated", resources["PetsResource.java"]) + self.assertIn("goes away in version 0.4.0", resources["PetsResource.java"]) + self.assertIn("Archived.java", javagen.emit_types(m)) + + +class EmitTest(unittest.TestCase): + def test_emits_compilable_shapes(self) -> None: + tmp = Path(tempfile.mkdtemp()) + fixtures.write(tmp) + m = model.build(spec.load(tmp)) + types = javagen.emit_types(m) + pet = types["Pet.java"] + self.assertTrue(pet.startswith(javagen.HEADER)) + self.assertIn("public final class Pet extends JsonModel", pet) + self.assertIn("public String builder_()", pet) + self.assertIn("public Optional status()", pet) + self.assertIn("public Builder status(Pet.@Nullable Status status)", pet) + self.assertIn("public static final Status APPROVED_2 = new Status(\"approved\");", pet) + resources = javagen.emit_resources(m) + pets = resources["PetsResource.java"] + self.assertIn("public Page list()", pets) + self.assertIn(".queryField(\"node_id\", \"node_id_query\")", pets) + self.assertIn(".body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART)", pets) + self.assertIn("public CompletableFuture deleteAsync(String petId)", pets) + self.assertIn(".accept(\"application/pdf\")", resources["PetsReportsResource.java"]) + self.assertIn("public final PetsResource pets()", resources["DiditResources.java"]) + self.assertIn(".account()", resources["AccountResource.java"]) + tests = testgen.emit_tests(m) + self.assertIn("void create()", tests["PetsResourceTest.java"]) + self.assertIn("request.multipartFiles()", tests["PetsResourceTest.java"]) + + def test_check_mode(self) -> None: + tmp = Path(tempfile.mkdtemp()) + fixtures.write(tmp) + self.assertEqual(0, generate.main(["--root", str(tmp)])) + self.assertEqual(0, generate.main(["--root", str(tmp), "--check"])) + stale = tmp / "src/main/java/me/didit/types/Stale.java" + stale.write_text("// old\n", encoding="utf-8") + self.assertEqual(1, generate.main(["--root", str(tmp), "--check"])) + self.assertEqual(0, generate.main(["--root", str(tmp)])) + self.assertFalse(stale.exists()) + overlay = fixtures.clone(fixtures.OVERLAY) + del overlay["operations"]["GET /v3/pets/"] + fixtures.write(tmp, overlay=overlay) + self.assertEqual(2, generate.main(["--root", str(tmp), "--check"])) + + +if __name__ == "__main__": + unittest.main() diff --git a/codegen/tests/test_spec_sync.py b/codegen/tests/test_spec_sync.py new file mode 100644 index 0000000..a7c8712 --- /dev/null +++ b/codegen/tests/test_spec_sync.py @@ -0,0 +1,108 @@ +"""Unit tests of codegen/spec_sync.py, on synthetic specs.""" + +from __future__ import annotations + +import json +import sys +import tempfile +import unittest +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) + +import spec_sync # noqa: E402 + +from tests import fixtures # noqa: E402 + + +def as_bytes(doc: dict) -> bytes: + return json.dumps(doc).encode("utf-8") + + +class SpecSyncTest(unittest.TestCase): + def setUp(self) -> None: + self.root = fixtures.write(Path(tempfile.mkdtemp())) + + def run_sync(self, verification: dict, account: dict | None = None) -> tuple[bool, bool, str]: + files = { + "verification.json": as_bytes(verification), + "account.json": as_bytes(account or fixtures.ACCOUNT), + } + return spec_sync.sync(self.root, files, "2026-11-01", "2026-11-01T06:23:00Z") + + def test_nothing_changed(self) -> None: + changed, breaking, summary = self.run_sync(fixtures.VERIFICATION) + self.assertFalse(changed) + self.assertFalse(breaking) + self.assertIn("unchanged", summary) + + def test_added_operation_without_name_is_called_out(self) -> None: + new = fixtures.clone(fixtures.VERIFICATION) + new["paths"]["/v3/toys/"] = {"get": {"responses": {"200": {"description": ""}}}} + changed, breaking, summary = self.run_sync(new) + self.assertTrue(changed) + self.assertFalse(breaking) + self.assertIn("### Added operations (1)", summary) + self.assertIn("**Action needed:**", summary) + self.assertIn("`GET /v3/toys/`", summary) + source = json.loads((self.root / "openapi/SOURCE.json").read_text()) + self.assertEqual("2026-11-01T06:23:00Z", source["verification.json"]["fetched_at"]) + self.assertEqual(64, len(source["verification.json"]["sha256"])) + self.assertEqual(as_bytes(new), (self.root / "openapi/verification.json").read_bytes()) + + def test_removed_operation_is_deprecated_with_its_components(self) -> None: + new = fixtures.clone(fixtures.VERIFICATION) + del new["paths"]["/v3/pets/{pet_id}/"]["get"] + changed, breaking, summary = self.run_sync(new) + self.assertTrue(changed and breaking) + self.assertIn("**Breaking:**", summary) + self.assertIn("until version 0.4.0", summary) + deprecated = json.loads((self.root / "openapi/deprecated-operations.json").read_text()) + entry = deprecated["methods"]["pets.retrieve"] + self.assertEqual("removed", entry["reason"]) + self.assertEqual("0.4.0", entry["remove_in"]) + self.assertEqual("GET", entry["http_method"]) + self.assertEqual(["PetOrRow"], sorted(entry["components"])) + self.assertEqual("pet_id", entry["path_parameters"][0]["name"]) + overlay = json.loads((self.root / "openapi/overlay.json").read_text()) + self.assertNotIn("GET /v3/pets/{pet_id}/", overlay["operations"]) + + def test_upstream_naming_drops_the_overlay_entry(self) -> None: + new = fixtures.clone(fixtures.VERIFICATION) + new["paths"]["/v3/pets/"]["get"]["x-didit-sdk"] = fixtures.OVERLAY["operations"]["GET /v3/pets/"] + changed, breaking, summary = self.run_sync(new) + self.assertTrue(changed) + self.assertFalse(breaking) + self.assertIn("Overlay entries dropped", summary) + overlay = json.loads((self.root / "openapi/overlay.json").read_text()) + self.assertNotIn("GET /v3/pets/", overlay["operations"]) + + def test_upstream_rename_deprecates_the_old_method(self) -> None: + new = fixtures.clone(fixtures.VERIFICATION) + new["paths"]["/v3/pets/"]["get"]["x-didit-sdk"] = { + "resource": "pets", "method": "search", "auth": "api_key", "server": True + } + changed, breaking, summary = self.run_sync(new) + self.assertTrue(changed and breaking) + self.assertIn("is now `pets.search`", summary) + deprecated = json.loads((self.root / "openapi/deprecated-operations.json").read_text()) + self.assertEqual("renamed", deprecated["methods"]["pets.list"]["reason"]) + self.assertEqual("pets.search", deprecated["methods"]["pets.list"]["replacement"]) + + def test_schema_changes(self) -> None: + new = fixtures.clone(fixtures.VERIFICATION) + del new["components"]["schemas"]["Pet"]["properties"]["class"] + new["components"]["schemas"]["Toy"] = {"type": "object"} + changed, breaking, summary = self.run_sync(new) + self.assertTrue(changed and breaking) + self.assertIn("### Added schemas (1)", summary) + self.assertIn("### Changed schemas (1)", summary) + + def test_helpers(self) -> None: + self.assertEqual("1.3.0", spec_sync.next_minor("1.2.9")) + self.assertEqual("the next minor version", spec_sync.next_minor("dev")) + self.assertEqual({"A", "B"}, spec_sync.refs({"x": [{"$ref": "#/components/schemas/A"}, {"$ref": "#/components/schemas/B"}]})) + + +if __name__ == "__main__": + unittest.main() diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..5aaa380 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,25 @@ +# Examples + +Runnable examples of the Didit Java SDK. Set `DIDIT_API_KEY` (and `DIDIT_BASE_URL` to point at a mock). + +| Example | What it shows | +|---|---| +| `Quickstart` | Create a session, read the decision, verify a webhook | +| `QuickstartDemo` | The quickstart against a local mock of the API: `./gradlew :examples:quickstartDemo` | +| `IdVerificationExample` | Standalone ID verification with file uploads | +| `AmlScreeningExample` | AML screening with an idempotency key | +| `TransactionScreeningExample` | Transaction monitoring | +| `TravelRuleExample` | Wallet screening and the VASP directory with automatic pagination | +| `AuthenticationExample` | Verifying access tokens and asking for a step-up | +| `KotlinQuickstart.kt` | The quickstart in Kotlin, with `when` over webhook events | + +Webhook receivers: + +| Framework | File | +|---|---| +| Spring Boot | `webhooks/SpringBootReceiver.java` | +| Javalin | `webhooks/JavalinReceiver.java` | +| Ktor | `KtorReceiver.kt` | +| JDK `HttpServer` | `webhooks/JdkHttpServerReceiver.java` | + +Each one verifies the raw request body with `Webhooks.verify(...)` and answers 401 when verification fails. diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts new file mode 100644 index 0000000..2e52af5 --- /dev/null +++ b/examples/build.gradle.kts @@ -0,0 +1,57 @@ +// Runnable examples and webhook receivers for popular frameworks. They are not part of the +// published library; CI compiles them and runs the Kotlin API tests. +plugins { + java + alias(libs.plugins.kotlin.jvm) +} + +java { toolchain { languageVersion = JavaLanguageVersion.of(17) } } + +kotlin { + jvmToolchain(17) + compilerOptions { + allWarningsAsErrors = true + // Kotlin reads the library's JSpecify annotations: nullable types where the API allows null. + freeCompilerArgs.add("-Xjspecify-annotations=strict") + } +} + +dependencies { + implementation(project(":")) + implementation(libs.spring.boot.starter.web) + implementation(libs.javalin) + implementation(libs.ktor.server.core) + implementation(libs.ktor.server.netty) + runtimeOnly(libs.slf4j.simple) + + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) + testImplementation(kotlin("test-junit5")) + testRuntimeOnly(libs.junit.launcher) +} + +tasks.withType().configureEach { + options.encoding = "UTF-8" + options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-processing", "-Werror")) +} + +tasks.test { + useJUnitPlatform() + systemProperty("didit.repoRoot", rootDir.absolutePath) +} + +fun example(name: String, mainClass: String, text: String) = + tasks.register(name) { + description = text + group = "examples" + classpath = sourceSets.main.get().runtimeClasspath + this.mainClass = mainClass + } + +example( + "quickstartDemo", + "me.didit.examples.QuickstartDemo", + "Runs the quickstart against a local mock of the Didit API.", +) + +example("quickstart", "me.didit.examples.Quickstart", "Runs the quickstart against DIDIT_BASE_URL.") diff --git a/examples/src/main/java/me/didit/examples/AmlScreeningExample.java b/examples/src/main/java/me/didit/examples/AmlScreeningExample.java new file mode 100644 index 0000000..6f522bc --- /dev/null +++ b/examples/src/main/java/me/didit/examples/AmlScreeningExample.java @@ -0,0 +1,36 @@ +package me.didit.examples; + +import java.time.LocalDate; +import me.didit.Didit; +import me.didit.core.RequestOptions; +import me.didit.types.AmlScreenParams; +import me.didit.types.AmlScreenResponse; + +/** Standalone AML screening of a person, with an idempotency key. */ +public final class AmlScreeningExample { + private AmlScreeningExample() {} + + public static void main(String[] args) { + Didit client = Env.client(); + AmlScreenResponse result = + client + .aml() + .screen( + AmlScreenParams.builder() + .fullName("Ana Ruiz") + .dateOfBirth(LocalDate.of(1990, 1, 31)) + .nationality("ES") + .entityType(AmlScreenParams.EntityType.PERSON) + .build(), + RequestOptions.builder().idempotencyKey("screen-user-42-2026-11-01").build()); + result + .aml() + .ifPresent( + aml -> + System.out.println( + "AML " + + aml.status().map(Object::toString).orElse("?") + + ", hits " + + aml.totalHits().orElse(0L))); + } +} diff --git a/examples/src/main/java/me/didit/examples/AuthenticationExample.java b/examples/src/main/java/me/didit/examples/AuthenticationExample.java new file mode 100644 index 0000000..9ae8e90 --- /dev/null +++ b/examples/src/main/java/me/didit/examples/AuthenticationExample.java @@ -0,0 +1,56 @@ +package me.didit.examples; + +import me.didit.authentication.AccessTokenClaims; +import me.didit.authentication.Authentication; +import me.didit.authentication.StepUp; +import me.didit.authentication.StepUpParams; +import me.didit.errors.TokenVerificationException; + +/** + * Didit Authentication on your backend: verify the access token of a request, then ask for a + * step-up before a payout. + */ +public final class AuthenticationExample { + private AuthenticationExample() {} + + // One instance per issuer: it caches discovery and the signing keys. + private static final Authentication AUTH = + Authentication.builder() + .publishableKey(Env.require("DIDIT_PUBLISHABLE_KEY")) + .clientId(Env.require("DIDIT_APPLICATION_ID")) + .build(); + + /** Returns the user id of a request's {@code Authorization: Bearer} token, or null. */ + static String authenticate(String authorizationHeader) { + if (authorizationHeader == null || !authorizationHeader.startsWith("Bearer ")) { + return null; + } + try { + AccessTokenClaims claims = AUTH.verifyAccessToken(authorizationHeader.substring(7)); + return claims.subject(); + } catch (TokenVerificationException e) { + System.out.println("Rejected token: " + e.reason().code()); + return null; + } + } + + public static void main(String[] args) { + String accessToken = args[0]; + System.out.println("User: " + authenticate("Bearer " + accessToken)); + StepUp stepUp = + AUTH.createStepUp( + accessToken, + StepUpParams.builder("payout") + .amount("250.00") + .currency("EUR") + .returnTo("https://app.example.com/payouts") + .build()); + if (!stepUp.required()) { + System.out.println("No step-up needed"); + } else { + System.out.println("Send the user to " + stepUp.verificationUrl().orElse("?")); + // When the user returns, act only on an approved step-up: + // AUTH.retrieveStepUp(accessToken, stepUp.id().orElseThrow()).isApproved() + } + } +} diff --git a/examples/src/main/java/me/didit/examples/Env.java b/examples/src/main/java/me/didit/examples/Env.java new file mode 100644 index 0000000..477463b --- /dev/null +++ b/examples/src/main/java/me/didit/examples/Env.java @@ -0,0 +1,26 @@ +package me.didit.examples; + +import me.didit.Didit; + +/** Reads the example configuration from the environment. */ +final class Env { + private Env() {} + + /** A client from DIDIT_API_KEY, pointed at DIDIT_BASE_URL when set (for a local mock). */ + static Didit client() { + Didit.Builder builder = Didit.builder(); + String baseUrl = System.getenv("DIDIT_BASE_URL"); + if (baseUrl != null && !baseUrl.isEmpty()) { + builder.baseUrl(baseUrl); + } + return builder.build(); + } + + static String require(String name) { + String value = System.getenv(name); + if (value == null || value.isEmpty()) { + throw new IllegalStateException("Set " + name); + } + return value; + } +} diff --git a/examples/src/main/java/me/didit/examples/IdVerificationExample.java b/examples/src/main/java/me/didit/examples/IdVerificationExample.java new file mode 100644 index 0000000..6ea46a8 --- /dev/null +++ b/examples/src/main/java/me/didit/examples/IdVerificationExample.java @@ -0,0 +1,33 @@ +package me.didit.examples; + +import java.nio.file.Path; +import me.didit.Didit; +import me.didit.types.IdVerificationVerifyParams; +import me.didit.types.IdVerificationVerifyResponse; + +/** Standalone ID verification: upload the front and back of a document (multipart). */ +public final class IdVerificationExample { + private IdVerificationExample() {} + + public static void main(String[] args) { + Didit client = Env.client(); + IdVerificationVerifyResponse result = + client + .idVerification() + .verify( + IdVerificationVerifyParams.builder() + .frontImage(Path.of(args[0])) + .backImage(Path.of(args[1])) + .vendorData("user-42") + .build()); + result + .idVerification() + .ifPresent( + id -> + System.out.println( + "Status " + + id.status().map(Object::toString).orElse("?") + + ", document " + + id.documentType().orElse("?"))); + } +} diff --git a/examples/src/main/java/me/didit/examples/MockDiditServer.java b/examples/src/main/java/me/didit/examples/MockDiditServer.java new file mode 100644 index 0000000..d9f4b6d --- /dev/null +++ b/examples/src/main/java/me/didit/examples/MockDiditServer.java @@ -0,0 +1,77 @@ +package me.didit.examples; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpServer; +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * A tiny local stand-in for the Didit API with canned, synthetic responses. It is only for the + * runnable demo and tests; it checks that the SDK sends an API key. + */ +public final class MockDiditServer implements AutoCloseable { + private final HttpServer server; + private final List log = Collections.synchronizedList(new ArrayList<>()); + + public MockDiditServer() throws IOException { + server = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); + server.createContext( + "/v3/session/", + exchange -> { + String path = exchange.getRequestURI().getPath(); + if (exchange.getRequestHeaders().getFirst("x-api-key") == null) { + send(exchange, 401, "{\"detail\":\"Missing API key\"}"); + } else if (exchange.getRequestMethod().equals("POST") && path.equals("/v3/session/")) { + send( + exchange, + 201, + "{\"session_id\":\"11111111-2222-4333-8444-555555555555\",\"session_number\":1," + + "\"session_token\":\"demo\"," + + "\"url\":\"https://verify.didit.me/session/synthetic\"," + + "\"vendor_data\":\"user-42\",\"metadata\":null,\"status\":\"Not Started\"," + + "\"callback\":\"https://example.com/verification/done\"," + + "\"workflow_id\":\"aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee\",\"workflow_version\":3}"); + } else if (path.endsWith("/decision/")) { + send( + exchange, + 200, + "{\"session_id\":\"11111111-2222-4333-8444-555555555555\",\"status\":\"Approved\"," + + "\"workflow_id\":\"aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee\",\"vendor_data\":\"user-42\"}"); + } else { + send(exchange, 404, "{\"detail\":\"Not found\"}"); + } + }); + server.start(); + } + + private void send(HttpExchange exchange, int status, String body) throws IOException { + log.add( + exchange.getRequestMethod() + " " + exchange.getRequestURI().getPath() + " -> " + status); + byte[] bytes = body.getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().add("Content-Type", "application/json"); + exchange.getResponseHeaders().add("X-Request-Id", "req-mock-" + log.size()); + exchange.sendResponseHeaders(status, bytes.length); + try (OutputStream out = exchange.getResponseBody()) { + out.write(bytes); + } + } + + public String baseUrl() { + return "http://127.0.0.1:" + server.getAddress().getPort(); + } + + public List log() { + return List.copyOf(log); + } + + @Override + public void close() { + server.stop(0); + } +} diff --git a/examples/src/main/java/me/didit/examples/Quickstart.java b/examples/src/main/java/me/didit/examples/Quickstart.java new file mode 100644 index 0000000..43fa26c --- /dev/null +++ b/examples/src/main/java/me/didit/examples/Quickstart.java @@ -0,0 +1,73 @@ +package me.didit.examples; + +import java.nio.charset.StandardCharsets; +import java.util.Map; +import me.didit.Didit; +import me.didit.types.SessionsCreateParams; +import me.didit.types.SessionsCreateResponse; +import me.didit.types.SessionsRetrieveDecisionResponse; +import me.didit.webhooks.SessionStatusUpdatedEvent; +import me.didit.webhooks.WebhookEvent; +import me.didit.webhooks.Webhooks; + +/** + * The README quickstart: create a verification session, read its decision and verify a webhook. + * + *

+ * DIDIT_API_KEY=... DIDIT_WORKFLOW_ID=... DIDIT_WEBHOOK_SECRET=... ./gradlew :examples:quickstart
+ * 
+ */ +public final class Quickstart { + private Quickstart() {} + + public static void main(String[] args) { + Didit client = Env.client(); + String workflowId = Env.require("DIDIT_WORKFLOW_ID"); + run(client, workflowId); + } + + static String run(Didit client, String workflowId) { + // 1. Create a session and send the user to its URL. + SessionsCreateResponse session = + client + .sessions() + .create( + SessionsCreateParams.builder() + .workflowId(workflowId) + .vendorData("user-42") + .callback("https://example.com/verification/done") + .build()); + System.out.println("Session " + session.sessionId() + ": send the user to " + session.url()); + + // 2. Later, read the decision. + SessionsRetrieveDecisionResponse decision = + client.sessions().retrieveDecision(session.sessionId()); + System.out.println( + "Decision: " + decision.status().map(Object::toString).orElse("not available yet")); + return session.sessionId(); + } + + /** 3. In your webhook endpoint, verify the delivery before trusting it. */ + static WebhookEvent onWebhook(byte[] rawBody, Map headers, String secret) { + WebhookEvent event = Webhooks.verify(rawBody, headers, secret); + if (event instanceof SessionStatusUpdatedEvent) { + SessionStatusUpdatedEvent e = (SessionStatusUpdatedEvent) event; + System.out.println( + "Webhook: session " + + e.sessionId().orElse("?") + + " is now " + + e.status().orElse("?") + + " (verified by " + + e.verifiedBy() + + ")"); + } else { + System.out.println( + "Webhook: " + + event.webhookType() + + " " + + new String(rawBody, StandardCharsets.UTF_8).length() + + " bytes"); + } + return event; + } +} diff --git a/examples/src/main/java/me/didit/examples/QuickstartDemo.java b/examples/src/main/java/me/didit/examples/QuickstartDemo.java new file mode 100644 index 0000000..6af391b --- /dev/null +++ b/examples/src/main/java/me/didit/examples/QuickstartDemo.java @@ -0,0 +1,51 @@ +package me.didit.examples; + +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.time.Instant; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import me.didit.Didit; +import me.didit.webhooks.Webhooks; + +/** Runs the quickstart against {@link MockDiditServer}, with a webhook signed like Didit does. */ +public final class QuickstartDemo { + private QuickstartDemo() {} + + public static void main(String[] args) throws Exception { + try (MockDiditServer server = new MockDiditServer()) { + Didit client = Didit.builder().apiKey("synthetic-demo-key").baseUrl(server.baseUrl()).build(); + Quickstart.run(client, "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee"); + + String secret = "whsec_test_demo_0123456789"; + long now = Instant.now().getEpochSecond(); + String body = + "{\"created_at\":" + + now + + ",\"event_id\":\"7c9e6679-7425-40de-944b-e07fc1f90ae7\"," + + "\"session_id\":\"11111111-2222-4333-8444-555555555555\",\"status\":\"Approved\"," + + "\"timestamp\":" + + now + + ",\"webhook_type\":\"status.updated\"}"; + Map headers = new LinkedHashMap<>(); + headers.put("X-Signature-V2", hmac(secret, Webhooks.canonicalJson(body))); + headers.put("X-Timestamp", Long.toString(now)); + Quickstart.onWebhook(body.getBytes(StandardCharsets.UTF_8), headers, secret); + System.out.println("Mock API saw: " + server.log()); + } + } + + static String hmac(String secret, String message) + throws NoSuchAlgorithmException, InvalidKeyException { + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256")); + StringBuilder hex = new StringBuilder(); + for (byte b : mac.doFinal(message.getBytes(StandardCharsets.UTF_8))) { + hex.append(String.format("%02x", b)); + } + return hex.toString(); + } +} diff --git a/examples/src/main/java/me/didit/examples/TransactionScreeningExample.java b/examples/src/main/java/me/didit/examples/TransactionScreeningExample.java new file mode 100644 index 0000000..c5a3bd7 --- /dev/null +++ b/examples/src/main/java/me/didit/examples/TransactionScreeningExample.java @@ -0,0 +1,44 @@ +package me.didit.examples; + +import java.time.OffsetDateTime; +import me.didit.Didit; +import me.didit.types.TransactionDetail; +import me.didit.types.TransactionsCreateParams; + +/** Transaction monitoring: submit a payment for screening and read its status and score. */ +public final class TransactionScreeningExample { + private TransactionScreeningExample() {} + + public static void main(String[] args) { + Didit client = Env.client(); + TransactionDetail transaction = + client + .transactions() + .create( + TransactionsCreateParams.builder() + .transactionId("order-1001") + .transactionAt(OffsetDateTime.now()) + .transactionCategory(TransactionsCreateParams.TransactionCategory.FINANCE) + .transactionDetails( + TransactionsCreateParams.TransactionDetails.builder() + .direction( + TransactionsCreateParams.TransactionDetails.Direction.OUTBOUND) + .amount(250.0) + .currency("EUR") + .build()) + .subject( + TransactionsCreateParams.Subject.builder() + .entityType("user") + .vendorData("user-42") + .fullName("Ana Ruiz") + .build()) + .build()); + System.out.println( + "Transaction " + + transaction.uuid().orElse("?") + + ": " + + transaction.status().map(Object::toString).orElse("?") + + ", score " + + transaction.score().orElse(0L)); + } +} diff --git a/examples/src/main/java/me/didit/examples/TravelRuleExample.java b/examples/src/main/java/me/didit/examples/TravelRuleExample.java new file mode 100644 index 0000000..7aadbf6 --- /dev/null +++ b/examples/src/main/java/me/didit/examples/TravelRuleExample.java @@ -0,0 +1,44 @@ +package me.didit.examples; + +import me.didit.Didit; +import me.didit.core.Page; +import me.didit.types.TravelRuleListVaspsParams; +import me.didit.types.VaspDirectoryEntry; +import me.didit.types.WalletScreeningResult; +import me.didit.types.WalletScreeningScreenParams; + +/** Wallet screening and the Travel Rule VASP directory, with automatic pagination. */ +public final class TravelRuleExample { + private TravelRuleExample() {} + + public static void main(String[] args) { + Didit client = Env.client(); + WalletScreeningResult wallet = + client + .walletScreening() + .screen( + WalletScreeningScreenParams.builder() + .walletAddress(args.length > 0 ? args[0] : "bc1qexampleexampleexampleexample") + .blockchain(WalletScreeningScreenParams.Blockchain.of("bitcoin")) + .build()); + System.out.println( + "Wallet risk " + + wallet.riskScore() + + " (" + + wallet.severity() + + "), sanctions hit: " + + wallet.sanctionsHit()); + + Page vasps = + client + .travelRule() + .listVasps(TravelRuleListVaspsParams.builder().search("exchange").limit(50).build()); + int shown = 0; + for (VaspDirectoryEntry vasp : vasps) { // fetches the following pages as needed + System.out.println(vasp.name().orElse("?") + " " + vasp.jurisdiction().orElse("")); + if (++shown == 100) { + break; + } + } + } +} diff --git a/examples/src/main/java/me/didit/examples/webhooks/JavalinReceiver.java b/examples/src/main/java/me/didit/examples/webhooks/JavalinReceiver.java new file mode 100644 index 0000000..07cb739 --- /dev/null +++ b/examples/src/main/java/me/didit/examples/webhooks/JavalinReceiver.java @@ -0,0 +1,31 @@ +package me.didit.examples.webhooks; + +import io.javalin.Javalin; +import me.didit.errors.WebhookVerificationException; +import me.didit.webhooks.VerifyOptions; +import me.didit.webhooks.WebhookEvent; +import me.didit.webhooks.Webhooks; + +/** A Javalin webhook receiver. */ +public final class JavalinReceiver { + private JavalinReceiver() {} + + public static void main(String[] args) { + VerifyOptions options = VerifyOptions.of(System.getenv("DIDIT_WEBHOOK_SECRET")); + Javalin.create( + config -> + config.routes.post( + "/webhooks/didit", + ctx -> { + try { + WebhookEvent event = + Webhooks.verify(ctx.bodyAsBytes(), ctx::header, options); + System.out.println("Received " + event.webhookType()); + ctx.status(200); + } catch (WebhookVerificationException e) { + ctx.status(401); + } + })) + .start(8080); + } +} diff --git a/examples/src/main/java/me/didit/examples/webhooks/JdkHttpServerReceiver.java b/examples/src/main/java/me/didit/examples/webhooks/JdkHttpServerReceiver.java new file mode 100644 index 0000000..c75962c --- /dev/null +++ b/examples/src/main/java/me/didit/examples/webhooks/JdkHttpServerReceiver.java @@ -0,0 +1,40 @@ +package me.didit.examples.webhooks; + +import com.sun.net.httpserver.HttpServer; +import java.io.IOException; +import java.net.InetSocketAddress; +import me.didit.errors.WebhookVerificationException; +import me.didit.webhooks.SessionStatusUpdatedEvent; +import me.didit.webhooks.VerifyOptions; +import me.didit.webhooks.WebhookEvent; +import me.didit.webhooks.Webhooks; + +/** A webhook receiver with only the JDK: {@code com.sun.net.httpserver}. */ +public final class JdkHttpServerReceiver { + private JdkHttpServerReceiver() {} + + public static void main(String[] args) throws IOException { + VerifyOptions options = VerifyOptions.of(System.getenv("DIDIT_WEBHOOK_SECRET")); + HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0); + server.createContext( + "/webhooks/didit", + exchange -> { + byte[] body = exchange.getRequestBody().readAllBytes(); + int status; + try { + WebhookEvent event = + Webhooks.verify(body, exchange.getRequestHeaders()::getFirst, options); + if (event instanceof SessionStatusUpdatedEvent) { + System.out.println( + "Session " + ((SessionStatusUpdatedEvent) event).sessionId().orElse("?")); + } + status = 200; + } catch (WebhookVerificationException e) { + status = 401; + } + exchange.sendResponseHeaders(status, -1); + exchange.close(); + }); + server.start(); + } +} diff --git a/examples/src/main/java/me/didit/examples/webhooks/SpringBootReceiver.java b/examples/src/main/java/me/didit/examples/webhooks/SpringBootReceiver.java new file mode 100644 index 0000000..bad6817 --- /dev/null +++ b/examples/src/main/java/me/didit/examples/webhooks/SpringBootReceiver.java @@ -0,0 +1,48 @@ +package me.didit.examples.webhooks; + +import me.didit.errors.WebhookVerificationException; +import me.didit.webhooks.SessionStatusUpdatedEvent; +import me.didit.webhooks.TransactionStatusUpdatedEvent; +import me.didit.webhooks.WebhookEvent; +import me.didit.webhooks.Webhooks; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RestController; + +/** + * A Spring Boot webhook receiver. Take the body as {@code byte[]} so the signature covers the exact + * bytes Didit sent. + */ +@SpringBootApplication +@RestController +public class SpringBootReceiver { + private final String secret = System.getenv("DIDIT_WEBHOOK_SECRET"); + + @PostMapping("/webhooks/didit") + public ResponseEntity receive( + @RequestBody byte[] body, @RequestHeader HttpHeaders headers) { + WebhookEvent event; + try { + event = Webhooks.verify(body, headers::getFirst, secret); + } catch (WebhookVerificationException e) { + return ResponseEntity.status(401).build(); + } + if (event instanceof SessionStatusUpdatedEvent) { + SessionStatusUpdatedEvent session = (SessionStatusUpdatedEvent) event; + System.out.println(session.sessionId().orElse("?") + " is " + session.status().orElse("?")); + } else if (event instanceof TransactionStatusUpdatedEvent) { + System.out.println( + "Transaction " + ((TransactionStatusUpdatedEvent) event).transactionId().orElse("?")); + } + return ResponseEntity.ok().build(); + } + + public static void main(String[] args) { + SpringApplication.run(SpringBootReceiver.class, args); + } +} diff --git a/examples/src/main/kotlin/me/didit/examples/KotlinQuickstart.kt b/examples/src/main/kotlin/me/didit/examples/KotlinQuickstart.kt new file mode 100644 index 0000000..86b9a2c --- /dev/null +++ b/examples/src/main/kotlin/me/didit/examples/KotlinQuickstart.kt @@ -0,0 +1,37 @@ +package me.didit.examples + +import kotlin.jvm.optionals.getOrNull +import me.didit.Didit +import me.didit.types.SessionsCreateParams +import me.didit.webhooks.SessionStatusUpdatedEvent +import me.didit.webhooks.TransactionStatusUpdatedEvent +import me.didit.webhooks.UnknownEvent +import me.didit.webhooks.WebhookEvent +import me.didit.webhooks.Webhooks + +/** The quickstart in Kotlin: nullable types where the API allows null, plain types elsewhere. */ +fun createSession(client: Didit, workflowId: String): String { + val session = + client + .sessions() + .create( + SessionsCreateParams.builder().workflowId(workflowId).vendorData("user-42").build(), + ) + val id: String = session.sessionId() // required in the API: never null + val vendorData: String? = session.vendorData().getOrNull() // optional in the API + println("Session $id for ${vendorData ?: "anonymous"}: ${session.url()}") + return id +} + +fun describe(event: WebhookEvent): String = + when (event) { + is SessionStatusUpdatedEvent -> + "session ${event.sessionId().getOrNull()} is ${event.status().getOrNull()}" + is TransactionStatusUpdatedEvent -> + "transaction ${event.transactionId().getOrNull()} is ${event.status().getOrNull()}" + is UnknownEvent -> "unknown event ${event.webhookType()}" + else -> event.webhookType() + } + +fun handleWebhook(body: ByteArray, headers: Map, secret: String): String = + describe(Webhooks.verify(body, headers, secret)) diff --git a/examples/src/main/kotlin/me/didit/examples/KtorReceiver.kt b/examples/src/main/kotlin/me/didit/examples/KtorReceiver.kt new file mode 100644 index 0000000..cc239c9 --- /dev/null +++ b/examples/src/main/kotlin/me/didit/examples/KtorReceiver.kt @@ -0,0 +1,33 @@ +package me.didit.examples + +import io.ktor.http.HttpStatusCode +import io.ktor.server.engine.embeddedServer +import io.ktor.server.netty.Netty +import io.ktor.server.request.header +import io.ktor.server.request.receive +import io.ktor.server.response.respond +import io.ktor.server.routing.post +import io.ktor.server.routing.routing +import me.didit.errors.WebhookVerificationException +import me.didit.webhooks.VerifyOptions +import me.didit.webhooks.Webhooks + +/** A Ktor webhook receiver. */ +fun main() { + val options = VerifyOptions.of(System.getenv("DIDIT_WEBHOOK_SECRET")) + embeddedServer(Netty, port = 8080) { + routing { + post("/webhooks/didit") { + val body = call.receive() + try { + val event = Webhooks.verify(body, { name -> call.request.header(name) }, options) + println(describe(event)) + call.respond(HttpStatusCode.OK) + } catch (e: WebhookVerificationException) { + call.respond(HttpStatusCode.Unauthorized, e.reason().code()) + } + } + } + } + .start(wait = true) +} diff --git a/examples/src/test/java/me/didit/examples/QuickstartTest.java b/examples/src/test/java/me/didit/examples/QuickstartTest.java new file mode 100644 index 0000000..bc08393 --- /dev/null +++ b/examples/src/test/java/me/didit/examples/QuickstartTest.java @@ -0,0 +1,45 @@ +package me.didit.examples; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.nio.charset.StandardCharsets; +import java.time.Instant; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.webhooks.VerifiedBy; +import me.didit.webhooks.WebhookEvent; +import me.didit.webhooks.Webhooks; +import org.junit.jupiter.api.Test; + +/** The README quickstart against the local mock API. */ +final class QuickstartTest { + @Test + void quickstartRunsAgainstTheMock() throws Exception { + try (MockDiditServer server = new MockDiditServer()) { + Didit client = + Didit.builder() + .apiKey("test-key") + .baseUrl(server.baseUrl()) + .environment(n -> null) + .build(); + assertEquals( + "11111111-2222-4333-8444-555555555555", + Quickstart.run(client, "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee")); + assertEquals( + List.of( + "POST /v3/session/ -> 201", + "GET /v3/session/11111111-2222-4333-8444-555555555555/decision/ -> 200"), + server.log()); + } + String secret = "whsec_test_quickstart_0123"; + long now = Instant.now().getEpochSecond(); + String body = + "{\"status\":\"Approved\",\"timestamp\":" + now + ",\"webhook_type\":\"status.updated\"}"; + Map headers = + Map.of("X-Signature-V2", QuickstartDemo.hmac(secret, Webhooks.canonicalJson(body))); + WebhookEvent event = + Quickstart.onWebhook(body.getBytes(StandardCharsets.UTF_8), headers, secret); + assertEquals(VerifiedBy.SIGNATURE_V2, event.verifiedBy()); + } +} diff --git a/examples/src/test/kotlin/me/didit/examples/KotlinApiTest.kt b/examples/src/test/kotlin/me/didit/examples/KotlinApiTest.kt new file mode 100644 index 0000000..d8ad417 --- /dev/null +++ b/examples/src/test/kotlin/me/didit/examples/KotlinApiTest.kt @@ -0,0 +1,133 @@ +package me.didit.examples + +import java.nio.charset.StandardCharsets +import java.time.OffsetDateTime +import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertIs +import kotlin.test.assertNull +import kotlin.test.assertTrue +import me.didit.Didit +import me.didit.core.Headers +import me.didit.core.HttpTransport +import me.didit.core.TransportRequest +import me.didit.core.TransportResponse +import me.didit.errors.NotFoundException +import me.didit.types.SessionsListResponse +import me.didit.types.TransactionsCreateParams +import me.didit.webhooks.SessionStatusUpdatedEvent +import me.didit.webhooks.Webhooks + +/** + * The public API from Kotlin. This file compiles with -Xjspecify-annotations=strict and warnings as + * errors, so Kotlin sees the library's nullability: passing null where the API takes it, and plain + * types for required values. + */ +class KotlinApiTest { + private class Stub(private vararg val bodies: Pair) : HttpTransport { + val requests = mutableListOf() + + override fun send(request: TransportRequest): CompletableFuture { + val (status, body) = bodies[requests.size] + requests += request + val headers = Headers.of(mapOf("Content-Type" to listOf("application/json"))) + return CompletableFuture.completedFuture( + TransportResponse(status, headers, body.toByteArray(StandardCharsets.UTF_8)), + ) + } + } + + private fun client(stub: Stub): Didit = + Didit.builder().apiKey("test-api-key").environment { null }.transport(stub).build() + + @Test + fun createsASessionAndReadsTypedFields() { + val stub = + Stub( + 201 to + """{"session_id":"s-1","session_number":7,"session_token":"t","url":"https://verify.didit.me/s", + "vendor_data":null,"metadata":null,"status":"Not Started","callback":null, + "workflow_id":"w-1","workflow_version":2}""", + ) + val id = createSession(client(stub), "w-1") + assertEquals("s-1", id) + val request = stub.requests.single() + assertEquals("POST", request.method()) + assertEquals("/v3/session/", request.uri().path) + } + + @Test + fun nullableSettersTakeNull() { + val params = + TransactionsCreateParams.builder() + .transactionId("t-1") + .transactionAt(OffsetDateTime.parse("2026-11-01T10:00:00Z")) + .transactionCategory(TransactionsCreateParams.TransactionCategory.FINANCE) + .subject( + TransactionsCreateParams.Subject.builder() + .vendorData("user-42") + .fullName("Ana Ruiz") + .build(), + ) + .transactionDetails( + TransactionsCreateParams.TransactionDetails.builder() + .direction(TransactionsCreateParams.TransactionDetails.Direction.INBOUND) + .amount(10.0) + .currency("EUR") + .amountInDefaultCurrency(null) // @Nullable in Java: Kotlin accepts null + .build(), + ) + .includeCryptoScreening(null) + .build() + assertTrue(params._json().get("include_crypto_screening").isNull) + assertNull(params.includeCryptoScreening().getOrNull()) + assertFailsWith { TransactionsCreateParams.builder().build() } + } + + @Test + fun pagesAreIterable() { + val stub = + Stub( + 200 to + """{"count":2,"next":"https://verification.didit.me/v3/sessions/?offset=1","previous":null, + "results":[{"session_id":"a","session_kind":"user","session_number":1,"status":"Approved", + "created_at":"2026-11-01T10:00:00Z"}]}""", + 200 to + """{"count":2,"next":null,"previous":null,"results":[{"session_id":"b","session_kind":"business", + "session_number":2,"status":"In Review","created_at":"2026-11-01T10:00:00Z"}]}""", + ) + val ids = client(stub).sessions().list().map(SessionsListResponse.Results::sessionId) + assertEquals(listOf("a", "b"), ids) + assertEquals(2, stub.requests.size) + } + + @Test + fun errorsAreTyped() { + val stub = Stub(404 to """{"detail":"Not found."}""") + val error = + assertFailsWith { client(stub).sessions().retrieveDecision("missing") } + assertEquals(404, error.statusCode()) + assertEquals("Not found.", error.body().getOrNull()?.get("detail")?.asText()) + } + + @Test + fun webhooksWithWhen() { + val secret = "whsec_test_kotlin_0123456789" + val now = System.currentTimeMillis() / 1000 + val body = + """{"session_id":"s-1","status":"Approved","timestamp":$now,"webhook_type":"status.updated"}""" + val signature = hmac(secret, Webhooks.canonicalJson(body)) + val headers = mapOf("X-Signature-V2" to signature, "X-Timestamp" to now.toString()) + assertEquals("session s-1 is Approved", handleWebhook(body.toByteArray(), headers, secret)) + assertIs(Webhooks.verify(body, headers, secret)) + } + + private fun hmac(secret: String, message: String): String { + val mac = javax.crypto.Mac.getInstance("HmacSHA256") + mac.init(javax.crypto.spec.SecretKeySpec(secret.toByteArray(), "HmacSHA256")) + return mac.doFinal(message.toByteArray()).joinToString("") { "%02x".format(it) } + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7218c5a --- /dev/null +++ b/gradle.properties @@ -0,0 +1,9 @@ +group=me.didit +# x-release-please-start-version +version=0.1.0 +# x-release-please-end +# google-java-format (Spotless) runs inside the Gradle JVM and needs javac's internals. +org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m -Dfile.encoding=UTF-8 --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configuration-cache=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..1d5f6b4 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,32 @@ +[versions] +jackson = "2.22.3" +jspecify = "1.0.0" +junit = "5.14.4" +errorprone = "2.50.0" +nullaway = "0.14.2" +google-java-format = "1.36.1" +kotlin = "2.4.21" +javalin = "7.2.3" +ktor = "3.6.0" +spring-boot = "4.1.1" +slf4j = "2.0.20" + +[libraries] +jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" } +jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" } +junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" } +junit-launcher = { module = "org.junit.platform:junit-platform-launcher" } +errorprone-core = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" } +nullaway = { module = "com.uber.nullaway:nullaway", version.ref = "nullaway" } +javalin = { module = "io.javalin:javalin", version.ref = "javalin" } +ktor-server-core = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" } +ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "ktor" } +spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "spring-boot" } +slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" } + +[plugins] +errorprone = { id = "net.ltgt.errorprone", version = "5.1.1" } +spotless = { id = "com.diffplug.spotless", version = "8.10.4" } +maven-publish = { id = "com.vanniktech.maven.publish", version = "0.37.0" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..9fa7f28 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..cd38371 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,10 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip +networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionSha256Sum=dce76f55f8e251a3a1f130eb120f30b3d271de2b76c9b0729d316b5a1b6dc01f diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..249efbb --- /dev/null +++ b/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright ยฉ 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# gradlew start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh gradlew +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions ยซ$varยป, ยซ${var}ยป, ยซ${var:-default}ยป, ยซ${var+SET}ยป, +# ยซ${var#prefix}ยป, ยซ${var%suffix}ยป, and ยซ$( cmd )ยป; +# * compound commands having a testable exit status, especially ยซcaseยป; +# * various built-in commands including ยซcommandยป, ยซsetยป, and ยซulimitยป. +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..03754c4 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,112 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem gradlew startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. + +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. + +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel + +:execute +@rem Setup the command line + + + +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel + +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..719f051 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "simple", + "package-name": "didit-java", + "include-v-in-tag": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "changelog-path": "CHANGELOG.md", + "extra-files": [ + "gradle.properties", + "src/main/java/me/didit/core/Version.java", + "README.md" + ] + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..f85252c --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,10 @@ +plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } + +rootProject.name = "didit-java" + +include("examples") + +dependencyResolutionManagement { + repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS + repositories { mavenCentral() } +} diff --git a/src/main/java/me/didit/Didit.java b/src/main/java/me/didit/Didit.java new file mode 100644 index 0000000..b982a11 --- /dev/null +++ b/src/main/java/me/didit/Didit.java @@ -0,0 +1,264 @@ +package me.didit; + +import java.net.http.HttpClient; +import java.time.Duration; +import java.util.function.Consumer; +import java.util.function.Function; +import me.didit.core.ApiClient; +import me.didit.core.ClientOptions; +import me.didit.core.HttpTransport; +import me.didit.resources.DiditResources; +import org.jspecify.annotations.Nullable; + +/** + * The Didit API client (DESIGN 6). Thread-safe and reusable: create one per process. + * + *
{@code
+ * Didit client = Didit.builder().apiKey(System.getenv("DIDIT_API_KEY")).build();
+ * SessionsCreateResponse session = client.sessions().create(
+ *     SessionsCreateParams.builder().workflowId(workflowId).vendorData("user-42").build());
+ * }
+ * + *

Every resource method has an {@code ...Async} variant returning a {@link + * java.util.concurrent.CompletableFuture}, and {@code withRawResponse()} gives the HTTP status, + * headers and request id. + */ +public final class Didit extends DiditResources { + private final ApiClient client; + + /** + * A client configured from the environment: {@code DIDIT_API_KEY}, {@code DIDIT_ORGANIZATION_ID}, + * {@code DIDIT_APPLICATION_ID}. + */ + public Didit() { + this(new ApiClient(ClientOptions.builder().build())); + } + + /** + * A client with this API key and the defaults. + * + * @param apiKey the API key from the Business Console + */ + public Didit(String apiKey) { + this(new ApiClient(ClientOptions.builder().apiKey(apiKey).build())); + } + + /** + * A client with these options. + * + * @param options the options + */ + public Didit(ClientOptions options) { + this(new ApiClient(options)); + } + + private Didit(ApiClient client) { + super(client); + this.client = client; + } + + /** + * Returns a builder with the defaults. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(ClientOptions.builder()); + } + + /** + * The options of this client. + * + * @return the options + */ + public ClientOptions options() { + return client.options(); + } + + /** + * A client that shares this one's connection pool with some options changed. + * + *

{@code
+   * Didit slow = client.withOptions(o -> o.timeout(Duration.ofMinutes(2)).maxRetries(5));
+   * }
+ * + * @param change changes the options + * @return a new client + */ + public Didit withOptions(Consumer change) { + ClientOptions.Builder builder = client.options().toBuilder(); + change.accept(builder); + return new Didit(builder.build()); + } + + @Override + public String toString() { + return "Didit{" + client.options() + "}"; + } + + /** Builds a {@link Didit} client. Unset values fall back to the environment. */ + public static final class Builder { + private final ClientOptions.Builder options; + + private Builder(ClientOptions.Builder options) { + this.options = options; + } + + /** + * The API key. Defaults to {@code DIDIT_API_KEY}. + * + * @param apiKey the API key from the Business Console + * @return this builder + */ + public Builder apiKey(String apiKey) { + options.apiKey(apiKey); + return this; + } + + /** + * The account token for {@code account} operations. + * + * @param accountToken the Bearer token from {@code account().login(...)} + * @return this builder + */ + public Builder accountToken(String accountToken) { + options.accountToken(accountToken); + return this; + } + + /** + * The organization id for application-scoped operations. Defaults to {@code + * DIDIT_ORGANIZATION_ID}. + * + * @param organizationId the organization id + * @return this builder + */ + public Builder organizationId(String organizationId) { + options.organizationId(organizationId); + return this; + } + + /** + * The application id for application-scoped operations. Defaults to {@code + * DIDIT_APPLICATION_ID}. + * + * @param applicationId the application id + * @return this builder + */ + public Builder applicationId(String applicationId) { + options.applicationId(applicationId); + return this; + } + + /** + * The verification API base URL. Defaults to {@code https://verification.didit.me}. + * + * @param baseUrl an https URL (http only for localhost) + * @return this builder + */ + public Builder baseUrl(String baseUrl) { + options.baseUrl(baseUrl); + return this; + } + + /** + * The account management API base URL. Defaults to {@code https://apx.didit.me/auth/v2}. + * + * @param accountBaseUrl an https URL (http only for localhost) + * @return this builder + */ + public Builder accountBaseUrl(String accountBaseUrl) { + options.accountBaseUrl(accountBaseUrl); + return this; + } + + /** + * The timeout of each attempt. Defaults to 60 seconds. + * + * @param timeout a positive duration + * @return this builder + */ + public Builder timeout(Duration timeout) { + options.timeout(timeout); + return this; + } + + /** + * How many times a failed request is retried. Defaults to 2. + * + * @param maxRetries zero or more + * @return this builder + */ + public Builder maxRetries(int maxRetries) { + options.maxRetries(maxRetries); + return this; + } + + /** + * Adds a header to every request. + * + * @param name the header name + * @param value the header value + * @return this builder + */ + public Builder defaultHeader(String name, String value) { + options.defaultHeader(name, value); + return this; + } + + /** + * Sends requests with this {@link HttpClient}; it must not follow redirects. + * + * @param httpClient the client + * @return this builder + */ + public Builder httpClient(HttpClient httpClient) { + options.httpClient(httpClient); + return this; + } + + /** + * Sends requests through a custom transport, for example a stub in tests. + * + * @param transport the transport + * @return this builder + */ + public Builder transport(HttpTransport transport) { + options.transport(transport); + return this; + } + + /** + * Logs method, path, status, duration and request id of every request. Defaults to {@code + * DIDIT_LOG=debug}. + * + * @param enabled whether to log + * @return this builder + */ + public Builder debugLogging(boolean enabled) { + options.debugLogging(enabled); + return this; + } + + /** + * Where the {@code DIDIT_*} fallbacks are read from. Defaults to {@link System#getenv}. + * + * @param environment variable name to value, or {@code null} when unset + * @return this builder + */ + public Builder environment(Function environment) { + options.environment(environment); + return this; + } + + /** + * Builds the client. + * + * @return the client + * @throws me.didit.errors.ConfigurationException when a URL is invalid + */ + public Didit build() { + return new Didit(options.build()); + } + } +} diff --git a/src/main/java/me/didit/authentication/AccessTokenClaims.java b/src/main/java/me/didit/authentication/AccessTokenClaims.java new file mode 100644 index 0000000..66eeec6 --- /dev/null +++ b/src/main/java/me/didit/authentication/AccessTokenClaims.java @@ -0,0 +1,21 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** The claims of a verified access token ({@code typ: at+jwt}). */ +public final class AccessTokenClaims extends TokenClaims { + AccessTokenClaims(ObjectNode json) { + super(json); + } + + /** + * {@code client_id}: the application id. + * + * @return the client id + */ + public Optional clientId() { + return optional("client_id", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/authentication/ActorClaim.java b/src/main/java/me/didit/authentication/ActorClaim.java new file mode 100644 index 0000000..96ac69a --- /dev/null +++ b/src/main/java/me/didit/authentication/ActorClaim.java @@ -0,0 +1,40 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Optional; +import me.didit.core.Conv; + +/** The {@code act} claim: the agent acting for the user. */ +public final class ActorClaim extends JsonView { + ActorClaim(ObjectNode json) { + super(json); + } + + /** + * The agent id. + * + * @return the id + */ + public Optional subject() { + return optional("sub", Conv.STRING); + } + + /** + * The agent's name. + * + * @return the name + */ + public Optional agent() { + return optional("agent", Conv.STRING); + } + + /** + * What the agent may do. + * + * @return the scopes + */ + public List scopes() { + return optional("scopes", Conv.list(Conv.STRING)).orElse(List.of()); + } +} diff --git a/src/main/java/me/didit/authentication/Authentication.java b/src/main/java/me/didit/authentication/Authentication.java new file mode 100644 index 0000000..8ba44b8 --- /dev/null +++ b/src/main/java/me/didit/authentication/Authentication.java @@ -0,0 +1,1201 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.StreamReadFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.math.BigInteger; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.nio.charset.StandardCharsets; +import java.security.GeneralSecurityException; +import java.security.KeyFactory; +import java.security.MessageDigest; +import java.security.SecureRandom; +import java.security.Signature; +import java.security.interfaces.ECPublicKey; +import java.security.spec.ECFieldFp; +import java.security.spec.ECParameterSpec; +import java.security.spec.ECPoint; +import java.security.spec.ECPublicKeySpec; +import java.time.Clock; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.Base64; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.regex.Pattern; +import me.didit.core.Headers; +import me.didit.core.HttpTransport; +import me.didit.core.JdkHttpTransport; +import me.didit.core.Json; +import me.didit.core.TransportResponse; +import me.didit.core.Version; +import me.didit.errors.ApiConnectionException; +import me.didit.errors.ApiStatusException; +import me.didit.errors.ApiTimeoutException; +import me.didit.errors.ConfigurationException; +import me.didit.errors.DiditException; +import me.didit.errors.TokenVerificationException; +import me.didit.errors.TokenVerificationException.Reason; +import me.didit.errors.UnexpectedResponseException; +import org.jspecify.annotations.Nullable; + +/** + * Didit Authentication for your backend (DESIGN 10). It talks to your application's issuer ({@code + * https://.auth.didit.me} or your own domain), never with the API key. + * + *
{@code
+ * Authentication auth = Authentication.fromPublishableKey("pk_live_...");
+ * AccessTokenClaims claims = auth.verifyAccessToken(bearerToken);
+ * String userId = claims.subject();
+ * }
+ * + *

Discovery and the signing keys are fetched lazily and cached as the issuer says (5 minutes + * today, kept between 1 minute and 24 hours); a token with an unknown key id refetches the keys at + * most once a minute. Concurrent calls share one fetch, and after a failed key fetch verifications + * fail fast for 5 seconds before the issuer is asked again. Thread-safe: create one per issuer and + * reuse it. + * + *

Refreshes of one session must be serialised: each refresh token works once, and reusing a + * consumed one revokes the session. + */ +public final class Authentication { + /** The default clock tolerance for {@code exp}, {@code nbf} and {@code iat}. */ + public static final Duration DEFAULT_LEEWAY = Duration.ofMinutes(1); + + /** The default timeout of each call to the issuer. */ + public static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(10); + + static final Duration MIN_CACHE = Duration.ofMinutes(1); + static final Duration MAX_CACHE = Duration.ofHours(24); + static final Duration DEFAULT_CACHE = Duration.ofMinutes(5); + static final Duration REFETCH_INTERVAL = Duration.ofMinutes(1); + static final Duration FAILED_FETCH_BACKOFF = Duration.ofSeconds(5); + private static final int MAX_TOKEN_LENGTH = 16384; + private static final Pattern BASE64URL = Pattern.compile("[A-Za-z0-9_-]+"); + private static final SecureRandom RANDOM = new SecureRandom(); + private static final ObjectMapper STRICT = + JsonMapper.builder().enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION).build(); + + private final String issuer; + private final @Nullable String clientId; + private final Duration leeway; + private final Duration timeout; + private final HttpTransport transport; + private final Clock clock; + + private final Object lock = new Object(); + private @Nullable Discovery discovery; + private Instant discoveryExpiry = Instant.MIN; + private @Nullable CompletableFuture discoveryFetch; + private Map keys = Map.of(); + private Instant keysExpiry = Instant.MIN; + private Instant lastKeysFetch = Instant.MIN; + private @Nullable CompletableFuture> keysFetch; + private @Nullable RuntimeException keysFailure; + private Instant keysRetryAfter = Instant.MIN; + + private Authentication(Builder b, String issuer) { + this.issuer = issuer; + this.clientId = b.clientId; + this.leeway = b.leeway; + this.timeout = b.timeout; + this.clock = b.clock; + HttpTransport t = b.transport; + if (t == null) { + t = + b.httpClient != null + ? new JdkHttpTransport(b.httpClient) + : JdkHttpTransport.create(timeout); + } + this.transport = t; + } + + /** + * Authentication for an issuer, with the defaults. + * + * @param issuer for example {@code https://acme.auth.didit.me} + * @return the client + * @throws ConfigurationException when the issuer is not an https URL (http only for localhost) + */ + public static Authentication create(String issuer) { + return builder().issuer(issuer).build(); + } + + /** + * Authentication for the issuer a publishable key names. + * + * @param publishableKey {@code pk_live_...} or {@code pk_test_...} + * @return the client + * @throws ConfigurationException when the key is malformed + */ + public static Authentication fromPublishableKey(String publishableKey) { + return builder().publishableKey(publishableKey).build(); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The issuer, without a trailing slash. + * + * @return the issuer + */ + public String issuer() { + return issuer; + } + + // -- helpers ------------------------------------------------------------------- + + /** + * A new PKCE pair (S256): keep the verifier, send the challenge with the sign-in. + * + * @return the pair + */ + public static Pkce createPkce() { + String verifier = randomToken(); + try { + byte[] digest = + MessageDigest.getInstance("SHA-256").digest(verifier.getBytes(StandardCharsets.US_ASCII)); + return new Pkce(verifier, Base64.getUrlEncoder().withoutPadding().encodeToString(digest)); + } catch (GeneralSecurityException e) { + throw new IllegalStateException("SHA-256 is not available", e); + } + } + + /** + * A new random {@code state} for the sign-in request (43 URL-safe characters). + * + * @return the state + */ + public static String createState() { + return randomToken(); + } + + /** + * A new random {@code nonce} for the sign-in request (43 URL-safe characters). + * + * @return the nonce + */ + public static String createNonce() { + return randomToken(); + } + + private static String randomToken() { + byte[] bytes = new byte[32]; + RANDOM.nextBytes(bytes); + return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes); + } + + // -- token verification ----------------------------------------------------- + + /** + * Verifies an access token; the audience, when the client id is configured, must contain it. + * + * @param token the Bearer token + * @return the verified claims + * @throws TokenVerificationException when the token is not valid + * @throws DiditException when the issuer's keys cannot be fetched + */ + public AccessTokenClaims verifyAccessToken(String token) { + return await(verifyAccessTokenAsync(token, null)); + } + + /** + * Verifies an access token for an audience. + * + * @param token the Bearer token + * @param audience the expected audience (your application id), or {@code null} for the configured + * client id + * @return the verified claims + * @throws TokenVerificationException when the token is not valid + * @throws DiditException when the issuer's keys cannot be fetched + */ + public AccessTokenClaims verifyAccessToken(String token, @Nullable String audience) { + return await(verifyAccessTokenAsync(token, audience)); + } + + /** + * Verifies an access token for an audience. + * + * @param token the Bearer token + * @param audience the expected audience, or {@code null} for the configured client id + * @return a future completed with the verified claims + */ + public CompletableFuture verifyAccessTokenAsync( + String token, @Nullable String audience) { + return verifyAsync(token, true, audience == null ? clientId : audience, null) + .thenApply(AccessTokenClaims::new); + } + + /** + * Verifies an ID token for the configured client id. + * + * @param token the ID token + * @param nonce the nonce sent with the sign-in, or {@code null} for a token without one (after a + * refresh) + * @return the verified claims + * @throws TokenVerificationException when the token is not valid + * @throws ConfigurationException when no client id is configured + */ + public IdTokenClaims verifyIdToken(String token, @Nullable String nonce) { + return verifyIdToken(token, nonce, null); + } + + /** + * Verifies an ID token. + * + * @param token the ID token + * @param nonce the nonce sent with the sign-in, or {@code null} for a token without one (after a + * refresh) + * @param audience your application id, or {@code null} for the configured client id + * @return the verified claims + * @throws TokenVerificationException when the token is not valid + * @throws ConfigurationException when no audience is given or configured + */ + public IdTokenClaims verifyIdToken( + String token, @Nullable String nonce, @Nullable String audience) { + return await(verifyIdTokenAsync(token, nonce, audience)); + } + + /** + * Verifies an ID token. + * + * @param token the ID token + * @param nonce the nonce sent with the sign-in, or {@code null} for a token without one (after a + * refresh) + * @param audience your application id, or {@code null} for the configured client id + * @return a future completed with the verified claims + */ + public CompletableFuture verifyIdTokenAsync( + String token, @Nullable String nonce, @Nullable String audience) { + String expected = audience == null ? clientId : audience; + if (expected == null || expected.isEmpty()) { + return CompletableFuture.failedFuture( + new ConfigurationException( + "Verifying an ID token needs the audience: pass it or set clientId")); + } + return verifyAsync(token, false, expected, nonce).thenApply(IdTokenClaims::new); + } + + private CompletableFuture verifyAsync( + String token, boolean access, @Nullable String audience, @Nullable String nonce) { + ParsedToken parsed; + try { + parsed = ParsedToken.parse(token, access); + } catch (TokenVerificationException e) { + return CompletableFuture.failedFuture(e); + } + return keyAsync(parsed.kid) + .thenApply( + key -> { + parsed.verifySignature(key); + ObjectNode claims = parsed.claims(); + checkClaims(claims, audience, nonce, access); + return claims; + }); + } + + private void checkClaims( + ObjectNode claims, @Nullable String audience, @Nullable String nonce, boolean access) { + JsonNode iss = claims.get("iss"); + if (iss == null || !iss.isTextual() || !iss.textValue().equals(issuer)) { + throw new TokenVerificationException( + Reason.INVALID_ISSUER, "The token's issuer is not " + issuer); + } + JsonNode sub = claims.get("sub"); + if (sub == null || !sub.isTextual() || sub.textValue().isEmpty()) { + throw new TokenVerificationException(Reason.MISSING_CLAIM, "The token has no subject"); + } + double now = clock.instant().toEpochMilli() / 1000.0; + double leewaySeconds = leeway.toMillis() / 1000.0; + JsonNode exp = claims.get("exp"); + JsonNode iat = claims.get("iat"); + if (exp == null || !exp.isNumber()) { + throw new TokenVerificationException(Reason.MISSING_CLAIM, "The token has no expiry"); + } + if (iat == null || !iat.isNumber()) { + throw new TokenVerificationException(Reason.MISSING_CLAIM, "The token has no issue time"); + } + if (now >= exp.asDouble() + leewaySeconds) { + throw new TokenVerificationException(Reason.EXPIRED, "The token has expired"); + } + JsonNode nbf = claims.get("nbf"); + if (nbf != null && !nbf.isNull()) { + if (!nbf.isNumber()) { + throw new TokenVerificationException(Reason.MALFORMED, "The token's nbf is not a number"); + } + if (nbf.asDouble() > now + leewaySeconds) { + throw new TokenVerificationException(Reason.NOT_YET_VALID, "The token is not valid yet"); + } + } + if (iat.asDouble() > now + leewaySeconds) { + throw new TokenVerificationException( + Reason.INVALID_ISSUED_AT, "The token was issued in the future"); + } + if (audience != null && !TokenClaims.audiences(claims).contains(audience)) { + throw new TokenVerificationException( + Reason.INVALID_AUDIENCE, "The token is not for audience " + audience); + } + if (!access) { + // Without an expected nonce (a refreshed ID token) the token must not carry one either. + JsonNode actual = claims.get("nonce"); + boolean ok = + nonce == null + ? actual == null || actual.isNull() + : actual != null + && actual.isTextual() + && MessageDigest.isEqual( + actual.textValue().getBytes(StandardCharsets.UTF_8), + nonce.getBytes(StandardCharsets.UTF_8)); + if (!ok) { + throw new TokenVerificationException( + Reason.INVALID_NONCE, "The token's nonce does not match"); + } + } + } + + /** A JWT split into its parts, header checked. */ + static final class ParsedToken { + final String kid; + final byte[] signingInput; + final byte[] signature; + final String payload; + + private ParsedToken(String kid, byte[] signingInput, byte[] signature, String payload) { + this.kid = kid; + this.signingInput = signingInput; + this.signature = signature; + this.payload = payload; + } + + static ParsedToken parse(String token, boolean access) { + if (token.length() > MAX_TOKEN_LENGTH) { + throw malformed("The token is too long"); + } + String[] parts = token.split("\\.", -1); + if (parts.length != 3) { + throw malformed("A JWT has three parts"); + } + for (String part : parts) { + if (!BASE64URL.matcher(part).matches()) { + throw malformed("A JWT part is not base64url"); + } + } + ObjectNode header = object(decode(parts[0])); + JsonNode alg = header.get("alg"); + if (alg == null || !alg.isTextual() || !alg.textValue().equals("ES256")) { + throw new TokenVerificationException( + Reason.UNSUPPORTED_ALGORITHM, "Only ES256 tokens are accepted"); + } + if (header.has("crit")) { + throw malformed("The token has critical header parameters"); + } + JsonNode typ = header.get("typ"); + String type = + typ != null && typ.isTextual() ? typ.textValue().toLowerCase(Locale.ROOT) : null; + boolean typeOk = + access + ? "at+jwt".equals(type) || "application/at+jwt".equals(type) + : type == null || "jwt".equals(type) || "application/jwt".equals(type); + if (!typeOk || (typ != null && !typ.isTextual())) { + throw new TokenVerificationException( + Reason.INVALID_TYPE, + access ? "Not an access token (typ at+jwt)" : "Not an ID token (typ JWT)"); + } + JsonNode kid = header.get("kid"); + if (kid == null || !kid.isTextual() || kid.textValue().isEmpty()) { + throw malformed("The token has no key id"); + } + byte[] signature = bytes(parts[2]); + if (signature.length != 64) { + throw new TokenVerificationException( + Reason.INVALID_SIGNATURE, "An ES256 signature is 64 bytes"); + } + byte[] input = (parts[0] + "." + parts[1]).getBytes(StandardCharsets.US_ASCII); + return new ParsedToken(kid.textValue(), input, signature, decode(parts[1])); + } + + void verifySignature(ECPublicKey key) { + // r and s must be in [1, n-1]; some JDKs (CVE-2022-21449) accepted r = s = 0. + BigInteger order = key.getParams().getOrder(); + BigInteger r = new BigInteger(1, Arrays.copyOfRange(signature, 0, 32)); + BigInteger s = new BigInteger(1, Arrays.copyOfRange(signature, 32, 64)); + if (r.signum() == 0 + || s.signum() == 0 + || r.compareTo(order) >= 0 + || s.compareTo(order) >= 0) { + throw new TokenVerificationException( + Reason.INVALID_SIGNATURE, "The signature does not match"); + } + try { + Signature verifier = Signature.getInstance("SHA256withECDSAinP1363Format"); + verifier.initVerify(key); + verifier.update(signingInput); + if (!verifier.verify(signature)) { + throw new TokenVerificationException( + Reason.INVALID_SIGNATURE, "The signature does not match"); + } + } catch (GeneralSecurityException e) { + throw new TokenVerificationException( + Reason.INVALID_SIGNATURE, "The signature does not match"); + } + } + + ObjectNode claims() { + return object(payload); + } + + private static byte[] bytes(String part) { + try { + return Base64.getUrlDecoder().decode(part); + } catch (IllegalArgumentException e) { + throw malformed("A JWT part is not base64url"); + } + } + + private static String decode(String part) { + try { + return StandardCharsets.UTF_8 + .newDecoder() + .decode(java.nio.ByteBuffer.wrap(bytes(part))) + .toString(); + } catch (java.nio.charset.CharacterCodingException e) { + throw malformed("A JWT part is not base64url UTF-8"); + } + } + + private static ObjectNode object(String json) { + try (JsonParser parser = STRICT.createParser(json)) { + JsonNode node = STRICT.readTree(parser); + if (node == null || !node.isObject() || parser.nextToken() != null) { + throw malformed("A JWT part is not a JSON object"); + } + return (ObjectNode) node; + } catch (IOException e) { + throw malformed("A JWT part is not valid JSON"); + } + } + + private static TokenVerificationException malformed(String message) { + return new TokenVerificationException(Reason.MALFORMED, message); + } + } + + // -- discovery and keys -------------------------------------------------------- + + /** The parts of the discovery document the SDK uses. */ + static final class Discovery { + final URI tokenEndpoint; + final URI jwksUri; + + Discovery(URI tokenEndpoint, URI jwksUri) { + this.tokenEndpoint = tokenEndpoint; + this.jwksUri = jwksUri; + } + } + + /** The cached discovery document; concurrent callers share one fetch. */ + CompletableFuture discoveryAsync() { + CompletableFuture start; + CompletableFuture fetch; + synchronized (lock) { + Discovery cached = discovery; + if (cached != null && clock.instant().isBefore(discoveryExpiry)) { + return CompletableFuture.completedFuture(cached); + } + if (discoveryFetch != null) { + return discoveryFetch.copy(); + } + // The fetch starts once it is registered, so a transport that answers at once still finds + // discoveryFetch set when it clears it. + start = new CompletableFuture<>(); + URI uri = URI.create(issuer + "/.well-known/openid-configuration"); + fetch = + start + .thenCompose(ignored -> send("GET", uri, Map.of(), new byte[0])) + .thenApply( + response -> { + ObjectNode doc = jsonObject(response, "the discovery document"); + Discovery parsed = parseDiscovery(doc); + synchronized (lock) { + discovery = parsed; + discoveryExpiry = clock.instant().plus(cacheLifetime(response.headers())); + } + return parsed; + }) + .whenComplete( + (parsed, error) -> { + synchronized (lock) { + discoveryFetch = null; + } + }); + discoveryFetch = fetch; + } + start.complete(null); + return fetch.copy(); + } + + private Discovery parseDiscovery(ObjectNode doc) { + JsonNode iss = doc.get("issuer"); + if (iss == null || !iss.isTextual()) { + throw new UnexpectedResponseException("The discovery document has no issuer"); + } + if (!iss.textValue().equals(issuer)) { + throw new ConfigurationException( + "The discovery document names another issuer (" + iss.textValue() + ")"); + } + URI base = URI.create(issuer + "/"); + URI tokenEndpoint = URI.create(issuer + "/token/"); + JsonNode token = doc.get("token_endpoint"); + if (token != null && token.isTextual()) { + URI candidate = base.resolve(token.textValue()); + if (!Issuers.origin(candidate).equals(Issuers.origin(base))) { + throw new ConfigurationException("The token endpoint is not on the issuer's origin"); + } + tokenEndpoint = candidate; + } + URI jwks = URI.create(issuer + "/.well-known/jwks.json"); + JsonNode jwksUri = doc.get("jwks_uri"); + if (jwksUri != null && jwksUri.isTextual()) { + URI candidate = base.resolve(jwksUri.textValue()); + String scheme = + candidate.getScheme() == null ? "" : candidate.getScheme().toLowerCase(Locale.ROOT); + boolean httpIssuer = "http".equalsIgnoreCase(base.getScheme()); + if (!scheme.equals("https") && !(httpIssuer && scheme.equals("http"))) { + throw new ConfigurationException("The JWKS URI must use https"); + } + jwks = candidate; + } + return new Discovery(tokenEndpoint, jwks); + } + + /** + * The key for a key id. The keys are fetched when they expire, or for an unknown key id at most + * once a minute; concurrent callers share one fetch, and a failed fetch is answered from memory + * for {@link #FAILED_FETCH_BACKOFF} so an issuer outage does not turn every request into a fetch. + */ + CompletableFuture keyAsync(String kid) { + Instant now = clock.instant(); + CompletableFuture start = null; + CompletableFuture> fetch; + synchronized (lock) { + ECPublicKey key = keys.get(kid); + if (key != null && now.isBefore(keysExpiry)) { + return CompletableFuture.completedFuture(key); + } + fetch = keysFetch; + if (fetch == null) { + boolean expired = !now.isBefore(keysExpiry); + if (!expired && now.isBefore(lastKeysFetch.plus(REFETCH_INTERVAL))) { + return CompletableFuture.failedFuture(unknownKey()); + } + RuntimeException failed = keysFailure; + if (failed != null && now.isBefore(keysRetryAfter)) { + return CompletableFuture.failedFuture(failed); + } + lastKeysFetch = now; + start = new CompletableFuture<>(); + fetch = start.thenCompose(ignored -> fetchKeys()); + keysFetch = fetch; + } + } + if (start != null) { + start.complete(null); + } + return fetch.thenApply( + parsed -> { + ECPublicKey key = parsed.get(kid); + if (key == null) { + throw unknownKey(); + } + return key; + }); + } + + private CompletableFuture> fetchKeys() { + return discoveryAsync() + .thenCompose(d -> send("GET", d.jwksUri, Map.of(), new byte[0])) + .thenApply( + response -> { + ObjectNode doc = jsonObject(response, "the key set"); + Map parsed = parseKeys(doc); + synchronized (lock) { + keys = parsed; + keysExpiry = clock.instant().plus(cacheLifetime(response.headers())); + keysFailure = null; + } + return parsed; + }) + .whenComplete( + (parsed, error) -> { + synchronized (lock) { + keysFetch = null; + if (error != null) { + keysFailure = failure(error); + keysRetryAfter = clock.instant().plus(FAILED_FETCH_BACKOFF); + } + } + }); + } + + private static TokenVerificationException unknownKey() { + return new TokenVerificationException(Reason.UNKNOWN_KEY, "No published key has this key id"); + } + + static Map parseKeys(ObjectNode doc) { + Map out = new HashMap<>(); + JsonNode list = doc.get("keys"); + if (list == null || !list.isArray()) { + throw new UnexpectedResponseException("The key set has no keys"); + } + for (JsonNode jwk : list) { + if (!jwk.isObject() + || !"EC".equals(jwk.path("kty").asText()) + || !"P-256".equals(jwk.path("crv").asText()) + || !jwk.path("kid").isTextual() + || (jwk.has("use") && !"sig".equals(jwk.path("use").asText())) + || (jwk.has("alg") && !"ES256".equals(jwk.path("alg").asText()))) { + continue; + } + try { + out.put(jwk.get("kid").textValue(), ecKey(jwk.path("x").asText(), jwk.path("y").asText())); + } catch (GeneralSecurityException | IllegalArgumentException e) { + // Skip a key that is not a valid P-256 point. + } + } + return Collections.unmodifiableMap(out); + } + + static ECPublicKey ecKey(String x, String y) throws GeneralSecurityException { + byte[] xb = Base64.getUrlDecoder().decode(x); + byte[] yb = Base64.getUrlDecoder().decode(y); + if (xb.length != 32 || yb.length != 32) { + throw new GeneralSecurityException("P-256 coordinates are 32 bytes"); + } + java.security.AlgorithmParameters params = java.security.AlgorithmParameters.getInstance("EC"); + params.init(new java.security.spec.ECGenParameterSpec("secp256r1")); + ECParameterSpec spec = params.getParameterSpec(ECParameterSpec.class); + BigInteger px = new BigInteger(1, xb); + BigInteger py = new BigInteger(1, yb); + BigInteger p = ((ECFieldFp) spec.getCurve().getField()).getP(); + BigInteger a = spec.getCurve().getA(); + BigInteger b = spec.getCurve().getB(); + if (px.compareTo(p) >= 0 + || py.compareTo(p) >= 0 + || !py.pow(2).mod(p).equals(px.pow(3).add(a.multiply(px)).add(b).mod(p))) { + throw new GeneralSecurityException("The point is not on P-256"); + } + return (ECPublicKey) + KeyFactory.getInstance("EC").generatePublic(new ECPublicKeySpec(new ECPoint(px, py), spec)); + } + + /** + * {@code max-age} minus {@code Age}, 5 minutes when absent, kept between 1 minute and 24 hours; + * {@code no-store} and {@code no-cache} give the 1-minute minimum. + */ + static Duration cacheLifetime(Headers headers) { + Duration lifetime = DEFAULT_CACHE; + String cacheControl = headers.firstValue("Cache-Control").orElse("").toLowerCase(Locale.ROOT); + boolean noStore = false; + for (String directive : cacheControl.split(",", -1)) { + String d = directive.trim(); + if (d.equals("no-store") || d.equals("no-cache")) { + noStore = true; + } else if (d.startsWith("max-age=")) { + try { + lifetime = Duration.ofSeconds(Long.parseLong(d.substring("max-age=".length()).trim())); + } catch (NumberFormatException e) { + lifetime = DEFAULT_CACHE; + } + } + } + if (noStore) { + lifetime = Duration.ZERO; + } else { + Optional age = headers.firstValue("Age"); + if (age.isPresent()) { + try { + lifetime = lifetime.minusSeconds(Long.parseLong(age.get().trim())); + } catch (NumberFormatException e) { + // Ignore a malformed Age. + } + } + } + if (lifetime.compareTo(MIN_CACHE) < 0) { + return MIN_CACHE; + } + return lifetime.compareTo(MAX_CACHE) > 0 ? MAX_CACHE : lifetime; + } + + // -- runtime calls ------------------------------------------------------------- + + /** + * Exchanges an authorization code for tokens ({@code POST token/}). + * + * @param code the {@code code} from the redirect + * @param codeVerifier the PKCE verifier of this sign-in + * @param redirectUri the redirect URI of the sign-in request + * @return the tokens + * @throws me.didit.errors.BadRequestException with {@code invalid_grant} for a bad or used code + */ + public TokenResponse exchangeCode(String code, String codeVerifier, String redirectUri) { + return await(exchangeCodeAsync(code, codeVerifier, redirectUri)); + } + + /** + * Exchanges an authorization code for tokens. + * + * @param code the {@code code} from the redirect + * @param codeVerifier the PKCE verifier of this sign-in + * @param redirectUri the redirect URI of the sign-in request + * @return a future completed with the tokens + */ + public CompletableFuture exchangeCodeAsync( + String code, String codeVerifier, String redirectUri) { + Map form = new LinkedHashMap<>(); + form.put("grant_type", "authorization_code"); + form.put("code", code); + form.put("code_verifier", codeVerifier); + form.put("redirect_uri", redirectUri); + return token(form); + } + + /** + * Exchanges a refresh token for new tokens ({@code POST token/}). Serialise refreshes of one + * session: reusing a consumed refresh token revokes the session. + * + * @param refreshToken the refresh token + * @return the new tokens, including a new refresh token + * @throws me.didit.errors.BadRequestException with {@code invalid_grant} for a bad, used or + * expired refresh token + */ + public TokenResponse refresh(String refreshToken) { + return await(refreshAsync(refreshToken)); + } + + /** + * Exchanges a refresh token for new tokens. + * + * @param refreshToken the refresh token + * @return a future completed with the new tokens + */ + public CompletableFuture refreshAsync(String refreshToken) { + Map form = new LinkedHashMap<>(); + form.put("grant_type", "refresh_token"); + form.put("refresh_token", refreshToken); + return token(form); + } + + private CompletableFuture token(Map form) { + if (clientId != null) { + form.put("client_id", clientId); + } + StringBuilder body = new StringBuilder(); + for (Map.Entry field : form.entrySet()) { + if (body.length() > 0) { + body.append('&'); + } + body.append(URLEncoder.encode(field.getKey(), StandardCharsets.UTF_8)) + .append('=') + .append(URLEncoder.encode(field.getValue(), StandardCharsets.UTF_8)); + } + byte[] bytes = body.toString().getBytes(StandardCharsets.UTF_8); + return discoveryAsync() + .thenCompose( + d -> + send( + "POST", + d.tokenEndpoint, + Map.of("Content-Type", "application/x-www-form-urlencoded"), + bytes)) + .thenApply(response -> new TokenResponse(jsonObject(response, "the token response"))); + } + + /** + * Reads the session of an access token ({@code GET session/}): a live check that also catches + * revoked sessions. The runtime rate-limits this per IP; do not call it on every request. + * + * @param accessToken the access token + * @return the session + * @throws me.didit.errors.AuthenticationException when the token or session is no longer valid + */ + public AuthenticationSession getSession(String accessToken) { + return await(getSessionAsync(accessToken)); + } + + /** + * Reads the session of an access token. + * + * @param accessToken the access token + * @return a future completed with the session + */ + public CompletableFuture getSessionAsync(String accessToken) { + return send("GET", runtime("session/"), bearer(accessToken), new byte[0]) + .thenApply(response -> new AuthenticationSession(jsonObject(response, "the session"))); + } + + /** + * Signs the user out everywhere the session is used ({@code DELETE session/}). + * + * @param accessToken the access token + */ + public void revokeSession(String accessToken) { + await(revokeSessionAsync(accessToken)); + } + + /** + * Signs the user out. + * + * @param accessToken the access token + * @return a future completed when the session is revoked + */ + public CompletableFuture revokeSessionAsync(String accessToken) { + return send("DELETE", runtime("session/"), bearer(accessToken), new byte[0]) + .thenAccept(TransportResponse::close); + } + + /** + * Starts a step-up verification before a sensitive action ({@code POST step-up/}). When {@link + * StepUp#required()} is false no rule applies; otherwise send the user to {@link + * StepUp#verificationUrl()} and act only once {@link #retrieveStepUp} says approved. + * + * @param accessToken the user's access token + * @param params the action, amount and return URL + * @return the step-up + */ + public StepUp createStepUp(String accessToken, StepUpParams params) { + return await(createStepUpAsync(accessToken, params)); + } + + /** + * Starts a step-up verification. + * + * @param accessToken the user's access token + * @param params the action, amount and return URL + * @return a future completed with the step-up + */ + public CompletableFuture createStepUpAsync(String accessToken, StepUpParams params) { + ObjectNode body = Json.nodes().objectNode(); + body.put("action", params.action()); + params.amount().ifPresent(a -> body.put("amount", a)); + params.currency().ifPresent(c -> body.put("currency", c)); + params.returnTo().ifPresent(r -> body.put("return_to", r)); + Map headers = new LinkedHashMap<>(bearer(accessToken)); + headers.put("Content-Type", "application/json"); + return send( + "POST", runtime("step-up/"), headers, Json.write(body).getBytes(StandardCharsets.UTF_8)) + .thenApply(response -> new StepUp(jsonObject(response, "the step-up"))); + } + + /** + * Reads a step-up ({@code GET step-up/{id}/}) with a token of the same session. + * + * @param accessToken the user's access token + * @param stepUpId the step-up id + * @return the step-up + */ + public StepUp retrieveStepUp(String accessToken, String stepUpId) { + return await(retrieveStepUpAsync(accessToken, stepUpId)); + } + + /** + * Reads a step-up. + * + * @param accessToken the user's access token + * @param stepUpId the step-up id + * @return a future completed with the step-up + */ + public CompletableFuture retrieveStepUpAsync(String accessToken, String stepUpId) { + if (stepUpId.isEmpty() || stepUpId.equals(".") || stepUpId.equals("..")) { + return CompletableFuture.failedFuture( + new ConfigurationException("The step-up id must not be empty, '.' or '..'")); + } + String encoded = URLEncoder.encode(stepUpId, StandardCharsets.UTF_8).replace("+", "%20"); + return send("GET", runtime("step-up/" + encoded + "/"), bearer(accessToken), new byte[0]) + .thenApply(response -> new StepUp(jsonObject(response, "the step-up"))); + } + + private URI runtime(String path) { + return URI.create(issuer + "/" + path); + } + + private static Map bearer(String accessToken) { + Objects.requireNonNull(accessToken, "accessToken"); + return Map.of("Authorization", "Bearer " + accessToken); + } + + private CompletableFuture send( + String method, URI uri, Map extraHeaders, byte[] body) { + Map> headers = new LinkedHashMap<>(); + headers.put("Accept", List.of("application/json")); + headers.put("User-Agent", List.of(userAgent())); + headers.put("X-Didit-Client", List.of("java/" + Version.VERSION)); + extraHeaders.forEach((k, v) -> headers.put(k, List.of(v))); + String where = method + " " + uri.getRawPath(); + me.didit.core.TransportRequest request = + me.didit.core.TransportRequest.of(method, uri, headers, body, timeout); + CompletableFuture sent; + try { + sent = transport.send(request); + } catch (RuntimeException e) { + sent = CompletableFuture.failedFuture(e); + } + return sent.orTimeout(timeout.toMillis() + 50, TimeUnit.MILLISECONDS) + .handle( + (response, error) -> { + if (error != null) { + throw new CompletionException(connectionError(where, error)); + } + int status = response.statusCode(); + if (status >= 200 && status < 300) { + return response; + } + byte[] bytes; + try (TransportResponse r = response) { + bytes = r.body().readAllBytes(); + } catch (IOException e) { + bytes = new byte[0]; + } + JsonNode parsed = null; + if (bytes.length > 0) { + try { + parsed = Json.parse(bytes); + } catch (UnexpectedResponseException e) { + parsed = Json.nodes().textNode(new String(bytes, StandardCharsets.UTF_8)); + } + } + throw new CompletionException( + ApiStatusException.create( + status, oauthDetail(parsed), response.headers(), where)); + }); + } + + /** Puts {@code error: error_description} first so the exception message names the error. */ + private static @Nullable JsonNode oauthDetail(@Nullable JsonNode body) { + if (body == null || !body.isObject() || !body.path("error").isTextual() || body.has("detail")) { + return body; + } + ObjectNode copy = ((ObjectNode) body).deepCopy(); + String error = body.path("error").asText(); + String description = body.path("error_description").asText(""); + copy.put("detail", description.isEmpty() ? error : error + ": " + description); + return copy; + } + + private static Throwable unwrap(Throwable error) { + Throwable cause = error; + while ((cause instanceof CompletionException || cause instanceof ExecutionException) + && cause.getCause() != null) { + cause = cause.getCause(); + } + return cause; + } + + /** The exception a failed future stands for. */ + private static RuntimeException failure(Throwable error) { + Throwable cause = unwrap(error); + return cause instanceof RuntimeException + ? (RuntimeException) cause + : new DiditException("Authentication call failed", cause); + } + + private static DiditException connectionError(String where, Throwable error) { + Throwable cause = unwrap(error); + if (cause instanceof DiditException) { + return (DiditException) cause; + } + if (cause instanceof TimeoutException || cause instanceof java.net.http.HttpTimeoutException) { + return new ApiTimeoutException("Request timed out: " + where, cause); + } + return new ApiConnectionException("Connection error on " + where, cause); + } + + private static ObjectNode jsonObject(TransportResponse response, String what) { + byte[] bytes; + try (TransportResponse r = response) { + bytes = r.body().readAllBytes(); + } catch (IOException e) { + throw new ApiConnectionException("Failed to read " + what, e); + } + JsonNode node = Json.parse(bytes); + if (!node.isObject()) { + throw new UnexpectedResponseException( + "The issuer returned " + what + " that is not a JSON object"); + } + return (ObjectNode) node; + } + + private static String userAgent() { + return "didit-java/" + + Version.VERSION + + " (Java " + + System.getProperty("java.version", "unknown") + + "; " + + System.getProperty("os.name", "unknown") + + ")"; + } + + private static T await(CompletableFuture future) { + try { + return future.get(); + } catch (InterruptedException e) { + future.cancel(true); + Thread.currentThread().interrupt(); + throw new ApiConnectionException("Interrupted while waiting for the issuer", e); + } catch (ExecutionException e) { + throw failure(e); + } + } + + @Override + public String toString() { + return "Authentication{issuer=" + issuer + "}"; + } + + /** Builds an {@link Authentication}. */ + public static final class Builder { + private @Nullable String issuer; + private @Nullable String clientId; + private Duration leeway = DEFAULT_LEEWAY; + private Duration timeout = DEFAULT_TIMEOUT; + private @Nullable HttpTransport transport; + private @Nullable HttpClient httpClient; + private Clock clock = Clock.systemUTC(); + + private Builder() {} + + /** + * The issuer: {@code https://.auth.didit.me} or your custom domain. + * + * @param issuer the issuer URL + * @return this builder + */ + public Builder issuer(String issuer) { + this.issuer = Objects.requireNonNull(issuer, "issuer"); + return this; + } + + /** + * The issuer named by a publishable key. + * + * @param publishableKey {@code pk_live_...} or {@code pk_test_...} + * @return this builder + */ + public Builder publishableKey(String publishableKey) { + this.issuer = PublishableKey.parse(publishableKey).issuer(); + return this; + } + + /** + * Your application id: sent with token requests and used as the default audience. + * + * @param clientId the application id + * @return this builder + */ + public Builder clientId(String clientId) { + if (clientId.isEmpty()) { + throw new ConfigurationException("clientId must not be empty"); + } + this.clientId = clientId; + return this; + } + + /** + * The clock tolerance for {@code exp}, {@code nbf} and {@code iat}. Defaults to 60 seconds. + * + * @param leeway zero or more + * @return this builder + */ + public Builder leeway(Duration leeway) { + if (leeway.isNegative()) { + throw new ConfigurationException("leeway must not be negative"); + } + this.leeway = leeway; + return this; + } + + /** + * The timeout of each call to the issuer. Defaults to 10 seconds. Calls are never retried. + * + * @param timeout a positive duration + * @return this builder + */ + public Builder timeout(Duration timeout) { + if (timeout.isNegative() || timeout.isZero()) { + throw new ConfigurationException("timeout must be positive"); + } + this.timeout = timeout; + return this; + } + + /** + * Sends requests with this {@link HttpClient}; it must not follow redirects. + * + * @param httpClient the client + * @return this builder + */ + public Builder httpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "httpClient"); + return this; + } + + /** + * Sends requests through a custom transport, for example a stubbed issuer in tests. + * + * @param transport the transport + * @return this builder + */ + public Builder transport(HttpTransport transport) { + this.transport = Objects.requireNonNull(transport, "transport"); + return this; + } + + /** + * The clock that gives "now", for tests. + * + * @param clock the clock + * @return this builder + */ + public Builder clock(Clock clock) { + this.clock = Objects.requireNonNull(clock, "clock"); + return this; + } + + /** + * Builds the client. + * + * @return the client + * @throws ConfigurationException when no valid issuer is set + */ + public Authentication build() { + if (issuer == null) { + throw new ConfigurationException("Set the issuer or a publishable key"); + } + return new Authentication(this, Issuers.normalize(issuer)); + } + } +} diff --git a/src/main/java/me/didit/authentication/AuthenticationSession.java b/src/main/java/me/didit/authentication/AuthenticationSession.java new file mode 100644 index 0000000..a53ec9f --- /dev/null +++ b/src/main/java/me/didit/authentication/AuthenticationSession.java @@ -0,0 +1,199 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import me.didit.core.Conv; + +/** A live session, from {@link Authentication#getSession}. */ +public final class AuthenticationSession extends JsonView { + AuthenticationSession(ObjectNode json) { + super(json); + } + + /** + * The identity id ({@code sub}). + * + * @return the subject + */ + public Optional subject() { + return optional("sub", Conv.STRING); + } + + /** + * The session id ({@code sid}). + * + * @return the session id + */ + public Optional sessionId() { + return optional("sid", Conv.STRING); + } + + /** + * The application id. + * + * @return the application id + */ + public Optional applicationId() { + return optional("application_id", Conv.STRING); + } + + /** + * Your reference for the user. + * + * @return the vendor data + */ + public Optional vendorData() { + return optional("vendor_data", Conv.STRING); + } + + /** + * How the user signed in. + * + * @return the methods + */ + public List authenticationMethods() { + return optional("amr", Conv.list(Conv.STRING)).orElse(List.of()); + } + + /** + * Whether the session passed multi-factor authentication. + * + * @return true after MFA + */ + public boolean mfaVerified() { + return optional("mfa_verified", Conv.BOOLEAN).orElse(false); + } + + /** + * The email address. + * + * @return the email + */ + public Optional email() { + return optional("email", Conv.STRING); + } + + /** + * Whether the email address is verified. + * + * @return true when verified + */ + public boolean emailVerified() { + return optional("email_verified", Conv.BOOLEAN).orElse(false); + } + + /** + * The phone number. + * + * @return the phone + */ + public Optional phone() { + return optional("phone", Conv.STRING); + } + + /** + * The verified claims; empty when the user has none. + * + * @return the claims + */ + public Optional verified() { + JsonNode value = json.get("verified"); + return value != null && value.isObject() && value.size() > 0 + ? Optional.of(new VerifiedClaims(((ObjectNode) value).deepCopy())) + : Optional.empty(); + } + + /** + * The verified identity record, as sent. + * + * @return the record + */ + public Optional verifiedIdentity() { + return optional("verified_identity", Conv.ANY); + } + + /** + * When the session expires. + * + * @return the time + */ + public Optional expiresAt() { + return optional("expires_at", Conv.DATE_TIME); + } + + /** + * Where the hosted sign-out page returns to. + * + * @return the URL + */ + public Optional postLogoutRedirectUri() { + return optional("post_logout_redirect_uri", Conv.STRING); + } + + /** + * The user's organizations; empty when organizations are off. + * + * @return the organizations + */ + public List organizations() { + JsonNode value = json.get("organizations"); + if (value == null || !value.isArray()) { + return List.of(); + } + List out = new ArrayList<>(); + for (JsonNode item : value) { + if (item.isObject()) { + out.add(new Organization(((ObjectNode) item).deepCopy())); + } + } + return Collections.unmodifiableList(out); + } + + /** One of the user's organizations. */ + public static final class Organization extends JsonView { + Organization(ObjectNode json) { + super(json); + } + + /** + * The organization id. + * + * @return the id + */ + public Optional organizationId() { + return optional("organization_id", Conv.STRING); + } + + /** + * The organization name (sent as {@code organization__name}). + * + * @return the name + */ + public Optional organizationName() { + return optional("organization__name", Conv.STRING); + } + + /** + * The user's role. + * + * @return the role + */ + public Optional role() { + return optional("role", Conv.STRING); + } + + /** + * The custom role, when one is assigned: {@code key} and {@code permissions}. + * + * @return the custom role + */ + public Optional customRole() { + return optional("custom_role", Conv.ANY); + } + } +} diff --git a/src/main/java/me/didit/authentication/IdTokenClaims.java b/src/main/java/me/didit/authentication/IdTokenClaims.java new file mode 100644 index 0000000..4953fc5 --- /dev/null +++ b/src/main/java/me/didit/authentication/IdTokenClaims.java @@ -0,0 +1,67 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.Instant; +import java.util.Optional; +import me.didit.core.Conv; + +/** The claims of a verified ID token ({@code typ: JWT}). */ +public final class IdTokenClaims extends TokenClaims { + IdTokenClaims(ObjectNode json) { + super(json); + } + + /** + * {@code auth_time}: when the user signed in. + * + * @return the time + */ + public Optional authTime() { + return instant("auth_time"); + } + + /** + * {@code nonce}: present when the sign-in sent one; never after a refresh. + * + * @return the nonce + */ + public Optional nonce() { + return optional("nonce", Conv.STRING); + } + + /** + * {@code email}. + * + * @return the email address + */ + public Optional email() { + return optional("email", Conv.STRING); + } + + /** + * {@code email_verified}. + * + * @return whether the email address is verified + */ + public boolean emailVerified() { + return optional("email_verified", Conv.BOOLEAN).orElse(false); + } + + /** + * {@code name}: the display name. + * + * @return the name + */ + public Optional name() { + return optional("name", Conv.STRING); + } + + /** + * {@code phone_number}. + * + * @return the phone number + */ + public Optional phoneNumber() { + return optional("phone_number", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/authentication/Issuers.java b/src/main/java/me/didit/authentication/Issuers.java new file mode 100644 index 0000000..0b3b8f3 --- /dev/null +++ b/src/main/java/me/didit/authentication/Issuers.java @@ -0,0 +1,66 @@ +package me.didit.authentication; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Locale; +import me.didit.errors.ConfigurationException; + +/** Issuer URL rules: https, or http on loopback only; no user info, query or fragment. */ +final class Issuers { + private Issuers() {} + + static String normalize(String issuer) { + String value = issuer; + while (value.endsWith("/")) { + value = value.substring(0, value.length() - 1); + } + for (int i = 0; i < value.length(); i++) { + char c = value.charAt(i); + if (c <= 0x20 || c == 0x7f) { + throw new ConfigurationException( + "The issuer must not contain spaces or control characters"); + } + } + URI uri; + try { + uri = new URI(value); + } catch (URISyntaxException e) { + throw new ConfigurationException("The issuer is not a valid URL"); + } + String scheme = uri.getScheme() == null ? "" : uri.getScheme().toLowerCase(Locale.ROOT); + String host = uri.getHost(); + if (host == null + || uri.getRawUserInfo() != null + || uri.getRawQuery() != null + || uri.getRawFragment() != null) { + throw new ConfigurationException("The issuer must be an https URL without query or fragment"); + } + if (scheme.equals("http")) { + if (!isLoopback(host)) { + throw new ConfigurationException("The issuer must use https (http only for localhost)"); + } + } else if (!scheme.equals("https")) { + throw new ConfigurationException("The issuer must use https"); + } + return value; + } + + static boolean isLoopback(String host) { + String h = host.toLowerCase(Locale.ROOT); + return h.equals("localhost") + || h.endsWith(".localhost") + || h.equals("127.0.0.1") + || h.equals("[::1]") + || h.equals("::1"); + } + + static String origin(URI uri) { + int port = uri.getPort(); + String scheme = uri.getScheme() == null ? "" : uri.getScheme().toLowerCase(Locale.ROOT); + if (port == -1) { + port = scheme.equals("http") ? 80 : 443; + } + String host = uri.getHost() == null ? "" : uri.getHost().toLowerCase(Locale.ROOT); + return scheme + "://" + host + ":" + port; + } +} diff --git a/src/main/java/me/didit/authentication/JsonView.java b/src/main/java/me/didit/authentication/JsonView.java new file mode 100644 index 0000000..a1b7eef --- /dev/null +++ b/src/main/java/me/didit/authentication/JsonView.java @@ -0,0 +1,94 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.Json; + +/** A read-only typed view of a JSON object from the Authentication runtime. */ +abstract class JsonView { + final ObjectNode json; + + JsonView(ObjectNode json) { + this.json = json; + } + + final Optional optional(String field, Conv conv) { + return Json.optional(json, field, conv); + } + + /** + * Any field, including ones this SDK version does not declare. + * + * @param name the JSON field name + * @return the value, if present and not null + */ + public final Optional field(String name) { + return optional(name, Conv.ANY); + } + + /** + * A copy of the whole JSON object. + * + * @return the JSON + */ + public final ObjectNode _json() { + return json.deepCopy(); + } + + /** Field names whose values stay out of {@code toString()}, at any depth. */ + private static final Set PERSONAL = + Set.of( + "code", + "nonce", + "email", + "phone", + "phone_number", + "birthdate", + "nationality", + "vendor_data", + "verified", + "verified_identity"); + + @Override + public String toString() { + StringBuilder out = new StringBuilder(getClass().getSimpleName()).append('{'); + boolean first = true; + for (Map.Entry e : json.properties()) { + if (!first) { + out.append(", "); + } + first = false; + out.append(e.getKey()).append('=').append(redacted(e.getKey(), e.getValue())); + } + return out.append('}').toString(); + } + + private static JsonNode redacted(String key, JsonNode value) { + if (value.isNull()) { + return value; + } + if (PERSONAL.contains(key) || key.contains("token") || key.contains("name")) { + return Json.nodes().textNode("[REDACTED]"); + } + if (value.isObject()) { + ObjectNode out = Json.nodes().objectNode(); + for (Map.Entry e : value.properties()) { + out.set(e.getKey(), redacted(e.getKey(), e.getValue())); + } + return out; + } + if (value.isArray()) { + ArrayNode out = Json.nodes().arrayNode(); + for (JsonNode item : value) { + out.add(redacted("", item)); + } + return out; + } + return value; + } +} diff --git a/src/main/java/me/didit/authentication/OrganizationClaim.java b/src/main/java/me/didit/authentication/OrganizationClaim.java new file mode 100644 index 0000000..13fc1e7 --- /dev/null +++ b/src/main/java/me/didit/authentication/OrganizationClaim.java @@ -0,0 +1,30 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** The {@code org} claim: the active organization and the user's role. */ +public final class OrganizationClaim extends JsonView { + OrganizationClaim(ObjectNode json) { + super(json); + } + + /** + * The organization id. + * + * @return the id + */ + public Optional id() { + return optional("id", Conv.STRING); + } + + /** + * {@code admin}, {@code member} or {@code billing}. + * + * @return the role + */ + public Optional role() { + return optional("role", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/authentication/Pkce.java b/src/main/java/me/didit/authentication/Pkce.java new file mode 100644 index 0000000..ad5cfa4 --- /dev/null +++ b/src/main/java/me/didit/authentication/Pkce.java @@ -0,0 +1,47 @@ +package me.didit.authentication; + +/** + * A PKCE pair (RFC 7636, S256). Keep the verifier on your server and send the challenge with the + * sign-in request. + */ +public final class Pkce { + private final String verifier; + private final String challenge; + + Pkce(String verifier, String challenge) { + this.verifier = verifier; + this.challenge = challenge; + } + + /** + * The code verifier: 43 URL-safe characters. Secret. + * + * @return the verifier + */ + public String verifier() { + return verifier; + } + + /** + * The code challenge: base64url SHA-256 of the verifier. + * + * @return the challenge + */ + public String challenge() { + return challenge; + } + + /** + * {@code S256}. + * + * @return the challenge method + */ + public String method() { + return "S256"; + } + + @Override + public String toString() { + return "Pkce{challenge=" + challenge + ", verifier=[REDACTED]}"; + } +} diff --git a/src/main/java/me/didit/authentication/PublishableKey.java b/src/main/java/me/didit/authentication/PublishableKey.java new file mode 100644 index 0000000..ef25db7 --- /dev/null +++ b/src/main/java/me/didit/authentication/PublishableKey.java @@ -0,0 +1,88 @@ +package me.didit.authentication; + +import java.nio.ByteBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CodingErrorAction; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.regex.Pattern; +import me.didit.errors.ConfigurationException; + +/** + * A publishable key: {@code pk_live_} or {@code pk_test_} followed by the unpadded base64url issuer + * URL. It is public and safe to ship to browsers and apps. + */ +public final class PublishableKey { + private static final Pattern BODY = Pattern.compile("[A-Za-z0-9_-]+"); + + private final String issuer; + private final boolean live; + + private PublishableKey(String issuer, boolean live) { + this.issuer = issuer; + this.live = live; + } + + /** + * Parses a publishable key. + * + * @param key the key, for example {@code pk_live_aHR0cHM6Ly9...} + * @return the issuer and mode + * @throws ConfigurationException when the key is malformed or its issuer is not valid + */ + public static PublishableKey parse(String key) { + String k = key.trim(); + boolean live; + if (k.startsWith("pk_live_")) { + live = true; + } else if (k.startsWith("pk_test_")) { + live = false; + } else { + throw new ConfigurationException("A publishable key starts with pk_live_ or pk_test_"); + } + String body = k.substring("pk_live_".length()); + if (!BODY.matcher(body).matches() || body.length() % 4 == 1) { + throw new ConfigurationException("The publishable key is malformed"); + } + String issuer; + try { + byte[] bytes = Base64.getUrlDecoder().decode(body); + issuer = + StandardCharsets.UTF_8 + .newDecoder() + .onMalformedInput(CodingErrorAction.REPORT) + .decode(ByteBuffer.wrap(bytes)) + .toString(); + } catch (IllegalArgumentException | CharacterCodingException e) { + throw new ConfigurationException("The publishable key is malformed"); + } + String normalized = Issuers.normalize(issuer); + if (live && !normalized.startsWith("https://")) { + throw new ConfigurationException("A live publishable key must name an https issuer"); + } + return new PublishableKey(normalized, live); + } + + /** + * The issuer URL, without a trailing slash. + * + * @return the issuer + */ + public String issuer() { + return issuer; + } + + /** + * Whether this is a live key ({@code pk_live_}) rather than a sandbox one. + * + * @return true for live keys + */ + public boolean isLive() { + return live; + } + + @Override + public String toString() { + return "PublishableKey{issuer=" + issuer + ", live=" + live + "}"; + } +} diff --git a/src/main/java/me/didit/authentication/StepUp.java b/src/main/java/me/didit/authentication/StepUp.java new file mode 100644 index 0000000..4043dc4 --- /dev/null +++ b/src/main/java/me/didit/authentication/StepUp.java @@ -0,0 +1,143 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.Optional; +import me.didit.core.Conv; + +/** + * A step-up verification. Act on a sensitive action only when {@link #isApproved()} is true, after + * reading it back with {@link Authentication#retrieveStepUp}. + */ +public final class StepUp extends JsonView { + StepUp(ObjectNode json) { + super(json); + } + + /** + * Whether verification is needed. False when no rule applies: go ahead with the action. + * + * @return true when the user must verify + */ + public boolean required() { + return optional("required", Conv.BOOLEAN).orElse(true); + } + + /** + * The step-up id. + * + * @return the id + */ + public Optional id() { + return optional("id", Conv.STRING); + } + + /** + * The rule that applied: {@code payout}, {@code bank}, {@code contact} or {@code device}. + * + * @return the rule + */ + public Optional rule() { + return optional("rule", Conv.STRING); + } + + /** + * {@code liveness}, {@code selfie} or {@code full_id}. + * + * @return the method + */ + public Optional method() { + return optional("method", Conv.STRING); + } + + /** + * {@code pending}, {@code review}, {@code approved}, {@code declined}, {@code expired} or {@code + * superseded}. + * + * @return the status + */ + public Optional status() { + return optional("status", Conv.STRING); + } + + /** + * Whether the step-up is approved. + * + * @return true only for status {@code approved} + */ + public boolean isApproved() { + return status().map("approved"::equals).orElse(false); + } + + /** + * The verification level. + * + * @return the level + */ + public Optional level() { + return optional("level", Conv.STRING); + } + + /** + * The amount, as a decimal string. + * + * @return the amount + */ + public Optional amount() { + return optional("amount", Conv.STRING); + } + + /** + * The currency. + * + * @return the currency + */ + public Optional currency() { + return optional("currency", Conv.STRING); + } + + /** + * Where to send the user to verify. + * + * @return the URL + */ + public Optional verificationUrl() { + return optional("verification_url", Conv.STRING); + } + + /** + * Seconds until the verification link expires. + * + * @return the lifetime + */ + public Optional expiresIn() { + return optional("expires_in", Conv.LONG); + } + + /** + * When the step-up was created. + * + * @return the time + */ + public Optional createdAt() { + return optional("created_at", Conv.DATE_TIME); + } + + /** + * When the step-up finished. + * + * @return the time + */ + public Optional completedAt() { + return optional("completed_at", Conv.DATE_TIME); + } + + /** + * When the step-up expires. + * + * @return the time + */ + public Optional expiresAt() { + return optional("expires_at", Conv.DATE_TIME); + } +} diff --git a/src/main/java/me/didit/authentication/StepUpParams.java b/src/main/java/me/didit/authentication/StepUpParams.java new file mode 100644 index 0000000..0ab03d1 --- /dev/null +++ b/src/main/java/me/didit/authentication/StepUpParams.java @@ -0,0 +1,126 @@ +package me.didit.authentication; + +import java.math.BigDecimal; +import java.util.Objects; +import java.util.Optional; +import java.util.regex.Pattern; +import org.jspecify.annotations.Nullable; + +/** + * What a step-up protects: {@code action} ({@code payout}, {@code bank} or {@code contact}), the + * amount for payouts, and where the user returns after verifying. + * + *

{@code
+ * StepUpParams.builder("payout").amount("250.00").currency("EUR")
+ *     .returnTo("https://app.example.com/payouts").build();
+ * }
+ */ +public final class StepUpParams { + private static final Pattern AMOUNT = Pattern.compile("-?[0-9]+(\\.[0-9]+)?"); + + private final String action; + private final @Nullable String amount; + private final @Nullable String currency; + private final @Nullable String returnTo; + + private StepUpParams(Builder b) { + this.action = b.action; + this.amount = b.amount; + this.currency = b.currency; + this.returnTo = b.returnTo; + } + + /** + * Starts the parameters. + * + * @param action {@code payout}, {@code bank} or {@code contact} + * @return a new builder + */ + public static Builder builder(String action) { + return new Builder(action); + } + + String action() { + return action; + } + + Optional amount() { + return Optional.ofNullable(amount); + } + + Optional currency() { + return Optional.ofNullable(currency); + } + + Optional returnTo() { + return Optional.ofNullable(returnTo); + } + + /** Builds {@link StepUpParams}. */ + public static final class Builder { + private final String action; + private @Nullable String amount; + private @Nullable String currency; + private @Nullable String returnTo; + + private Builder(String action) { + this.action = Objects.requireNonNull(action, "action"); + } + + /** + * The amount, required for {@code payout}. + * + * @param amount a decimal such as {@code 250.00} + * @return this builder + */ + public Builder amount(String amount) { + if (!AMOUNT.matcher(amount).matches()) { + throw new IllegalArgumentException("amount must be a decimal number such as 250.00"); + } + this.amount = amount; + return this; + } + + /** + * The amount, required for {@code payout}. + * + * @param amount the amount + * @return this builder + */ + public Builder amount(BigDecimal amount) { + return amount(amount.toPlainString()); + } + + /** + * The ISO 4217 currency, for example {@code EUR}. + * + * @param currency the currency + * @return this builder + */ + public Builder currency(String currency) { + this.currency = Objects.requireNonNull(currency, "currency"); + return this; + } + + /** + * Where the user returns after verifying. Didit requires it today, and it must be one of the + * application's registered redirect URIs. + * + * @param returnTo the URL + * @return this builder + */ + public Builder returnTo(String returnTo) { + this.returnTo = Objects.requireNonNull(returnTo, "returnTo"); + return this; + } + + /** + * Builds the parameters. + * + * @return the parameters + */ + public StepUpParams build() { + return new StepUpParams(this); + } + } +} diff --git a/src/main/java/me/didit/authentication/TokenClaims.java b/src/main/java/me/didit/authentication/TokenClaims.java new file mode 100644 index 0000000..f271272 --- /dev/null +++ b/src/main/java/me/didit/authentication/TokenClaims.java @@ -0,0 +1,165 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import me.didit.core.Conv; + +/** The claims every Didit Authentication token carries. */ +public abstract class TokenClaims extends JsonView { + TokenClaims(ObjectNode json) { + super(json); + } + + /** + * {@code iss}: the application's issuer. + * + * @return the issuer + */ + public final String issuer() { + return optional("iss", Conv.STRING).orElse(""); + } + + /** + * {@code sub}: the identity id, stable per user of the application. + * + * @return the subject + */ + public final String subject() { + return optional("sub", Conv.STRING).orElse(""); + } + + /** + * {@code aud}: the audiences, the application id today. + * + * @return the audiences + */ + public final List audience() { + return audiences(json); + } + + static List audiences(ObjectNode json) { + JsonNode aud = json.get("aud"); + if (aud == null || aud.isNull()) { + return List.of(); + } + if (aud.isTextual()) { + return List.of(aud.textValue()); + } + List out = new ArrayList<>(); + if (aud.isArray()) { + for (JsonNode item : aud) { + if (item.isTextual()) { + out.add(item.textValue()); + } + } + } + return Collections.unmodifiableList(out); + } + + /** + * {@code sid}: the session id; use it with {@link Authentication#getSession}. + * + * @return the session id + */ + public final Optional sessionId() { + return optional("sid", Conv.STRING); + } + + /** + * {@code jti}: the unique token id. + * + * @return the token id + */ + public final Optional tokenId() { + return optional("jti", Conv.STRING); + } + + /** + * {@code iat}: when the token was issued. + * + * @return the time + */ + public final Instant issuedAt() { + return instant("iat").orElse(Instant.EPOCH); + } + + /** + * {@code exp}: when the token expires. + * + * @return the time + */ + public final Instant expiresAt() { + return instant("exp").orElse(Instant.EPOCH); + } + + /** + * {@code nbf}: when the token becomes valid, if the token says. + * + * @return the time + */ + public final Optional notBefore() { + return instant("nbf"); + } + + final Optional instant(String claim) { + return optional(claim, Conv.DOUBLE) + .map(seconds -> Instant.ofEpochMilli((long) (seconds * 1000))); + } + + /** + * {@code vendor_data}: your reference for the user. + * + * @return the vendor data + */ + public final Optional vendorData() { + return optional("vendor_data", Conv.STRING); + } + + /** + * {@code amr}: how the user signed in, for example {@code passkey}. + * + * @return the methods + */ + public final List authenticationMethods() { + return optional("amr", Conv.list(Conv.STRING)).orElse(List.of()); + } + + /** + * {@code org}: the active organization and the user's role in it. + * + * @return the organization + */ + public final Optional organization() { + return objectClaim("org").map(OrganizationClaim::new); + } + + /** + * {@code verified}: the verified identity claims; empty when the user has none. + * + * @return the verified claims + */ + public final Optional verified() { + return objectClaim("verified").filter(o -> o.size() > 0).map(VerifiedClaims::new); + } + + /** + * {@code act}: the agent acting for the user, for agent tokens. + * + * @return the actor + */ + public final Optional actor() { + return objectClaim("act").map(ActorClaim::new); + } + + private Optional objectClaim(String name) { + JsonNode value = json.get(name); + return value != null && value.isObject() + ? Optional.of(((ObjectNode) value).deepCopy()) + : Optional.empty(); + } +} diff --git a/src/main/java/me/didit/authentication/TokenResponse.java b/src/main/java/me/didit/authentication/TokenResponse.java new file mode 100644 index 0000000..f70cca9 --- /dev/null +++ b/src/main/java/me/didit/authentication/TokenResponse.java @@ -0,0 +1,70 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** + * The tokens from {@link Authentication#exchangeCode} or {@link Authentication#refresh}. {@link + * #toString()} never prints them. + */ +public final class TokenResponse extends JsonView { + TokenResponse(ObjectNode json) { + super(json); + } + + /** + * The access token (an ES256 JWT, valid for up to 5 minutes). + * + * @return the access token + */ + public String accessToken() { + return optional("access_token", Conv.STRING).orElse(""); + } + + /** + * The ID token; verify it with {@link Authentication#verifyIdToken}. + * + * @return the ID token + */ + public Optional idToken() { + return optional("id_token", Conv.STRING); + } + + /** + * The refresh token. Each one works once: a refresh returns a new one, and reusing a consumed + * refresh token revokes the session. + * + * @return the refresh token + */ + public Optional refreshToken() { + return optional("refresh_token", Conv.STRING); + } + + /** + * {@code Bearer}. + * + * @return the token type + */ + public Optional tokenType() { + return optional("token_type", Conv.STRING); + } + + /** + * Seconds until the access token expires. + * + * @return the lifetime + */ + public Optional expiresIn() { + return optional("expires_in", Conv.LONG); + } + + /** + * The session the tokens belong to. + * + * @return the session id + */ + public Optional sessionId() { + return optional("session_id", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/authentication/VerifiedClaims.java b/src/main/java/me/didit/authentication/VerifiedClaims.java new file mode 100644 index 0000000..96d2bfb --- /dev/null +++ b/src/main/java/me/didit/authentication/VerifiedClaims.java @@ -0,0 +1,104 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** + * The {@code verified} claim: what Didit verified about the user. Fields are present when shared. + */ +public final class VerifiedClaims extends JsonView { + VerifiedClaims(ObjectNode json) { + super(json); + } + + /** + * {@code liveness}, {@code liveness_face_match} or {@code full_id}. + * + * @return the level + */ + public Optional level() { + return optional("level", Conv.STRING); + } + + /** + * Whether the user is at least 18. + * + * @return the answer, when shared + */ + public Optional over18() { + return optional("over_18", Conv.BOOLEAN); + } + + /** + * Whether the user is at least 21. + * + * @return the answer, when shared + */ + public Optional over21() { + return optional("over_21", Conv.BOOLEAN); + } + + /** + * The given name from the document. + * + * @return the name + */ + public Optional givenName() { + return optional("given_name", Conv.STRING); + } + + /** + * The family name from the document. + * + * @return the name + */ + public Optional familyName() { + return optional("family_name", Conv.STRING); + } + + /** + * The date of birth, as sent ({@code YYYY-MM-DD}). + * + * @return the date + */ + public Optional birthdate() { + return optional("birthdate", Conv.STRING); + } + + /** + * The nationality. + * + * @return the country code + */ + public Optional nationality() { + return optional("nationality", Conv.STRING); + } + + /** + * The country. + * + * @return the country code + */ + public Optional country() { + return optional("country", Conv.STRING); + } + + /** + * Whether an identity document was verified. + * + * @return the answer, when shared + */ + public Optional documentVerified() { + return optional("document_verified", Conv.BOOLEAN); + } + + /** + * Whether a liveness check passed. + * + * @return the answer, when shared + */ + public Optional liveness() { + return optional("liveness", Conv.BOOLEAN); + } +} diff --git a/src/main/java/me/didit/authentication/package-info.java b/src/main/java/me/didit/authentication/package-info.java new file mode 100644 index 0000000..4138a3e --- /dev/null +++ b/src/main/java/me/didit/authentication/package-info.java @@ -0,0 +1,9 @@ +/** + * Didit Authentication for your backend (DESIGN 10): verify access and ID tokens, exchange + * authorization codes, refresh tokens, check sessions and run step-up verification. Start with + * {@link me.didit.authentication.Authentication}. + */ +@NullMarked +package me.didit.authentication; + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/me/didit/core/ApiClient.java b/src/main/java/me/didit/core/ApiClient.java new file mode 100644 index 0000000..7283264 --- /dev/null +++ b/src/main/java/me/didit/core/ApiClient.java @@ -0,0 +1,691 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.net.ConnectException; +import java.net.NoRouteToHostException; +import java.net.URI; +import java.net.UnknownHostException; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpTimeoutException; +import java.nio.channels.UnresolvedAddressException; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import javax.net.ssl.SSLHandshakeException; +import me.didit.errors.ApiConnectionException; +import me.didit.errors.ApiStatusException; +import me.didit.errors.ApiTimeoutException; +import me.didit.errors.ConfigurationException; +import me.didit.errors.DiditException; +import me.didit.errors.UnexpectedResponseException; +import org.jspecify.annotations.Nullable; + +/** + * Sends API requests: credentials, headers, retries, timeouts, errors and logging (DESIGN 6 and 7). + * Shared by every resource of a client; thread-safe. Used by the generated resources, not meant for + * direct use. + */ +public final class ApiClient { + static final Duration INITIAL_BACKOFF = Duration.ofMillis(500); + static final Duration MAX_BACKOFF = Duration.ofSeconds(8); + static final Duration MAX_RETRY_AFTER = Duration.ofSeconds(60); + private static final System.Logger LOGGER = System.getLogger("me.didit"); + + private final ClientOptions options; + + /** + * Creates the client. + * + * @param options the client options + */ + public ApiClient(ClientOptions options) { + this.options = options; + } + + /** + * The client options. + * + * @return the options + */ + public ClientOptions options() { + return options; + } + + /** + * Sends a request and waits for the result. + * + * @param the result type + * @param request what to send + * @param requestOptions per-request overrides + * @param handler parses a successful response + * @return the parsed response + * @throws DiditException when the request fails + */ + public RawResponse execute( + ApiRequest request, RequestOptions requestOptions, ResponseHandler handler) { + return await(executeAsync(request, requestOptions, handler)); + } + + /** + * Sends a request. + * + * @param the result type + * @param request what to send + * @param requestOptions per-request overrides + * @param handler parses a successful response + * @return a future completed with the parsed response, or with a {@link DiditException} + */ + public CompletableFuture> executeAsync( + ApiRequest request, RequestOptions requestOptions, ResponseHandler handler) { + return send(request, requestOptions, handler, null); + } + + CompletableFuture> send( + ApiRequest request, + RequestOptions requestOptions, + ResponseHandler handler, + @Nullable URI target) { + Prepared prepared; + try { + prepared = prepare(request, requestOptions, handler.streaming(), target); + } catch (RuntimeException e) { + return CompletableFuture.failedFuture(e); + } + CompletableFuture> result = new CompletableFuture<>(); + attempt(prepared, request, requestOptions, handler, 0, System.nanoTime(), result); + return result; + } + + static T await(CompletableFuture future) { + try { + return future.get(); + } catch (InterruptedException e) { + future.cancel(true); + Thread.currentThread().interrupt(); + throw new ApiConnectionException("Interrupted while waiting for the response", e); + } catch (ExecutionException e) { + throw rethrow(e.getCause()); + } + } + + static RuntimeException rethrow(@Nullable Throwable cause) { + Throwable t = cause; + while ((t instanceof CompletionException || t instanceof ExecutionException) + && t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof RuntimeException) { + return (RuntimeException) t; + } + if (t instanceof Error) { + throw (Error) t; + } + return new DiditException("Request failed", t); + } + + // -- preparation ------------------------------------------------------------- + + static final class Prepared { + final String method; + final URI uri; + final Map> headers; + final byte[] body; + final Duration timeout; + final int maxRetries; + final boolean streaming; + final String logPath; + + Prepared( + String method, + URI uri, + Map> headers, + byte[] body, + Duration timeout, + int maxRetries, + boolean streaming, + String logPath) { + this.method = method; + this.uri = uri; + this.headers = headers; + this.body = body; + this.timeout = timeout; + this.maxRetries = maxRetries; + this.streaming = streaming; + this.logPath = logPath; + } + } + + URI baseFor(ApiRequest request) { + return request.api == ApiRequest.Api.ACCOUNT ? options.accountBaseUrl() : options.baseUrl(); + } + + Prepared prepare(ApiRequest request, RequestOptions ro, boolean streaming, @Nullable URI target) { + URI base = baseFor(request); + Map> headers = new LinkedHashMap<>(); + put( + headers, + "Accept", + request.accept == null ? "application/json" : request.accept + ", application/json"); + put(headers, "User-Agent", Platform.userAgent()); + put(headers, "X-Didit-Client", "java/" + Version.VERSION); + switch (request.auth) { + case API_KEY: + String apiKey = + ro.apiKey() + .or(options::apiKey) + .orElseThrow( + () -> + new ConfigurationException( + "No API key: pass apiKey(...) to the client or set DIDIT_API_KEY")); + put(headers, "x-api-key", apiKey); + break; + case ACCOUNT_TOKEN: + String token = + ro.accountToken() + .or(options::accountToken) + .orElseThrow( + () -> + new ConfigurationException( + "No account token: pass accountToken(...) with the token from" + + " account().login(...)")); + put(headers, "Authorization", "Bearer " + token); + break; + case NONE: + break; + } + + String path = Paths.expand(request, ro, options); + ObjectNode fields = + request.params == null ? Json.MAPPER.createObjectNode() : request.params.json.deepCopy(); + Map> files = + request.params == null ? Map.of() : request.params._files(); + + for (Map.Entry header : request.headerFields.entrySet()) { + JsonNode value = fields.remove(header.getValue()); + if (value != null && !value.isNull()) { + put(headers, header.getKey(), value.isTextual() ? value.asText() : value.toString()); + } + } + List query = new ArrayList<>(); + for (Map.Entry queryField : request.queryFields.entrySet()) { + JsonNode value = fields.remove(queryField.getValue()); + if (value != null && !value.isNull()) { + addQuery(query, queryField.getKey(), value); + } + } + for (Map.Entry extra : ro.queryParams().entrySet()) { + query.add(new String[] {extra.getKey(), extra.getValue()}); + } + + URI uri; + if (target != null) { + uri = Paths.sameOrigin(base, target); + } else { + uri = URI.create(base.toString() + path + Paths.queryString(query)); + } + + byte[] body = new byte[0]; + ApiRequest.BodyEncoding encoding = request.bodyEncoding; + if (encoding == ApiRequest.BodyEncoding.JSON_OR_MULTIPART) { + encoding = files.isEmpty() ? ApiRequest.BodyEncoding.JSON : ApiRequest.BodyEncoding.MULTIPART; + } + if (encoding == ApiRequest.BodyEncoding.JSON) { + body = Json.writeBytes(fields); + put(headers, "Content-Type", "application/json"); + } else if (encoding == ApiRequest.BodyEncoding.MULTIPART) { + Multipart multipart = Multipart.encode(fields, files); + body = multipart.body(); + put(headers, "Content-Type", multipart.contentType()); + } + + for (Map.Entry header : options.defaultHeaders().entrySet()) { + replace(headers, header.getKey(), header.getValue()); + } + ro.idempotencyKey().ifPresent(key -> replace(headers, "Idempotency-Key", key)); + for (Map.Entry header : ro.headers().entrySet()) { + replace(headers, header.getKey(), header.getValue()); + } + return new Prepared( + request.method, + uri, + headers, + body, + ro.timeout().orElse(options.timeout()), + ro.maxRetries().orElse(options.maxRetries()), + streaming, + request.method + " " + uri.getRawPath()); + } + + private static void addQuery(List query, String field, JsonNode value) { + if (value.isArray()) { + for (JsonNode item : value) { + if (!item.isNull()) { + addQuery(query, field, item); + } + } + } else if (value.isTextual()) { + query.add(new String[] {field, value.asText()}); + } else if (value.isNumber()) { + query.add(new String[] {field, value.decimalValue().toPlainString()}); + } else { + query.add(new String[] {field, value.toString()}); + } + } + + private static void put(Map> headers, String name, String value) { + headers.computeIfAbsent(name, k -> new ArrayList<>()).add(value); + } + + private static void replace(Map> headers, String name, String value) { + headers.keySet().removeIf(k -> k.equalsIgnoreCase(name)); + put(headers, name, value); + } + + // -- sending ----------------------------------------------------------------- + + private void attempt( + Prepared prepared, + ApiRequest request, + RequestOptions ro, + ResponseHandler handler, + int retry, + long started, + CompletableFuture> result) { + if (result.isDone()) { + return; // cancelled by the caller + } + TransportRequest transportRequest = + new TransportRequest( + prepared.method, + prepared.uri, + prepared.headers, + prepared.body, + prepared.timeout, + prepared.streaming); + CompletableFuture sent; + try { + sent = options.transport().send(transportRequest); + } catch (RuntimeException e) { + sent = CompletableFuture.failedFuture(e); + } + CompletableFuture inFlight = sent; + CompletableFuture unused = + result.whenComplete( + (r, e) -> { + if (e instanceof CancellationException) { + inFlight.cancel(true); + } + }); + CompletableFuture unusedAttempt = + sent.orTimeout(prepared.timeout.toMillis() + 50, TimeUnit.MILLISECONDS) + .whenComplete( + (response, error) -> { + if (error != null) { + inFlight.cancel(true); + onFailure(prepared, request, ro, handler, retry, started, result, error); + } else { + onResponse(prepared, request, ro, handler, retry, started, result, response); + } + }); + } + + private void onFailure( + Prepared prepared, + ApiRequest request, + RequestOptions ro, + ResponseHandler handler, + int retry, + long started, + CompletableFuture> result, + Throwable error) { + Throwable cause = unwrap(error); + boolean timeout = cause instanceof TimeoutException || cause instanceof HttpTimeoutException; + boolean beforeSending = RetryPolicy.failedBeforeSending(cause); + boolean retryable = beforeSending || request.idempotent(); + if (!(cause instanceof IOException) && !(cause instanceof TimeoutException)) { + retryable = false; // a bug or a misconfigured transport, not a network failure + } + if (retryable && retry < prepared.maxRetries) { + scheduleRetry(prepared, request, ro, handler, retry, started, result, Optional.empty()); + return; + } + DiditException failure; + if (timeout && !(cause instanceof HttpConnectTimeoutException)) { + failure = + new ApiTimeoutException( + "Request timed out after " + prepared.timeout.toMillis() + " ms: " + prepared.logPath, + cause); + } else if (cause instanceof IOException || cause instanceof TimeoutException) { + failure = + new ApiConnectionException( + "Connection error on " + prepared.logPath + ": " + describe(cause), cause); + } else if (cause instanceof DiditException) { + failure = (DiditException) cause; + } else { + failure = new ApiConnectionException("Request failed: " + prepared.logPath, cause); + } + log(prepared, retry, started, failure.getClass().getSimpleName(), Optional.empty()); + result.completeExceptionally(failure); + } + + private void onResponse( + Prepared prepared, + ApiRequest request, + RequestOptions ro, + ResponseHandler handler, + int retry, + long started, + CompletableFuture> result, + TransportResponse response) { + int status = response.statusCode(); + Headers headers = response.headers(); + if (status >= 200 && status < 300) { + log(prepared, retry, started, Integer.toString(status), headers.requestId()); + try { + SuccessResponse success = + new SuccessResponse(this, request, ro, prepared.uri, response, handler.streaming()); + T data = handler.handle(success); + result.complete(new RawResponse<>(status, headers, data)); + } catch (RuntimeException e) { + response.close(); + result.completeExceptionally(e); + } catch (IOException e) { + response.close(); + result.completeExceptionally( + new ApiConnectionException("Failed to read the response of " + prepared.logPath, e)); + } + return; + } + if (RetryPolicy.retryableStatus(status, request.idempotent()) && retry < prepared.maxRetries) { + response.close(); + scheduleRetry( + prepared, + request, + ro, + handler, + retry, + started, + result, + headers.firstValue("Retry-After")); + return; + } + byte[] bytes; + try { + bytes = response.readBody(); + } catch (IOException e) { + bytes = new byte[0]; + } + JsonNode body = null; + if (bytes.length > 0) { + try { + body = Json.parse(bytes); + } catch (UnexpectedResponseException e) { + body = Json.nodes().textNode(new String(bytes, StandardCharsets.UTF_8)); + } + } + log(prepared, retry, started, Integer.toString(status), headers.requestId()); + result.completeExceptionally( + ApiStatusException.create(status, body, headers, prepared.logPath)); + } + + private void scheduleRetry( + Prepared prepared, + ApiRequest request, + RequestOptions ro, + ResponseHandler handler, + int retry, + long started, + CompletableFuture> result, + Optional retryAfter) { + Duration delay = + RetryPolicy.delay(retry, retryAfter, ThreadLocalRandom.current().nextDouble(), now()); + if (options.debugLogging()) { + LOGGER.log( + System.Logger.Level.INFO, + "didit: retrying {0} in {1} ms (retry {2} of {3})", + prepared.logPath, + delay.toMillis(), + retry + 1, + prepared.maxRetries); + } + CompletableFuture unused = + CompletableFuture.runAsync( + () -> attempt(prepared, request, ro, handler, retry + 1, started, result), + options.scheduler().after(delay)); + } + + static ZonedDateTime now() { + return ZonedDateTime.now(java.time.ZoneOffset.UTC); + } + + private void log( + Prepared prepared, int retry, long started, String outcome, Optional requestId) { + if (!options.debugLogging()) { + return; + } + long millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - started); + LOGGER.log( + System.Logger.Level.INFO, + "didit: {0} -> {1} in {2} ms, retries {3}, request id {4}", + prepared.logPath, + outcome, + millis, + retry, + requestId.orElse("none")); + } + + private static Throwable unwrap(Throwable error) { + Throwable t = error; + while ((t instanceof CompletionException || t instanceof ExecutionException) + && t.getCause() != null) { + t = t.getCause(); + } + return t; + } + + private static String describe(Throwable cause) { + String message = cause.getMessage(); + return cause.getClass().getSimpleName() + (message == null ? "" : " (" + message + ")"); + } + + /** Retry decisions (DESIGN 7). */ + static final class RetryPolicy { + private RetryPolicy() {} + + /** True when the request certainly did not reach the server. */ + static boolean failedBeforeSending(Throwable cause) { + for (Throwable t = cause; t != null; t = t.getCause()) { + if (t instanceof HttpConnectTimeoutException + || t instanceof ConnectException + || t instanceof UnknownHostException + || t instanceof NoRouteToHostException + || t instanceof UnresolvedAddressException + || t instanceof SSLHandshakeException) { + return true; + } + } + return false; + } + + /** 408, 429 and 5xx for idempotent methods; only 429 for POST and PATCH. */ + static boolean retryableStatus(int status, boolean idempotent) { + if (status == 429) { + return true; + } + return idempotent && (status == 408 || status >= 500); + } + + /** + * The wait before retry number {@code retry + 1}: {@code Retry-After} when valid (capped at 60 + * s), otherwise exponential backoff from 0.5 s with full jitter, capped at 8 s. + */ + static Duration delay( + int retry, Optional retryAfter, double jitter, ZonedDateTime now) { + Optional fromHeader = retryAfter.flatMap(value -> parseRetryAfter(value, now)); + if (fromHeader.isPresent()) { + Duration d = fromHeader.get(); + return d.compareTo(MAX_RETRY_AFTER) > 0 ? MAX_RETRY_AFTER : d; + } + double ceiling = + Math.min( + (double) MAX_BACKOFF.toMillis(), + (double) INITIAL_BACKOFF.toMillis() * Math.pow(2, Math.min(retry, 20))); + return Duration.ofMillis((long) (ceiling * jitter)); + } + + static Optional parseRetryAfter(String value, ZonedDateTime now) { + String v = value.trim(); + try { + double seconds = Double.parseDouble(v); + if (seconds >= 0 && !Double.isInfinite(seconds) && !Double.isNaN(seconds)) { + return Optional.of(Duration.ofMillis((long) (seconds * 1000))); + } + return Optional.empty(); + } catch (NumberFormatException e) { + // Not seconds; maybe an HTTP date. + } + try { + ZonedDateTime at = ZonedDateTime.parse(v, DateTimeFormatter.RFC_1123_DATE_TIME); + Duration d = Duration.between(now, at); + return Optional.of(d.isNegative() ? Duration.ZERO : d); + } catch (DateTimeParseException e) { + return Optional.empty(); + } + } + } + + /** Paths, query strings and origins. */ + static final class Paths { + private Paths() {} + + static String expand(ApiRequest request, RequestOptions ro, ClientOptions options) { + Map values = new LinkedHashMap<>(request.pathParams); + if (request.applicationScoped) { + Optional org = ro.organizationId().or(options::organizationId); + Optional app = ro.applicationId().or(options::applicationId); + if (org.isEmpty() || app.isEmpty()) { + throw new ConfigurationException( + request.describe() + + " is application scoped: set organizationId and applicationId on the client" + + " (or DIDIT_ORGANIZATION_ID and DIDIT_APPLICATION_ID)"); + } + values.put("organization_id", org.get()); + values.put("application_id", app.get()); + } + StringBuilder out = new StringBuilder(); + String template = request.pathTemplate; + int i = 0; + while (i < template.length()) { + int open = template.indexOf('{', i); + if (open < 0) { + out.append(template, i, template.length()); + break; + } + int close = template.indexOf('}', open); + out.append(template, i, open); + String name = template.substring(open + 1, close); + String value = values.get(name); + if (value == null) { + throw new ConfigurationException("Missing path parameter '" + name + "'"); + } + out.append(segment(name, value)); + i = close + 1; + } + return out.toString(); + } + + static String segment(String name, String value) { + if (value.isEmpty() || value.equals(".") || value.equals("..")) { + throw new ConfigurationException( + "Path parameter '" + name + "' must not be empty, '.' or '..'"); + } + return encode(value); + } + + static String encode(String value) { + StringBuilder out = new StringBuilder(); + for (byte b : value.getBytes(StandardCharsets.UTF_8)) { + int c = b & 0xff; + if ((c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c >= '0' && c <= '9') + || c == '-' + || c == '.' + || c == '_' + || c == '~') { + out.append((char) c); + } else { + out.append('%').append(String.format(Locale.ROOT, "%02X", c)); + } + } + return out.toString(); + } + + static String queryString(List query) { + if (query.isEmpty()) { + return ""; + } + StringBuilder out = new StringBuilder("?"); + for (String[] pair : query) { + if (out.length() > 1) { + out.append('&'); + } + out.append(encode(pair[0])).append('=').append(encode(pair[1])); + } + return out.toString(); + } + + /** + * Resolves a next-page link against the base URL. The link must point to the same host and + * port; the base scheme is kept, so a plain-http link from a proxy never downgrades the call. + */ + static URI sameOrigin(URI base, URI link) { + URI resolved = base.resolve(link); + String host = resolved.getHost(); + if (host == null + || !host.equalsIgnoreCase(base.getHost()) + || (port(resolved) != port(base) && !(isDefault(resolved) && isDefault(base)))) { + throw new UnexpectedResponseException( + "Refusing to follow a next page link to another origin: " + + resolved.getScheme() + + "://" + + resolved.getAuthority()); + } + String query = resolved.getRawQuery(); + return URI.create( + base.getScheme() + + "://" + + base.getRawAuthority() + + resolved.getRawPath() + + (query == null ? "" : "?" + query)); + } + + private static int port(URI uri) { + if (uri.getPort() != -1) { + return uri.getPort(); + } + return "http".equalsIgnoreCase(uri.getScheme()) ? 80 : 443; + } + + private static boolean isDefault(URI uri) { + return uri.getPort() == -1; + } + } +} diff --git a/src/main/java/me/didit/core/ApiRequest.java b/src/main/java/me/didit/core/ApiRequest.java new file mode 100644 index 0000000..b6c31a5 --- /dev/null +++ b/src/main/java/me/didit/core/ApiRequest.java @@ -0,0 +1,235 @@ +package me.didit.core; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jspecify.annotations.Nullable; + +/** + * The description of one API call, built by the generated resources. Not meant for direct use; its + * shape may change between minor versions. + */ +public final class ApiRequest { + /** Which API the call goes to. */ + public enum Api { + /** {@code https://verification.didit.me}. */ + VERIFICATION, + /** {@code https://apx.didit.me/auth/v2}. */ + ACCOUNT + } + + /** The credentials the call sends. */ + public enum Auth { + /** {@code x-api-key}. */ + API_KEY, + /** {@code Authorization: Bearer} with the account token. */ + ACCOUNT_TOKEN, + /** No credentials. */ + NONE + } + + /** How the parameters that are not query or header parameters are sent. */ + public enum BodyEncoding { + /** No body. */ + NONE, + /** {@code application/json}. */ + JSON, + /** {@code multipart/form-data}. */ + MULTIPART, + /** Multipart when a file is set, JSON otherwise. */ + JSON_OR_MULTIPART + } + + final String method; + final String pathTemplate; + final Api api; + final Auth auth; + final boolean applicationScoped; + final Map pathParams; + final @Nullable JsonModel params; + final Map queryFields; + final Map headerFields; + final BodyEncoding bodyEncoding; + final @Nullable String accept; + + private ApiRequest(Builder b) { + this.method = b.method; + this.pathTemplate = b.pathTemplate; + this.api = b.api; + this.auth = b.auth; + this.applicationScoped = b.applicationScoped; + this.pathParams = Collections.unmodifiableMap(new LinkedHashMap<>(b.pathParams)); + this.params = b.params; + this.queryFields = Collections.unmodifiableMap(new LinkedHashMap<>(b.queryFields)); + this.headerFields = Collections.unmodifiableMap(new LinkedHashMap<>(b.headerFields)); + this.bodyEncoding = b.params == null ? BodyEncoding.NONE : b.bodyEncoding; + this.accept = b.accept; + } + + /** + * Starts a request description. + * + * @param method the HTTP method + * @param pathTemplate the path with {@code {name}} placeholders + * @return a new builder + */ + public static Builder builder(String method, String pathTemplate) { + return new Builder(method, pathTemplate); + } + + /** {@code METHOD /path/template}, for messages and logs. */ + String describe() { + return method + " " + pathTemplate; + } + + boolean idempotent() { + return method.equals("GET") + || method.equals("HEAD") + || method.equals("PUT") + || method.equals("DELETE") + || method.equals("OPTIONS"); + } + + /** Builds an {@link ApiRequest}. */ + public static final class Builder { + private final String method; + private final String pathTemplate; + private Api api = Api.VERIFICATION; + private Auth auth = Auth.API_KEY; + private boolean applicationScoped; + private final Map pathParams = new LinkedHashMap<>(); + private @Nullable JsonModel params; + private final Map queryFields = new LinkedHashMap<>(); + private final Map headerFields = new LinkedHashMap<>(); + private BodyEncoding bodyEncoding = BodyEncoding.NONE; + private @Nullable String accept; + + private Builder(String method, String pathTemplate) { + this.method = Objects.requireNonNull(method, "method"); + this.pathTemplate = Objects.requireNonNull(pathTemplate, "pathTemplate"); + } + + /** + * Sends the call to the account management API. + * + * @return this builder + */ + public Builder account() { + this.api = Api.ACCOUNT; + return this; + } + + /** + * Sets the credentials. + * + * @param auth the credentials kind + * @return this builder + */ + public Builder auth(Auth auth) { + this.auth = auth; + return this; + } + + /** + * Fills {@code organization_id} and {@code application_id} from the options. + * + * @return this builder + */ + public Builder applicationScoped() { + this.applicationScoped = true; + return this; + } + + /** + * Sets a path parameter. Its value is percent-encoded as one path segment. + * + * @param name the placeholder name + * @param value the value + * @return this builder + */ + public Builder pathParam(String name, String value) { + pathParams.put(name, Objects.requireNonNull(value, name)); + return this; + } + + /** + * Sets the parameters object; its query and header fields are named separately. + * + * @param params the parameters, or {@code null} for none + * @return this builder + */ + public Builder params(@Nullable JsonModel params) { + this.params = params; + return this; + } + + /** + * Names the parameter fields sent in the query string. + * + * @param fields JSON field names + * @return this builder + */ + public Builder queryFields(String... fields) { + for (String field : fields) { + queryFields.put(field, field); + } + return this; + } + + /** + * Names a parameter field sent in the query string under another name. + * + * @param name the query parameter name + * @param field the JSON field name in the parameters + * @return this builder + */ + public Builder queryField(String name, String field) { + queryFields.put(name, field); + return this; + } + + /** + * Names a parameter field sent as a header. + * + * @param header the header name + * @param field the JSON field name + * @return this builder + */ + public Builder headerField(String header, String field) { + headerFields.put(header, field); + return this; + } + + /** + * Sets the body encoding of the remaining parameter fields. + * + * @param encoding the encoding + * @return this builder + */ + public Builder body(BodyEncoding encoding) { + this.bodyEncoding = encoding; + return this; + } + + /** + * Expects a binary response of this content type. + * + * @param contentType for example {@code application/pdf} + * @return this builder + */ + public Builder accept(String contentType) { + this.accept = contentType; + return this; + } + + /** + * Builds the description. + * + * @return the request + */ + public ApiRequest build() { + return new ApiRequest(this); + } + } +} diff --git a/src/main/java/me/didit/core/BinaryResponse.java b/src/main/java/me/didit/core/BinaryResponse.java new file mode 100644 index 0000000..f8a214d --- /dev/null +++ b/src/main/java/me/didit/core/BinaryResponse.java @@ -0,0 +1,136 @@ +package me.didit.core; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Locale; +import java.util.Optional; + +/** + * A binary response such as a PDF report or a CSV template (DESIGN 8). Read it once with {@link + * #bytes()}, {@link #writeTo(Path)} or {@link #stream()}; close it when you stream. + */ +public final class BinaryResponse implements AutoCloseable { + private final Headers headers; + private final InputStream body; + private boolean consumed; + + BinaryResponse(Headers headers, InputStream body) { + this.headers = headers; + this.body = body; + } + + /** + * Creates a response, for tests. + * + * @param headers the response headers + * @param body the content + * @return the response + */ + public static BinaryResponse of(Headers headers, byte[] body) { + return new BinaryResponse(headers, new java.io.ByteArrayInputStream(body.clone())); + } + + /** + * The content type, for example {@code application/pdf}. + * + * @return the content type, if the response declared one + */ + public Optional contentType() { + return headers.firstValue("Content-Type"); + } + + /** + * The file name from {@code Content-Disposition}, if any. + * + * @return the file name + */ + public Optional fileName() { + String disposition = headers.firstValue("Content-Disposition").orElse(""); + for (String part : disposition.split(";", -1)) { + String p = part.trim(); + if (p.toLowerCase(Locale.ROOT).startsWith("filename=")) { + String name = p.substring("filename=".length()).trim(); + if (name.length() >= 2 && name.startsWith("\"") && name.endsWith("\"")) { + name = name.substring(1, name.length() - 1); + } + return name.isEmpty() ? Optional.empty() : Optional.of(name); + } + } + return Optional.empty(); + } + + /** + * The response headers. + * + * @return the headers + */ + public Headers headers() { + return headers; + } + + /** + * Reads the whole content and closes the response. + * + * @return the content + * @throws UncheckedIOException when reading fails + */ + public synchronized byte[] bytes() { + claim(); + try (InputStream in = body) { + return in.readAllBytes(); + } catch (IOException e) { + throw new UncheckedIOException("Failed to read the response body", e); + } + } + + /** + * Writes the content to a file, replacing it, and closes the response. + * + * @param path the target file + * @return the number of bytes written + * @throws UncheckedIOException when reading or writing fails + */ + public synchronized long writeTo(Path path) { + claim(); + try (InputStream in = body) { + return Files.copy(in, path, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + throw new UncheckedIOException("Failed to write " + path, e); + } + } + + /** + * The content as a stream. Close the stream, or this response, when done. + * + * @return the stream + */ + public synchronized InputStream stream() { + claim(); + return body; + } + + private void claim() { + if (consumed) { + throw new IllegalStateException("The response body was already read"); + } + consumed = true; + } + + @Override + public void close() { + try { + body.close(); + } catch (IOException e) { + // Nothing to do: the body is discarded. + } + } + + @Override + public String toString() { + return "BinaryResponse{contentType=" + contentType().orElse("unknown") + "}"; + } +} diff --git a/src/main/java/me/didit/core/ClientOptions.java b/src/main/java/me/didit/core/ClientOptions.java new file mode 100644 index 0000000..96ced04 --- /dev/null +++ b/src/main/java/me/didit/core/ClientOptions.java @@ -0,0 +1,498 @@ +package me.didit.core; + +import java.net.InetAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.UnknownHostException; +import java.net.http.HttpClient; +import java.time.Duration; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; +import me.didit.errors.ConfigurationException; +import org.jspecify.annotations.Nullable; + +/** + * The configuration of a client (DESIGN 6). Immutable; build it with {@link #builder()}. + * + *

Unset values fall back to environment variables: {@code DIDIT_API_KEY}, {@code + * DIDIT_ORGANIZATION_ID}, {@code DIDIT_APPLICATION_ID} and {@code DIDIT_LOG=debug}. + */ +public final class ClientOptions { + /** The verification API. */ + public static final String DEFAULT_BASE_URL = "https://verification.didit.me"; + + /** The account management API. */ + public static final String DEFAULT_ACCOUNT_BASE_URL = "https://apx.didit.me/auth/v2"; + + /** The default timeout of each attempt. */ + public static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(60); + + /** The default number of retries. */ + public static final int DEFAULT_MAX_RETRIES = 2; + + private final @Nullable String apiKey; + private final @Nullable String accountToken; + private final URI baseUrl; + private final URI accountBaseUrl; + private final @Nullable String organizationId; + private final @Nullable String applicationId; + private final Duration timeout; + private final int maxRetries; + private final Map defaultHeaders; + private final HttpTransport transport; + private final boolean debugLogging; + private final Scheduler scheduler; + + private ClientOptions(Builder b, HttpTransport transport) { + Function env = b.environment; + this.apiKey = firstNonEmpty(b.apiKey, env.apply("DIDIT_API_KEY")); + this.accountToken = firstNonEmpty(b.accountToken, null); + this.organizationId = firstNonEmpty(b.organizationId, env.apply("DIDIT_ORGANIZATION_ID")); + this.applicationId = firstNonEmpty(b.applicationId, env.apply("DIDIT_APPLICATION_ID")); + this.baseUrl = baseUrl(b.baseUrl, "baseUrl"); + this.accountBaseUrl = baseUrl(b.accountBaseUrl, "accountBaseUrl"); + this.timeout = b.timeout; + this.maxRetries = b.maxRetries; + this.defaultHeaders = Collections.unmodifiableMap(new LinkedHashMap<>(b.defaultHeaders)); + this.transport = transport; + String log = env.apply("DIDIT_LOG"); + this.debugLogging = + b.debugLogging != null + ? b.debugLogging + : log != null && log.trim().toLowerCase(Locale.ROOT).equals("debug"); + this.scheduler = b.scheduler; + } + + /** + * Returns a builder with the defaults. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding these options, to derive a variant. + * + * @return a new builder + */ + public Builder toBuilder() { + Builder b = new Builder(); + b.apiKey = apiKey; + b.accountToken = accountToken; + b.organizationId = organizationId; + b.applicationId = applicationId; + b.baseUrl = baseUrl.toString(); + b.accountBaseUrl = accountBaseUrl.toString(); + b.timeout = timeout; + b.maxRetries = maxRetries; + b.defaultHeaders.putAll(defaultHeaders); + b.transport = transport; + b.debugLogging = debugLogging; + b.scheduler = scheduler; + b.environment = name -> null; + return b; + } + + /** + * The API key, sent as {@code x-api-key} to {@link #baseUrl()} only. + * + * @return the API key, if configured + */ + public Optional apiKey() { + return Optional.ofNullable(apiKey); + } + + /** + * The account token, sent as a Bearer token to {@link #accountBaseUrl()} only. + * + * @return the account token, if configured + */ + public Optional accountToken() { + return Optional.ofNullable(accountToken); + } + + /** + * The verification API base URL. + * + * @return the base URL + */ + public URI baseUrl() { + return baseUrl; + } + + /** + * The account management API base URL. + * + * @return the base URL + */ + public URI accountBaseUrl() { + return accountBaseUrl; + } + + /** + * The organization id used by application-scoped operations. + * + * @return the id, if configured + */ + public Optional organizationId() { + return Optional.ofNullable(organizationId); + } + + /** + * The application id used by application-scoped operations. + * + * @return the id, if configured + */ + public Optional applicationId() { + return Optional.ofNullable(applicationId); + } + + /** + * The timeout of each attempt. + * + * @return the timeout + */ + public Duration timeout() { + return timeout; + } + + /** + * How many times a failed request is retried. + * + * @return the number of retries + */ + public int maxRetries() { + return maxRetries; + } + + /** + * Headers sent with every request. + * + * @return header names to values + */ + public Map defaultHeaders() { + return defaultHeaders; + } + + /** + * The HTTP transport. + * + * @return the transport + */ + public HttpTransport transport() { + return transport; + } + + /** + * Whether every request is logged (method, path, status, duration and request id; never bodies or + * headers). + * + * @return true when debug logging is on + */ + public boolean debugLogging() { + return debugLogging; + } + + Scheduler scheduler() { + return scheduler; + } + + @Override + public String toString() { + return "ClientOptions{apiKey=" + + (apiKey == null ? "unset" : "[REDACTED]") + + ", accountToken=" + + (accountToken == null ? "unset" : "[REDACTED]") + + ", baseUrl=" + + baseUrl + + ", accountBaseUrl=" + + accountBaseUrl + + ", organizationId=" + + organizationId + + ", applicationId=" + + applicationId + + ", timeout=" + + timeout + + ", maxRetries=" + + maxRetries + + ", defaultHeaders=" + + defaultHeaders.keySet() + + "}"; + } + + private static @Nullable String firstNonEmpty(@Nullable String a, @Nullable String b) { + if (a != null && !a.trim().isEmpty()) { + return a.trim(); + } + if (b != null && !b.trim().isEmpty()) { + return b.trim(); + } + return null; + } + + private static URI baseUrl(String value, String option) { + URI uri; + try { + uri = new URI(value.endsWith("/") ? value.substring(0, value.length() - 1) : value); + } catch (URISyntaxException e) { + throw new ConfigurationException(option + " is not a valid URL"); + } + String scheme = uri.getScheme() == null ? "" : uri.getScheme().toLowerCase(Locale.ROOT); + if (uri.getHost() == null || !(scheme.equals("https") || scheme.equals("http"))) { + throw new ConfigurationException(option + " must be an absolute http(s) URL"); + } + if (scheme.equals("http") && !isLoopback(uri.getHost())) { + throw new ConfigurationException( + option + " must use https; plain http is only allowed for localhost"); + } + if (uri.getRawQuery() != null || uri.getRawFragment() != null) { + throw new ConfigurationException(option + " must not have a query or fragment"); + } + return uri; + } + + static boolean isLoopback(String host) { + String h = host.startsWith("[") ? host.substring(1, host.length() - 1) : host; + if (h.equalsIgnoreCase("localhost")) { + return true; + } + if (!h.matches("[0-9.]+") && !h.contains(":")) { + return false; // never resolve names here + } + try { + return InetAddress.getByName(h).isLoopbackAddress(); + } catch (UnknownHostException e) { + return false; + } + } + + static Duration positive(Duration value, String name) { + Objects.requireNonNull(value, name); + if (value.isNegative() || value.isZero()) { + throw new IllegalArgumentException(name + " must be positive"); + } + return value; + } + + static int nonNegative(int value, String name) { + if (value < 0) { + throw new IllegalArgumentException(name + " must not be negative"); + } + return value; + } + + /** Delays retries; replaced in tests. */ + interface Scheduler { + Executor after(Duration delay); + + Scheduler DEFAULT = + delay -> CompletableFuture.delayedExecutor(delay.toMillis(), TimeUnit.MILLISECONDS); + } + + /** Builds {@link ClientOptions}. */ + public static final class Builder { + private @Nullable String apiKey; + private @Nullable String accountToken; + private @Nullable String organizationId; + private @Nullable String applicationId; + private String baseUrl = DEFAULT_BASE_URL; + private String accountBaseUrl = DEFAULT_ACCOUNT_BASE_URL; + private Duration timeout = DEFAULT_TIMEOUT; + private int maxRetries = DEFAULT_MAX_RETRIES; + private final Map defaultHeaders = new LinkedHashMap<>(); + private @Nullable HttpTransport transport; + private @Nullable HttpClient httpClient; + private @Nullable Boolean debugLogging; + private Scheduler scheduler = Scheduler.DEFAULT; + private Function environment = System::getenv; + + private Builder() {} + + /** + * The API key. Defaults to {@code DIDIT_API_KEY}. + * + * @param apiKey the API key from the Business Console + * @return this builder + */ + public Builder apiKey(String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey"); + return this; + } + + /** + * The account token for {@code account} operations. + * + * @param accountToken the Bearer token from {@code account().login(...)} + * @return this builder + */ + public Builder accountToken(String accountToken) { + this.accountToken = Objects.requireNonNull(accountToken, "accountToken"); + return this; + } + + /** + * The organization id for application-scoped operations. Defaults to {@code + * DIDIT_ORGANIZATION_ID}. + * + * @param organizationId the organization id + * @return this builder + */ + public Builder organizationId(String organizationId) { + this.organizationId = Objects.requireNonNull(organizationId, "organizationId"); + return this; + } + + /** + * The application id for application-scoped operations. Defaults to {@code + * DIDIT_APPLICATION_ID}. + * + * @param applicationId the application id + * @return this builder + */ + public Builder applicationId(String applicationId) { + this.applicationId = Objects.requireNonNull(applicationId, "applicationId"); + return this; + } + + /** + * The verification API base URL. Defaults to {@value ClientOptions#DEFAULT_BASE_URL}. + * + * @param baseUrl an https URL (http only for localhost) + * @return this builder + */ + public Builder baseUrl(String baseUrl) { + this.baseUrl = Objects.requireNonNull(baseUrl, "baseUrl"); + return this; + } + + /** + * The account management API base URL. Defaults to {@value + * ClientOptions#DEFAULT_ACCOUNT_BASE_URL}. + * + * @param accountBaseUrl an https URL (http only for localhost) + * @return this builder + */ + public Builder accountBaseUrl(String accountBaseUrl) { + this.accountBaseUrl = Objects.requireNonNull(accountBaseUrl, "accountBaseUrl"); + return this; + } + + /** + * The timeout of each attempt. Defaults to 60 seconds. + * + * @param timeout a positive duration + * @return this builder + */ + public Builder timeout(Duration timeout) { + this.timeout = positive(timeout, "timeout"); + return this; + } + + /** + * How many times a failed request is retried. Defaults to 2. + * + * @param maxRetries zero or more + * @return this builder + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = nonNegative(maxRetries, "maxRetries"); + return this; + } + + /** + * Adds a header to every request. + * + * @param name the header name + * @param value the header value + * @return this builder + */ + public Builder defaultHeader(String name, String value) { + defaultHeaders.put( + Objects.requireNonNull(name, "name"), Objects.requireNonNull(value, "value")); + return this; + } + + /** + * Sends requests with this {@link HttpClient} (proxies, TLS, executor). It must not follow + * redirects. + * + * @param httpClient the client + * @return this builder + */ + public Builder httpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "httpClient"); + this.transport = null; + return this; + } + + /** + * Sends requests through a custom transport, for example a stub in tests. + * + * @param transport the transport + * @return this builder + */ + public Builder transport(HttpTransport transport) { + this.transport = Objects.requireNonNull(transport, "transport"); + this.httpClient = null; + return this; + } + + /** + * Logs every request (method, path, status, duration, request id) to the {@code me.didit} + * {@link System.Logger}. Defaults to {@code DIDIT_LOG=debug}. + * + * @param enabled whether to log + * @return this builder + */ + public Builder debugLogging(boolean enabled) { + this.debugLogging = enabled; + return this; + } + + /** + * Where the {@code DIDIT_*} fallbacks are read from. Defaults to {@link System#getenv}. + * + * @param environment variable name to value, or {@code null} when unset + * @return this builder + */ + public Builder environment(Function environment) { + this.environment = Objects.requireNonNull(environment, "environment"); + return this; + } + + Builder scheduler(Scheduler scheduler) { + this.scheduler = scheduler; + return this; + } + + /** + * Builds the options. + * + * @return the options + * @throws ConfigurationException when a URL is invalid + */ + public ClientOptions build() { + HttpTransport chosen = transport; + if (chosen == null) { + chosen = + httpClient != null + ? new JdkHttpTransport(httpClient) + : JdkHttpTransport.create( + timeout.compareTo(Duration.ofSeconds(30)) < 0 + ? timeout + : Duration.ofSeconds(30)); + } + return new ClientOptions(this, chosen); + } + } +} diff --git a/src/main/java/me/didit/core/Conv.java b/src/main/java/me/didit/core/Conv.java new file mode 100644 index 0000000..e432666 --- /dev/null +++ b/src/main/java/me/didit/core/Conv.java @@ -0,0 +1,392 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import me.didit.errors.UnexpectedResponseException; + +/** + * Converts between JSON values and the Java types of generated fields. Reading is lenient where the + * meaning is unambiguous (a number sent as a string), and strict otherwise. + * + * @param the Java type + */ +public abstract class Conv { + private static final JsonNodeFactory NODES = Json.MAPPER.getNodeFactory(); + private static final BigInteger LONG_MIN = BigInteger.valueOf(Long.MIN_VALUE); + private static final BigInteger LONG_MAX = BigInteger.valueOf(Long.MAX_VALUE); + + /** Strings. Numbers and booleans are read as their text. */ + public static final Conv STRING = + new Conv<>() { + @Override + public String read(JsonNode node) { + if (node.isTextual() || node.isNumber() || node.isBoolean()) { + return node.asText(); + } + throw mismatch("a string", node); + } + + @Override + public JsonNode write(String value) { + return NODES.textNode(value); + } + }; + + /** Integers that fit in a {@code long}. */ + public static final Conv LONG = + new Conv<>() { + @Override + public Long read(JsonNode node) { + BigDecimal decimal = decimal(node, "an integer"); + try { + BigInteger integer = decimal.toBigIntegerExact(); + if (integer.compareTo(LONG_MIN) < 0 || integer.compareTo(LONG_MAX) > 0) { + throw mismatch("an integer that fits in 64 bits", node); + } + return integer.longValue(); + } catch (ArithmeticException e) { + throw mismatch("an integer", node); + } + } + + @Override + public JsonNode write(Long value) { + return NODES.numberNode(value); + } + }; + + /** Numbers. */ + public static final Conv DOUBLE = + new Conv<>() { + @Override + public Double read(JsonNode node) { + return decimal(node, "a number").doubleValue(); + } + + @Override + public JsonNode write(Double value) { + if (value.isNaN() || value.isInfinite()) { + throw new IllegalArgumentException("JSON has no NaN or Infinity: " + value); + } + return NODES.numberNode(value); + } + }; + + /** Booleans; the strings {@code "true"} and {@code "false"} are accepted too. */ + public static final Conv BOOLEAN = + new Conv<>() { + @Override + public Boolean read(JsonNode node) { + if (node.isBoolean()) { + return node.booleanValue(); + } + if (node.isTextual() && ("true".equals(node.asText()) || "false".equals(node.asText()))) { + return Boolean.parseBoolean(node.asText()); + } + throw mismatch("a boolean", node); + } + + @Override + public JsonNode write(Boolean value) { + return NODES.booleanNode(value); + } + }; + + /** + * ISO 8601 date-times. A value without an offset is read as UTC, a space may separate the date + * and the time, and a number is read as unix seconds. + */ + public static final Conv DATE_TIME = + new Conv<>() { + @Override + public OffsetDateTime read(JsonNode node) { + if (node.isNumber()) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(node.asLong()), ZoneOffset.UTC); + } + if (!node.isTextual()) { + throw mismatch("a date-time string", node); + } + String text = node.asText().trim(); + if (text.length() > 10 && text.charAt(10) == ' ') { + text = text.substring(0, 10) + 'T' + text.substring(11); // Python str(datetime) + } + try { + return OffsetDateTime.parse(text); + } catch (DateTimeParseException e) { + try { + return LocalDateTime.parse(text).atOffset(ZoneOffset.UTC); + } catch (DateTimeParseException e2) { + try { + return LocalDate.parse(text).atStartOfDay().atOffset(ZoneOffset.UTC); + } catch (DateTimeParseException e3) { + throw new UnexpectedResponseException("expected a date-time, got '" + text + "'"); + } + } + } + } + + @Override + public JsonNode write(OffsetDateTime value) { + return NODES.textNode(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)); + } + }; + + /** ISO 8601 dates ({@code 2026-11-01}); a date-time is read as its date. */ + public static final Conv DATE = + new Conv<>() { + @Override + public LocalDate read(JsonNode node) { + if (!node.isTextual()) { + throw mismatch("a date string", node); + } + String text = node.asText(); + try { + return LocalDate.parse(text.length() > 10 ? text.substring(0, 10) : text); + } catch (DateTimeParseException e) { + throw new UnexpectedResponseException("expected a date, got '" + text + "'"); + } + } + + @Override + public JsonNode write(LocalDate value) { + return NODES.textNode(DateTimeFormatter.ISO_LOCAL_DATE.format(value)); + } + }; + + /** Any JSON value, as is. */ + public static final Conv ANY = + new Conv<>() { + @Override + public JsonNode read(JsonNode node) { + return node.deepCopy(); + } + + @Override + public JsonNode write(JsonNode value) { + return value.deepCopy(); + } + }; + + /** A free-form JSON object. */ + public static final Conv> OBJECT = + new Conv<>() { + @Override + public Map read(JsonNode node) { + if (!node.isObject()) { + throw mismatch("an object", node); + } + Map out = new LinkedHashMap<>(); + for (Map.Entry entry : node.properties()) { + out.put(entry.getKey(), entry.getValue().deepCopy()); + } + return Collections.unmodifiableMap(out); + } + + @Override + public JsonNode write(Map value) { + return Json.toNode(value); + } + }; + + /** + * Reads a JSON value. + * + * @param node a JSON value that is not null + * @return the Java value + * @throws UnexpectedResponseException when the value has another type + */ + public abstract T read(JsonNode node); + + /** + * Writes a Java value. + * + * @param value the Java value + * @return the JSON value + */ + public abstract JsonNode write(T value); + + /** + * Lists of {@code item}. + * + * @param the item type + * @param item the item converter + * @return the list converter + */ + public static Conv> list(Conv item) { + return new Conv<>() { + @Override + public List read(JsonNode node) { + if (!node.isArray()) { + throw mismatch("an array", node); + } + List out = new ArrayList<>(node.size()); + int index = 0; + for (JsonNode element : node) { + if (element.isNull()) { + throw new UnexpectedResponseException("item " + index + " is null"); + } + try { + out.add(item.read(element)); + } catch (UnexpectedResponseException e) { + throw new UnexpectedResponseException("item " + index + ": " + e.getMessage(), e); + } + index++; + } + return Collections.unmodifiableList(out); + } + + @Override + public JsonNode write(List value) { + ArrayNode out = NODES.arrayNode(); + for (T element : value) { + out.add(item.write(element)); + } + return out; + } + }; + } + + /** + * Objects whose values are {@code item}. + * + * @param the value type + * @param item the value converter + * @return the map converter + */ + public static Conv> map(Conv item) { + return new Conv<>() { + @Override + public Map read(JsonNode node) { + if (!node.isObject()) { + throw mismatch("an object", node); + } + Map out = new LinkedHashMap<>(); + for (Map.Entry entry : node.properties()) { + if (entry.getValue().isNull()) { + continue; + } + try { + out.put(entry.getKey(), item.read(entry.getValue())); + } catch (UnexpectedResponseException e) { + throw new UnexpectedResponseException( + "key '" + entry.getKey() + "': " + e.getMessage(), e); + } + } + return Collections.unmodifiableMap(out); + } + + @Override + public JsonNode write(Map value) { + ObjectNode out = NODES.objectNode(); + for (Map.Entry entry : value.entrySet()) { + out.set(entry.getKey(), item.write(entry.getValue())); + } + return out; + } + }; + } + + /** + * A generated object type. + * + * @param the generated type + * @param fromJson its {@code fromJson} method + * @return the converter + */ + public static Conv model(Function fromJson) { + return new Conv<>() { + @Override + public T read(JsonNode node) { + if (!node.isObject()) { + throw mismatch("an object", node); + } + return fromJson.apply(node); + } + + @Override + public JsonNode write(T value) { + return value.json.deepCopy(); + } + }; + } + + /** + * A generated union type. + * + * @param the generated type + * @param fromJson its {@code fromJson} method + * @return the converter + */ + public static Conv union(Function fromJson) { + return new Conv<>() { + @Override + public T read(JsonNode node) { + return fromJson.apply(node); + } + + @Override + public JsonNode write(T value) { + return value.json.deepCopy(); + } + }; + } + + /** + * A generated open enum. + * + * @param the generated type + * @param of its {@code of} method + * @return the converter + */ + public static Conv enumeration(Function of) { + return new Conv<>() { + @Override + public T read(JsonNode node) { + if (!node.isTextual()) { + throw mismatch("a string", node); + } + return of.apply(node.asText()); + } + + @Override + public JsonNode write(T value) { + return NODES.textNode(value.value()); + } + }; + } + + static BigDecimal decimal(JsonNode node, String expected) { + if (node.isNumber()) { + return node.decimalValue(); + } + if (node.isTextual()) { + try { + return new BigDecimal(node.asText().trim()); + } catch (NumberFormatException e) { + throw mismatch(expected, node); + } + } + throw mismatch(expected, node); + } + + static UnexpectedResponseException mismatch(String expected, JsonNode node) { + return new UnexpectedResponseException("expected " + expected + ", got " + Json.kind(node)); + } +} diff --git a/src/main/java/me/didit/core/FileUpload.java b/src/main/java/me/didit/core/FileUpload.java new file mode 100644 index 0000000..0afaa55 --- /dev/null +++ b/src/main/java/me/didit/core/FileUpload.java @@ -0,0 +1,181 @@ +package me.didit.core; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Locale; +import java.util.Objects; +import java.util.Optional; +import org.jspecify.annotations.Nullable; + +/** + * A file for a multipart upload: a path, bytes or a stream, with an optional file name and content + * type. Streams are read once, when the request is built, so that retries resend the same bytes. + */ +public final class FileUpload { + private final @Nullable Path path; + private final byte @Nullable [] bytes; + private final @Nullable InputStream stream; + private final String fileName; + private final @Nullable String contentType; + private byte @Nullable [] streamBytes; + + private FileUpload( + @Nullable Path path, + byte @Nullable [] bytes, + @Nullable InputStream stream, + String fileName, + @Nullable String contentType) { + this.path = path; + this.bytes = bytes; + this.stream = stream; + this.fileName = fileName; + this.contentType = contentType; + } + + /** + * A file on disk, read when the request is sent. The file name is the path's last segment. + * + * @param path the file + * @return the upload + */ + public static FileUpload of(Path path) { + Path name = path.getFileName(); + return new FileUpload(path, null, null, name == null ? "file" : name.toString(), null); + } + + /** + * In-memory bytes. + * + * @param bytes the content; copied + * @param fileName the file name sent to the API, for example {@code front.jpg} + * @return the upload + */ + public static FileUpload of(byte[] bytes, String fileName) { + return new FileUpload(null, bytes.clone(), null, fileName, null); + } + + /** + * In-memory bytes with an explicit content type. + * + * @param bytes the content; copied + * @param fileName the file name sent to the API + * @param contentType the content type, for example {@code image/jpeg} + * @return the upload + */ + public static FileUpload of(byte[] bytes, String fileName, String contentType) { + return new FileUpload(null, bytes.clone(), null, fileName, contentType); + } + + /** + * A stream, read fully the first time the request is built. The SDK does not close it. + * + * @param stream the content + * @param fileName the file name sent to the API + * @param contentType the content type, or {@code null} to guess it from the file name + * @return the upload + */ + public static FileUpload of(InputStream stream, String fileName, @Nullable String contentType) { + return new FileUpload( + null, null, Objects.requireNonNull(stream, "stream"), fileName, contentType); + } + + /** + * The same content with another content type. + * + * @param contentType the content type + * @return a new upload + */ + public FileUpload withContentType(String contentType) { + return new FileUpload(path, bytes, stream, fileName, contentType); + } + + /** + * The same content with another file name. + * + * @param fileName the file name + * @return a new upload + */ + public FileUpload withFileName(String fileName) { + return new FileUpload(path, bytes, stream, fileName, contentType); + } + + /** + * The file name sent to the API. + * + * @return the file name + */ + public String fileName() { + return fileName; + } + + /** + * The content type: the one given, or a guess from the file name. + * + * @return the content type + */ + public String contentType() { + if (contentType != null) { + return contentType; + } + return guessContentType(fileName).orElse("application/octet-stream"); + } + + /** + * Reads the content. + * + * @return the bytes + * @throws UncheckedIOException when the file or stream cannot be read + */ + public synchronized byte[] read() { + if (bytes != null) { + return bytes.clone(); + } + if (path != null) { + try { + return Files.readAllBytes(path); + } catch (IOException e) { + throw new UncheckedIOException("Cannot read " + path, e); + } + } + if (streamBytes == null) { + try { + streamBytes = Objects.requireNonNull(stream).readAllBytes(); + } catch (IOException e) { + throw new UncheckedIOException("Cannot read the upload stream", e); + } + } + return streamBytes.clone(); + } + + static Optional guessContentType(String fileName) { + String lower = fileName.toLowerCase(Locale.ROOT); + if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) { + return Optional.of("image/jpeg"); + } + if (lower.endsWith(".png")) { + return Optional.of("image/png"); + } + if (lower.endsWith(".pdf")) { + return Optional.of("application/pdf"); + } + if (lower.endsWith(".csv")) { + return Optional.of("text/csv"); + } + if (lower.endsWith(".webp")) { + return Optional.of("image/webp"); + } + if (lower.endsWith(".heic")) { + return Optional.of("image/heic"); + } + return Optional.ofNullable(URLConnection.guessContentTypeFromName(fileName)); + } + + @Override + public String toString() { + return "FileUpload{fileName=" + fileName + ", contentType=" + contentType() + "}"; + } +} diff --git a/src/main/java/me/didit/core/Headers.java b/src/main/java/me/didit/core/Headers.java new file mode 100644 index 0000000..0f37506 --- /dev/null +++ b/src/main/java/me/didit/core/Headers.java @@ -0,0 +1,133 @@ +package me.didit.core; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.TreeMap; + +/** Immutable HTTP headers with case-insensitive names. */ +public final class Headers { + /** The headers that carry the API's request id, in the order they are read. */ + public static final List REQUEST_ID_HEADERS = + List.of("X-Request-Id", "Request-Id", "X-Amzn-Requestid", "X-Correlation-Id"); + + private static final Headers EMPTY = new Headers(new TreeMap<>(String.CASE_INSENSITIVE_ORDER)); + + private final Map> values; + + private Headers(Map> values) { + this.values = Collections.unmodifiableMap(values); + } + + /** + * Returns headers without any value. + * + * @return empty headers + */ + public static Headers empty() { + return EMPTY; + } + + /** + * Copies a header map. Names are compared without case; values keep their order. + * + * @param map header names to values + * @return the headers + */ + public static Headers of(Map> map) { + TreeMap> copy = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + for (Map.Entry> entry : map.entrySet()) { + if (entry.getKey() == null) { + continue; // java.net.http reports the status line under a null name + } + copy.computeIfAbsent(entry.getKey(), k -> new ArrayList<>()).addAll(entry.getValue()); + } + copy.replaceAll((k, v) -> List.copyOf(v)); + return new Headers(copy); + } + + /** + * The first value of a header. + * + * @param name the header name, any case + * @return the value, if present + */ + public Optional firstValue(String name) { + List list = values.get(name); + return list == null || list.isEmpty() ? Optional.empty() : Optional.of(list.get(0)); + } + + /** + * Every value of a header. + * + * @param name the header name, any case + * @return the values, possibly empty + */ + public List allValues(String name) { + List list = values.get(name); + return list == null ? List.of() : list; + } + + /** + * The request id the API assigned to this response. + * + * @return the first of {@link #REQUEST_ID_HEADERS} that is present + */ + public Optional requestId() { + for (String name : REQUEST_ID_HEADERS) { + Optional value = firstValue(name).filter(v -> !v.isEmpty()); + if (value.isPresent()) { + return value; + } + } + return Optional.empty(); + } + + /** + * Every header as an unmodifiable map with case-insensitive keys. + * + * @return the headers + */ + public Map> map() { + return values; + } + + /** Header names that are never printed by {@link #toString()}. */ + static boolean isSensitive(String name) { + String lower = name.toLowerCase(Locale.ROOT); + return lower.equals("x-api-key") + || lower.equals("authorization") + || lower.equals("proxy-authorization") + || lower.equals("cookie") + || lower.equals("set-cookie") + || lower.startsWith("x-signature"); + } + + @Override + public boolean equals(Object other) { + return other instanceof Headers && values.equals(((Headers) other).values); + } + + @Override + public int hashCode() { + return values.hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder("Headers{"); + boolean first = true; + for (Map.Entry> entry : values.entrySet()) { + if (!first) { + out.append(", "); + } + first = false; + out.append(entry.getKey()).append('='); + out.append(isSensitive(entry.getKey()) ? "[REDACTED]" : String.join(",", entry.getValue())); + } + return out.append('}').toString(); + } +} diff --git a/src/main/java/me/didit/core/HttpTransport.java b/src/main/java/me/didit/core/HttpTransport.java new file mode 100644 index 0000000..d1abb91 --- /dev/null +++ b/src/main/java/me/didit/core/HttpTransport.java @@ -0,0 +1,22 @@ +package me.didit.core; + +import java.util.concurrent.CompletableFuture; + +/** + * Sends one HTTP request. The default is {@link JdkHttpTransport}; replace it to route requests + * through your own HTTP stack or to stub the API in tests. + * + *

Implementations must not follow redirects and must complete the future exceptionally with an + * {@link java.io.IOException} (or {@link java.net.http.HttpTimeoutException}) when no response is + * received. + */ +@FunctionalInterface +public interface HttpTransport { + /** + * Sends the request. + * + * @param request the request + * @return a future completed with the response; the caller closes its body + */ + CompletableFuture send(TransportRequest request); +} diff --git a/src/main/java/me/didit/core/JdkHttpTransport.java b/src/main/java/me/didit/core/JdkHttpTransport.java new file mode 100644 index 0000000..778bffc --- /dev/null +++ b/src/main/java/me/didit/core/JdkHttpTransport.java @@ -0,0 +1,76 @@ +package me.didit.core; + +import java.io.ByteArrayInputStream; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +/** The default {@link HttpTransport}, built on {@link java.net.http.HttpClient}. */ +public final class JdkHttpTransport implements HttpTransport { + private final HttpClient client; + + /** + * Wraps an {@link HttpClient}. Configure proxies, TLS and executors on it; it must not follow + * redirects, so that credentials never reach another origin. + * + * @param client the client + */ + public JdkHttpTransport(HttpClient client) { + if (client.followRedirects() != HttpClient.Redirect.NEVER) { + throw new IllegalArgumentException( + "The HttpClient must not follow redirects (HttpClient.Redirect.NEVER)"); + } + this.client = client; + } + + /** + * A transport with a new {@link HttpClient}. + * + * @param connectTimeout the connection timeout + * @return the transport + */ + public static JdkHttpTransport create(Duration connectTimeout) { + return new JdkHttpTransport( + HttpClient.newBuilder() + .connectTimeout(connectTimeout) + .followRedirects(HttpClient.Redirect.NEVER) + .build()); + } + + @Override + public CompletableFuture send(TransportRequest request) { + byte[] body = request.body(); + HttpRequest.BodyPublisher publisher = + body.length == 0 + ? HttpRequest.BodyPublishers.noBody() + : HttpRequest.BodyPublishers.ofByteArray(body); + HttpRequest.Builder builder = + HttpRequest.newBuilder(request.uri()) + .timeout(request.timeout()) + .method(request.method(), publisher); + for (Map.Entry> header : request.headers().entrySet()) { + for (String value : header.getValue()) { + builder.header(header.getKey(), value); + } + } + HttpRequest httpRequest = builder.build(); + if (request.streamResponse()) { + return client + .sendAsync(httpRequest, HttpResponse.BodyHandlers.ofInputStream()) + .thenApply( + r -> new TransportResponse(r.statusCode(), Headers.of(r.headers().map()), r.body())); + } + return client + .sendAsync(httpRequest, HttpResponse.BodyHandlers.ofByteArray()) + .thenApply( + r -> + new TransportResponse( + r.statusCode(), + Headers.of(r.headers().map()), + new ByteArrayInputStream(r.body()))); + } +} diff --git a/src/main/java/me/didit/core/Json.java b/src/main/java/me/didit/core/Json.java new file mode 100644 index 0000000..ba88f9a --- /dev/null +++ b/src/main/java/me/didit/core/Json.java @@ -0,0 +1,300 @@ +package me.didit.core; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.StreamReadFeature; +import com.fasterxml.jackson.core.json.JsonReadFeature; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.cfg.JsonNodeFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.NullNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.Optional; +import java.util.regex.Pattern; +import me.didit.errors.UnexpectedResponseException; +import org.jspecify.annotations.Nullable; + +/** + * JSON helpers used by the generated types. Numbers are read losslessly: integers of any size and + * decimals as {@link java.math.BigDecimal}. + */ +public final class Json { + /** The mapper the SDK uses to read and write JSON. Do not reconfigure it. */ + static final ObjectMapper MAPPER = + JsonMapper.builder() + .configure(JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES, false) + .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) + .disable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION) + .disable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) + .build(); + + private static final Pattern SECRET_KEY = + Pattern.compile("(?i).*(api_key|apikey|secret|password|token|authorization).*"); + + private Json() {} + + /** + * The shared JSON node factory, for building values to pass to the SDK. + * + * @return the node factory + */ + public static JsonNodeFactory nodes() { + return MAPPER.getNodeFactory(); + } + + /** + * Parses JSON text. + * + * @param text JSON text + * @return the parsed value + * @throws UnexpectedResponseException when the text is not valid JSON + */ + public static JsonNode parse(String text) { + try { + return MAPPER.readTree(text); + } catch (JsonProcessingException e) { + throw new UnexpectedResponseException("Invalid JSON: " + e.getOriginalMessage(), e); + } + } + + /** + * Parses UTF-8 JSON bytes. + * + * @param bytes JSON bytes + * @return the parsed value; {@link com.fasterxml.jackson.databind.node.MissingNode} when empty + * @throws UnexpectedResponseException when the bytes are not valid JSON + */ + public static JsonNode parse(byte[] bytes) { + try { + return MAPPER.readTree(bytes); + } catch (IOException e) { + throw new UnexpectedResponseException("Invalid JSON: " + e.getMessage(), e); + } + } + + /** + * Converts a Java value (map, list, string, number, boolean, {@link JsonNode}, generated type) to + * JSON. + * + * @param value the value; {@code null} becomes JSON null + * @return the JSON value + */ + public static JsonNode toNode(@Nullable Object value) { + if (value == null) { + return NullNode.getInstance(); + } + if (value instanceof JsonNode) { + return ((JsonNode) value).deepCopy(); + } + if (value instanceof JsonModel) { + return ((JsonModel) value).json.deepCopy(); + } + if (value instanceof JsonUnion) { + return ((JsonUnion) value).json.deepCopy(); + } + if (value instanceof StringEnum) { + return MAPPER.getNodeFactory().textNode(((StringEnum) value).value()); + } + if (value instanceof OffsetDateTime) { + return Conv.DATE_TIME.write((OffsetDateTime) value); + } + if (value instanceof LocalDate) { + return Conv.DATE.write((LocalDate) value); + } + if (value instanceof java.time.temporal.TemporalAccessor) { + return MAPPER.getNodeFactory().textNode(value.toString()); + } + if (value instanceof Optional) { + Optional optional = (Optional) value; + return optional.isPresent() ? toNode(optional.get()) : NullNode.getInstance(); + } + if (value instanceof MultiStatusResponse) { + return ((MultiStatusResponse) value).json.deepCopy(); + } + if (value instanceof Map) { + ObjectNode out = MAPPER.createObjectNode(); + for (Map.Entry entry : ((Map) value).entrySet()) { + out.set(String.valueOf(entry.getKey()), toNode(entry.getValue())); + } + return out; + } + if (value instanceof Iterable) { + com.fasterxml.jackson.databind.node.ArrayNode out = MAPPER.createArrayNode(); + for (Object item : (Iterable) value) { + out.add(toNode(item)); + } + return out; + } + return MAPPER.valueToTree(value); + } + + /** + * Writes a JSON value as compact text. + * + * @param node the value + * @return the JSON text + */ + public static String write(JsonNode node) { + try { + return MAPPER.writeValueAsString(node); + } catch (JsonProcessingException e) { + throw new IllegalStateException("JSON value cannot be written", e); + } + } + + static byte[] writeBytes(JsonNode node) { + try { + return MAPPER.writeValueAsBytes(node); + } catch (JsonProcessingException e) { + throw new IllegalStateException("JSON value cannot be written", e); + } + } + + /** + * Copies a JSON object. + * + * @param json a JSON value + * @return a deep copy + * @throws UnexpectedResponseException when the value is not an object + */ + public static ObjectNode copyObject(JsonNode json) { + if (!json.isObject()) { + throw new UnexpectedResponseException("Expected a JSON object, got " + kind(json)); + } + return ((ObjectNode) json).deepCopy(); + } + + /** + * Reads a required field. + * + * @param the Java type + * @param json the object + * @param field the JSON field name + * @param conv the converter + * @return the value + * @throws UnexpectedResponseException when the field is absent, null or of another type + */ + public static T required(JsonNode json, String field, Conv conv) { + JsonNode value = json.get(field); + if (value == null || value.isNull() || value.isMissingNode()) { + throw new UnexpectedResponseException( + "Required field '" + field + "' is " + (value == null ? "missing" : "null")); + } + return read(field, value, conv); + } + + /** + * Reads an optional field. + * + * @param the Java type + * @param json the object + * @param field the JSON field name + * @param conv the converter + * @return the value, or empty when absent or null + * @throws UnexpectedResponseException when the field has another type + */ + public static Optional optional(JsonNode json, String field, Conv conv) { + JsonNode value = json.get(field); + if (value == null || value.isNull() || value.isMissingNode()) { + return Optional.empty(); + } + return Optional.of(read(field, value, conv)); + } + + private static T read(String field, JsonNode value, Conv conv) { + try { + return conv.read(value); + } catch (UnexpectedResponseException e) { + throw new UnexpectedResponseException("Field '" + field + "': " + e.getMessage(), e); + } + } + + /** + * Whether a field holds the given string, for union discrimination. + * + * @param json any JSON value + * @param field the field name + * @param value the expected string + * @return true when {@code json} is an object whose field equals {@code value} + */ + public static boolean hasValue(JsonNode json, String field, String value) { + JsonNode actual = json.get(field); + return json.isObject() && actual != null && actual.isTextual() && actual.asText().equals(value); + } + + /** + * Whether every field is present, for union discrimination. + * + * @param json any JSON value + * @param fields the field names + * @return true when {@code json} is an object holding all of them + */ + public static boolean hasFields(JsonNode json, String... fields) { + if (!json.isObject()) { + return false; + } + for (String field : fields) { + if (!json.has(field)) { + return false; + } + } + return true; + } + + /** + * Whether any field is present, for union discrimination. + * + * @param json any JSON value + * @param fields the field names + * @return true when {@code json} is an object holding at least one of them + */ + public static boolean hasAnyField(JsonNode json, String... fields) { + if (!json.isObject()) { + return false; + } + for (String field : fields) { + if (json.has(field)) { + return true; + } + } + return false; + } + + static String kind(JsonNode node) { + return node.getNodeType().name().toLowerCase(java.util.Locale.ROOT); + } + + /** Compact JSON with the values of secret-looking fields replaced, for {@code toString()}. */ + static String redacted(JsonNode node) { + return write(redact(node)); + } + + private static JsonNode redact(JsonNode node) { + if (node.isObject()) { + ObjectNode out = MAPPER.createObjectNode(); + for (Map.Entry entry : node.properties()) { + JsonNode value = entry.getValue(); + if (value.isTextual() && SECRET_KEY.matcher(entry.getKey()).matches()) { + out.put(entry.getKey(), "[REDACTED]"); + } else { + out.set(entry.getKey(), redact(value)); + } + } + return out; + } + if (node.isArray()) { + com.fasterxml.jackson.databind.node.ArrayNode out = MAPPER.createArrayNode(); + for (JsonNode item : node) { + out.add(redact(item)); + } + return out; + } + return node; + } +} diff --git a/src/main/java/me/didit/core/JsonModel.java b/src/main/java/me/didit/core/JsonModel.java new file mode 100644 index 0000000..3a00824 --- /dev/null +++ b/src/main/java/me/didit/core/JsonModel.java @@ -0,0 +1,242 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.NullNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import org.jspecify.annotations.Nullable; + +/** + * Base class of every generated object type: an immutable, typed view of a JSON object. + * + *

Fields the SDK does not know yet are kept and readable through {@link + * #_additionalProperties()}; {@link #_json()} returns the whole object, which also tells an absent + * field from a {@code null} one. + */ +public abstract class JsonModel { + /** The underlying object, owned by this instance; generated getters read it. */ + protected final ObjectNode json; + + private final Map> files; + + /** + * Wraps a JSON object the subclass owns. + * + * @param json the object; not copied, so the caller must not keep a reference + * @param files files to upload with a multipart request, by field name + */ + protected JsonModel(ObjectNode json, Map> files) { + this.json = json; + this.files = Collections.unmodifiableMap(new LinkedHashMap<>(files)); + } + + /** + * The JSON field names this type declares. + * + * @return the declared field names + */ + protected abstract Set knownFields(); + + /** + * A copy of the underlying JSON object, including unknown fields. + * + * @return a deep copy + */ + public final ObjectNode _json() { + return json.deepCopy(); + } + + /** + * The fields of the JSON object this SDK version does not declare. + * + * @return unknown fields by name, in their original order + */ + public final Map _additionalProperties() { + Map out = new LinkedHashMap<>(); + Set known = knownFields(); + for (Map.Entry entry : json.properties()) { + if (!known.contains(entry.getKey())) { + out.put(entry.getKey(), entry.getValue().deepCopy()); + } + } + return Collections.unmodifiableMap(out); + } + + /** + * The files to upload, by field name. Empty except for multipart request parameters. + * + * @return the files + */ + public final Map> _files() { + return files; + } + + /** Reads one file field, for generated getters. */ + protected final Optional file(String field) { + List list = files.get(field); + return list == null || list.isEmpty() ? Optional.empty() : Optional.of(list.get(0)); + } + + /** Reads a list-of-files field, for generated getters. */ + protected final Optional> fileList(String field) { + return Optional.ofNullable(files.get(field)); + } + + // Two generated types with the same JSON are still different values. + @SuppressWarnings("EqualsGetClass") + @Override + public final boolean equals(@Nullable Object other) { + if (this == other) { + return true; + } + if (other == null || other.getClass() != getClass()) { + return false; + } + JsonModel that = (JsonModel) other; + return json.equals(that.json) && files.equals(that.files); + } + + @Override + public final int hashCode() { + return Objects.hash(getClass(), json, files); + } + + /** The class name and the JSON, with the values of secret-looking fields redacted. */ + @Override + public String toString() { + String name = getClass().getName(); + name = name.substring(name.lastIndexOf('.') + 1).replace('$', '.'); + String text = name + Json.redacted(json); + if (!files.isEmpty()) { + text += " files=" + files.keySet(); + } + return text; + } + + /** + * Base class of the generated builders. + * + * @param the concrete builder + */ + public abstract static class BaseBuilder> { + private final ObjectNode json; + private final Map> files; + + /** Starts from an empty object. */ + protected BaseBuilder() { + this.json = Json.MAPPER.createObjectNode(); + this.files = new LinkedHashMap<>(); + } + + /** + * Starts from a copy of {@code from}. + * + * @param from the value to copy + */ + protected BaseBuilder(JsonModel from) { + this.json = from.json.deepCopy(); + this.files = new LinkedHashMap<>(from.files); + } + + /** + * This builder, typed. + * + * @return this + */ + protected abstract B self(); + + /** Sets a field; {@code value} must not be null. */ + protected final B set(String field, Conv conv, T value) { + Objects.requireNonNull(value, field); + json.set(field, conv.write(value)); + return self(); + } + + /** Sets a nullable field; {@code null} sends JSON null. */ + protected final B setNullable(String field, Conv conv, @Nullable T value) { + json.set(field, value == null ? NullNode.getInstance() : conv.write(value)); + return self(); + } + + /** Sets a field of any JSON type from a Java value. */ + protected final B setAny(String field, @Nullable Object value) { + json.set(field, Json.toNode(value)); + return self(); + } + + /** Sets a file field. */ + protected final B setFile(String field, FileUpload file) { + Objects.requireNonNull(file, field); + files.put(field, List.of(file)); + return self(); + } + + /** Sets a list-of-files field. */ + protected final B setFiles(String field, List list) { + files.put(field, List.copyOf(list)); + return self(); + } + + /** + * Sets a field this SDK version does not declare. The value is converted like {@link + * Json#toNode(Object)}. + * + * @param field the JSON field name + * @param value the value; {@code null} sends JSON null + * @return this builder + */ + public final B putAdditionalProperty(String field, @Nullable Object value) { + json.set(field, Json.toNode(value)); + return self(); + } + + /** + * Removes a field, declared or not, so that it is not sent. + * + * @param field the JSON field name + * @return this builder + */ + public final B remove(String field) { + json.remove(field); + files.remove(field); + return self(); + } + + /** Fails when a required field is missing (or null, unless the field is nullable). */ + protected final void require(String field, boolean nullable) { + JsonNode value = json.get(field); + if (value == null || (!nullable && value.isNull())) { + throw new IllegalStateException("Missing required field '" + field + "'"); + } + } + + /** Fails when a required file field is missing. */ + protected final void requireFile(String field) { + List list = files.get(field); + if (list == null || list.isEmpty()) { + throw new IllegalStateException("Missing required file '" + field + "'"); + } + } + + /** A copy of the JSON built so far. */ + protected final ObjectNode buildJson() { + return json.deepCopy(); + } + + /** A copy of the files set so far. */ + protected final Map> buildFiles() { + Map> out = new LinkedHashMap<>(); + for (Map.Entry> entry : files.entrySet()) { + out.put(entry.getKey(), new ArrayList<>(entry.getValue())); + } + return out; + } + } +} diff --git a/src/main/java/me/didit/core/JsonUnion.java b/src/main/java/me/didit/core/JsonUnion.java new file mode 100644 index 0000000..e3c2347 --- /dev/null +++ b/src/main/java/me/didit/core/JsonUnion.java @@ -0,0 +1,49 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import org.jspecify.annotations.Nullable; + +/** + * Base class of the generated union ({@code oneOf}) types: an immutable JSON value that matches one + * of several shapes. Generated subclasses offer {@code isX()} and {@code asX()} per variant. + */ +public abstract class JsonUnion { + /** The wrapped value, owned by this instance. */ + protected final JsonNode json; + + /** + * Wraps a value the subclass owns. + * + * @param json the value; not copied + */ + protected JsonUnion(JsonNode json) { + this.json = json; + } + + /** + * A copy of the underlying JSON value. + * + * @return a deep copy + */ + public final JsonNode _json() { + return json.deepCopy(); + } + + // Two generated types with the same JSON are still different values. + @SuppressWarnings("EqualsGetClass") + @Override + public final boolean equals(@Nullable Object other) { + return other != null && other.getClass() == getClass() && json.equals(((JsonUnion) other).json); + } + + @Override + public final int hashCode() { + return json.hashCode() * 31 + getClass().hashCode(); + } + + @Override + public String toString() { + String name = getClass().getName(); + return name.substring(name.lastIndexOf('.') + 1).replace('$', '.') + Json.redacted(json); + } +} diff --git a/src/main/java/me/didit/core/MultiStatusResponse.java b/src/main/java/me/didit/core/MultiStatusResponse.java new file mode 100644 index 0000000..e6a56b6 --- /dev/null +++ b/src/main/java/me/didit/core/MultiStatusResponse.java @@ -0,0 +1,71 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import org.jspecify.annotations.Nullable; + +/** + * Base class of generated responses whose body shape depends on the HTTP status, for example 200 + * with a result and 202 with a background job. + */ +public abstract class MultiStatusResponse { + private final int statusCode; + + /** The response body, owned by this instance. */ + protected final JsonNode json; + + /** + * Wraps a response body the subclass owns. + * + * @param statusCode the HTTP status + * @param json the body; not copied + */ + protected MultiStatusResponse(int statusCode, JsonNode json) { + this.statusCode = statusCode; + this.json = json; + } + + /** + * The HTTP status the API answered with. + * + * @return the status + */ + public final int statusCode() { + return statusCode; + } + + /** + * A copy of the response body. + * + * @return a deep copy + */ + public final JsonNode _json() { + return json.deepCopy(); + } + + // Two generated types with the same JSON are still different values. + @SuppressWarnings("EqualsGetClass") + @Override + public final boolean equals(@Nullable Object other) { + if (other == null || other.getClass() != getClass()) { + return false; + } + MultiStatusResponse that = (MultiStatusResponse) other; + return statusCode == that.statusCode && json.equals(that.json); + } + + @Override + public final int hashCode() { + return json.hashCode() * 31 + statusCode; + } + + @Override + public String toString() { + String name = getClass().getName(); + return name.substring(name.lastIndexOf('.') + 1) + + "{status=" + + statusCode + + ", body=" + + Json.redacted(json) + + "}"; + } +} diff --git a/src/main/java/me/didit/core/Multipart.java b/src/main/java/me/didit/core/Multipart.java new file mode 100644 index 0000000..e1c9810 --- /dev/null +++ b/src/main/java/me/didit/core/Multipart.java @@ -0,0 +1,108 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.ByteArrayOutputStream; +import java.nio.charset.StandardCharsets; +import java.security.SecureRandom; +import java.util.List; +import java.util.Map; + +/** + * Encodes {@code multipart/form-data} (DESIGN 8). Strings, numbers and booleans become text fields; + * a list of scalars becomes one field per item; objects and lists of objects become JSON text; null + * fields are left out. + */ +final class Multipart { + private static final SecureRandom RANDOM = new SecureRandom(); + + private final String boundary; + private final ByteArrayOutputStream out = new ByteArrayOutputStream(); + + private Multipart(String boundary) { + this.boundary = boundary; + } + + static Multipart encode(ObjectNode fields, Map> files) { + byte[] random = new byte[16]; + RANDOM.nextBytes(random); + StringBuilder boundary = new StringBuilder("didit-"); + for (byte b : random) { + boundary.append(String.format(java.util.Locale.ROOT, "%02x", b & 0xff)); + } + Multipart multipart = new Multipart(boundary.toString()); + for (Map.Entry field : fields.properties()) { + multipart.addValue(field.getKey(), field.getValue()); + } + for (Map.Entry> entry : files.entrySet()) { + for (FileUpload file : entry.getValue()) { + multipart.addFile(entry.getKey(), file); + } + } + multipart.write("--" + multipart.boundary + "--\r\n"); + return multipart; + } + + private void addValue(String name, JsonNode value) { + if (value.isNull() || value.isMissingNode()) { + return; + } + if (value.isArray()) { + boolean scalars = true; + for (JsonNode item : value) { + scalars &= item.isValueNode(); + } + if (scalars) { + for (JsonNode item : value) { + addValue(name, item); + } + return; + } + addText(name, Json.write(value)); + return; + } + if (value.isObject()) { + addText(name, Json.write(value)); + } else if (value.isNumber()) { + addText(name, value.decimalValue().toPlainString()); + } else { + addText(name, value.asText()); + } + } + + private void addText(String name, String value) { + write("--" + boundary + "\r\n"); + write("Content-Disposition: form-data; name=\"" + quote(name) + "\"\r\n\r\n"); + write(value); + write("\r\n"); + } + + private void addFile(String name, FileUpload file) { + write("--" + boundary + "\r\n"); + write( + "Content-Disposition: form-data; name=\"" + + quote(name) + + "\"; filename=\"" + + quote(file.fileName()) + + "\"\r\n"); + write("Content-Type: " + file.contentType().replaceAll("[\\r\\n]", "") + "\r\n\r\n"); + out.writeBytes(file.read()); + write("\r\n"); + } + + private static String quote(String value) { + return value.replace("\r", "").replace("\n", "").replace("\"", "%22"); + } + + private void write(String text) { + out.writeBytes(text.getBytes(StandardCharsets.UTF_8)); + } + + byte[] body() { + return out.toByteArray(); + } + + String contentType() { + return "multipart/form-data; boundary=" + boundary; + } +} diff --git a/src/main/java/me/didit/core/Page.java b/src/main/java/me/didit/core/Page.java new file mode 100644 index 0000000..8f1f4e5 --- /dev/null +++ b/src/main/java/me/didit/core/Page.java @@ -0,0 +1,272 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.Set; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; +import me.didit.errors.UnexpectedResponseException; + +/** + * One page of a list (DESIGN 8): {@code count}, {@code next}, {@code previous} and {@code results}. + * Iterating a page walks every following page too: + * + *

{@code
+ * for (WorkflowListItem workflow : client.workflows().list()) {
+ *   System.out.println(workflow.uuid());
+ * }
+ * }
+ * + * @param the item type + */ +public final class Page implements Iterable { + private final ApiClient client; + private final ApiRequest request; + private final RequestOptions options; + private final ObjectNode json; + private final Conv item; + private final Set seen; + private final List results; + + private Page( + ApiClient client, + ApiRequest request, + RequestOptions options, + ObjectNode json, + Conv item, + Set seen) { + this.client = client; + this.request = request; + this.options = options; + this.json = json; + this.item = item; + this.seen = seen; + JsonNode results = json.get("results"); + this.results = results == null || results.isNull() ? List.of() : Conv.list(item).read(results); + } + + static Page first(SuccessResponse response, Conv item) { + JsonNode json = response.json(); + if (!json.isObject()) { + throw new UnexpectedResponseException( + response.request.describe() + " returned " + Json.kind(json) + " instead of a page"); + } + Set seen = new HashSet<>(); + seen.add(key(response.uri)); + return new Page<>( + response.client, response.request, response.options, (ObjectNode) json, item, seen); + } + + private static String key(URI uri) { + String query = uri.getRawQuery(); + return uri.getRawPath() + (query == null ? "" : "?" + query); + } + + /** + * The items of this page only. + * + * @return the items + */ + public List results() { + return results; + } + + /** + * The total number of items across all pages, when the API reports it. + * + * @return the count + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The link to the next page. + * + * @return the URL, if there is a next page + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The link to the previous page. + * + * @return the URL, if there is a previous page + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The whole page body, including fields other than the standard ones (for example {@code + * total_transactions}). + * + * @return a copy of the JSON object + */ + public ObjectNode _json() { + return json.deepCopy(); + } + + /** + * Whether another page follows. + * + * @return true when {@link #nextPage()} returns a page + */ + public boolean hasNextPage() { + return next().filter(s -> !s.isEmpty()).isPresent(); + } + + /** + * Fetches the next page. + * + * @return the next page + * @throws NoSuchElementException when there is no next page + * @throws UnexpectedResponseException when the next link points to another origin or back to a + * page already fetched + */ + public Page nextPage() { + return ApiClient.await(nextPageAsync()); + } + + /** + * Fetches the next page. + * + * @return a future completed with the next page + */ + public CompletableFuture> nextPageAsync() { + if (!hasNextPage()) { + return CompletableFuture.failedFuture(new NoSuchElementException("No next page")); + } + URI target; + String key; + try { + URI link = new URI(next().orElseThrow()); + URI resolved = ApiClient.Paths.sameOrigin(client.baseFor(request), link); + target = resolved; + key = key(resolved); + } catch (URISyntaxException e) { + return CompletableFuture.failedFuture( + new UnexpectedResponseException("The next page link is not a valid URL", e)); + } catch (RuntimeException e) { + return CompletableFuture.failedFuture(e); + } + if (seen.contains(key)) { + return CompletableFuture.failedFuture( + new UnexpectedResponseException( + "The next page link points back to a page already fetched: " + key)); + } + Set nextSeen = new HashSet<>(seen); + nextSeen.add(key); + ResponseHandler> handler = + response -> { + JsonNode body = response.json(); + if (!body.isObject()) { + throw new UnexpectedResponseException("The next page is not a JSON object"); + } + return new Page<>(client, request, options, (ObjectNode) body, item, nextSeen); + }; + return client.send(request, options, handler, target).thenApply(RawResponse::data); + } + + /** + * Iterates every item of this page and the following ones, fetching pages as needed. + * + * @return an iterator over all items + */ + @Override + public Iterator iterator() { + return autoPager().iterator(); + } + + /** + * Every item of this page and the following ones. + * + * @return an iterable that fetches pages lazily + */ + public AutoPager autoPager() { + return new AutoPager<>(this); + } + + /** + * Calls {@code action} for every item of this page and the following ones, fetching pages + * asynchronously. + * + * @param action the action + * @return a future completed when the last page was processed + */ + public CompletableFuture forEachAsync(Consumer action) { + results.forEach(action); + if (!hasNextPage()) { + return CompletableFuture.completedFuture(null); + } + return nextPageAsync().thenCompose(page -> page.forEachAsync(action)); + } + + @Override + public String toString() { + return "Page{results=" + results.size() + ", count=" + count().orElse(null) + "}"; + } + + /** + * Every item across pages, as an {@link Iterable} or a {@link Stream}. + * + * @param the item type + */ + public static final class AutoPager implements Iterable { + private final Page first; + + AutoPager(Page first) { + this.first = first; + } + + @Override + public Iterator iterator() { + return new Iterator<>() { + private Page page = first; + private Iterator items = first.results().iterator(); + + @Override + public boolean hasNext() { + while (!items.hasNext()) { + if (!page.hasNextPage()) { + return false; + } + page = page.nextPage(); + items = page.results().iterator(); + } + return true; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return items.next(); + } + }; + } + + /** + * A sequential stream over every item. + * + * @return the stream + */ + public Stream stream() { + return StreamSupport.stream( + Spliterators.spliteratorUnknownSize(iterator(), Spliterator.ORDERED), false); + } + } +} diff --git a/src/main/java/me/didit/core/Platform.java b/src/main/java/me/didit/core/Platform.java new file mode 100644 index 0000000..b27767b --- /dev/null +++ b/src/main/java/me/didit/core/Platform.java @@ -0,0 +1,28 @@ +package me.didit.core; + +/** Describes the runtime for the {@code User-Agent} header. */ +final class Platform { + private static final String USER_AGENT = build(); + + private Platform() {} + + static String userAgent() { + return USER_AGENT; + } + + private static String build() { + String java = System.getProperty("java.version", "unknown"); + String os = System.getProperty("os.name", "unknown"); + return "didit-java/" + Version.VERSION + " (Java " + clean(java) + "; " + clean(os) + ")"; + } + + private static String clean(String value) { + StringBuilder out = new StringBuilder(); + for (int i = 0; i < value.length(); i++) { + char c = value.charAt(i); + out.append(c >= 0x20 && c < 0x7f && c != '(' && c != ')' && c != ';' ? c : '_'); + } + String text = out.toString().trim(); + return text.isEmpty() ? "unknown" : text; + } +} diff --git a/src/main/java/me/didit/core/RawResponse.java b/src/main/java/me/didit/core/RawResponse.java new file mode 100644 index 0000000..ccd5b74 --- /dev/null +++ b/src/main/java/me/didit/core/RawResponse.java @@ -0,0 +1,69 @@ +package me.didit.core; + +import java.util.Optional; +import org.jspecify.annotations.Nullable; + +/** + * An HTTP response with its parsed body: status, headers and request id (DESIGN 7). + * + * @param the parsed body type + */ +public final class RawResponse { + private final int statusCode; + private final Headers headers; + private final T data; + + /** + * Creates the response. + * + * @param statusCode the HTTP status + * @param headers the response headers + * @param data the parsed body + */ + public RawResponse(int statusCode, Headers headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + * The HTTP status. + * + * @return the status + */ + public int statusCode() { + return statusCode; + } + + /** + * The response headers. + * + * @return the headers + */ + public Headers headers() { + return headers; + } + + /** + * The request id the API assigned, for support requests. + * + * @return the request id, if present + */ + public Optional requestId() { + return headers.requestId(); + } + + /** + * The parsed body; {@code null} for operations without a response body. + * + * @return the body + */ + public T data() { + return data; + } + + @Override + public String toString() { + return "RawResponse{status=" + statusCode + ", requestId=" + requestId().orElse("none") + "}"; + } +} diff --git a/src/main/java/me/didit/core/RequestOptions.java b/src/main/java/me/didit/core/RequestOptions.java new file mode 100644 index 0000000..ee5d938 --- /dev/null +++ b/src/main/java/me/didit/core/RequestOptions.java @@ -0,0 +1,254 @@ +package me.didit.core; + +import java.time.Duration; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jspecify.annotations.Nullable; + +/** + * Options for one request. Anything set here overrides the client options for that request only. + * + *
{@code
+ * client.sessions().create(params, RequestOptions.builder()
+ *     .timeout(Duration.ofSeconds(10))
+ *     .idempotencyKey("order-123")
+ *     .build());
+ * }
+ */ +public final class RequestOptions { + private static final RequestOptions NONE = builder().build(); + + private final @Nullable String apiKey; + private final @Nullable String accountToken; + private final @Nullable String organizationId; + private final @Nullable String applicationId; + private final @Nullable Duration timeout; + private final @Nullable Integer maxRetries; + private final @Nullable String idempotencyKey; + private final Map headers; + private final Map queryParams; + + private RequestOptions(Builder builder) { + this.apiKey = builder.apiKey; + this.accountToken = builder.accountToken; + this.organizationId = builder.organizationId; + this.applicationId = builder.applicationId; + this.timeout = builder.timeout; + this.maxRetries = builder.maxRetries; + this.idempotencyKey = builder.idempotencyKey; + this.headers = Collections.unmodifiableMap(new LinkedHashMap<>(builder.headers)); + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** + * No overrides. + * + * @return options that change nothing + */ + public static RequestOptions none() { + return NONE; + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + Optional apiKey() { + return Optional.ofNullable(apiKey); + } + + Optional accountToken() { + return Optional.ofNullable(accountToken); + } + + Optional organizationId() { + return Optional.ofNullable(organizationId); + } + + Optional applicationId() { + return Optional.ofNullable(applicationId); + } + + Optional timeout() { + return Optional.ofNullable(timeout); + } + + Optional maxRetries() { + return Optional.ofNullable(maxRetries); + } + + /** + * The {@code Idempotency-Key} header for this request. + * + * @return the key, if set + */ + public Optional idempotencyKey() { + return Optional.ofNullable(idempotencyKey); + } + + /** + * Extra headers for this request. + * + * @return header names to values + */ + public Map headers() { + return headers; + } + + /** + * Extra query parameters for this request. + * + * @return parameter names to values + */ + public Map queryParams() { + return queryParams; + } + + @Override + public String toString() { + return "RequestOptions{timeout=" + + timeout + + ", maxRetries=" + + maxRetries + + ", organizationId=" + + organizationId + + ", applicationId=" + + applicationId + + ", headers=" + + headers.keySet() + + "}"; + } + + /** Builds {@link RequestOptions}. */ + public static final class Builder { + private @Nullable String apiKey; + private @Nullable String accountToken; + private @Nullable String organizationId; + private @Nullable String applicationId; + private @Nullable Duration timeout; + private @Nullable Integer maxRetries; + private @Nullable String idempotencyKey; + private final Map headers = new LinkedHashMap<>(); + private final Map queryParams = new LinkedHashMap<>(); + + private Builder() {} + + /** + * Uses another API key for this request. + * + * @param apiKey the API key + * @return this builder + */ + public Builder apiKey(String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey"); + return this; + } + + /** + * Uses another account token for this request ({@code account} operations). + * + * @param accountToken the Bearer token from {@code account().login(...)} + * @return this builder + */ + public Builder accountToken(String accountToken) { + this.accountToken = Objects.requireNonNull(accountToken, "accountToken"); + return this; + } + + /** + * Uses another organization id for this request (application-scoped operations). + * + * @param organizationId the organization id + * @return this builder + */ + public Builder organizationId(String organizationId) { + this.organizationId = Objects.requireNonNull(organizationId, "organizationId"); + return this; + } + + /** + * Uses another application id for this request (application-scoped operations). + * + * @param applicationId the application id + * @return this builder + */ + public Builder applicationId(String applicationId) { + this.applicationId = Objects.requireNonNull(applicationId, "applicationId"); + return this; + } + + /** + * The timeout of each attempt. + * + * @param timeout a positive duration + * @return this builder + */ + public Builder timeout(Duration timeout) { + this.timeout = ClientOptions.positive(timeout, "timeout"); + return this; + } + + /** + * How many times to retry a failed request. + * + * @param maxRetries zero or more + * @return this builder + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = ClientOptions.nonNegative(maxRetries, "maxRetries"); + return this; + } + + /** + * Sends {@code Idempotency-Key}, for the operations that accept one. + * + * @param idempotencyKey a unique key for this logical request + * @return this builder + */ + public Builder idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Objects.requireNonNull(idempotencyKey, "idempotencyKey"); + return this; + } + + /** + * Adds a header to this request. + * + * @param name the header name + * @param value the header value + * @return this builder + */ + public Builder header(String name, String value) { + headers.put(Objects.requireNonNull(name, "name"), Objects.requireNonNull(value, "value")); + return this; + } + + /** + * Adds a query parameter to this request. + * + * @param name the parameter name + * @param value the parameter value + * @return this builder + */ + public Builder queryParam(String name, String value) { + queryParams.put(Objects.requireNonNull(name, "name"), Objects.requireNonNull(value, "value")); + return this; + } + + /** + * Builds the options. + * + * @return the options + */ + public RequestOptions build() { + return new RequestOptions(this); + } + } +} diff --git a/src/main/java/me/didit/core/ResponseHandler.java b/src/main/java/me/didit/core/ResponseHandler.java new file mode 100644 index 0000000..e9a2f33 --- /dev/null +++ b/src/main/java/me/didit/core/ResponseHandler.java @@ -0,0 +1,28 @@ +package me.didit.core; + +import org.jspecify.annotations.Nullable; + +/** + * Turns a successful HTTP response into the value an operation returns. Generated resources pick + * one from {@link Responses}. + * + * @param the value type + */ +public interface ResponseHandler { + /** + * Parses the response. + * + * @param response the successful response; the handler owns its body + * @return the value + */ + T handle(SuccessResponse response); + + /** + * Whether the body is streamed to the caller instead of being read into memory. + * + * @return true for binary responses + */ + default boolean streaming() { + return false; + } +} diff --git a/src/main/java/me/didit/core/Responses.java b/src/main/java/me/didit/core/Responses.java new file mode 100644 index 0000000..473b5e8 --- /dev/null +++ b/src/main/java/me/didit/core/Responses.java @@ -0,0 +1,89 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.function.BiFunction; +import me.didit.errors.UnexpectedResponseException; +import org.jspecify.annotations.Nullable; + +/** The response handlers the generated resources use. */ +public final class Responses { + private Responses() {} + + /** + * A JSON body read with {@code conv}. + * + * @param the body type + * @param conv the converter + * @return the handler + */ + public static ResponseHandler json(Conv conv) { + return response -> { + JsonNode json = response.json(); + if (json.isNull()) { + throw new UnexpectedResponseException( + response.request.describe() + " returned an empty body"); + } + return conv.read(json); + }; + } + + /** + * A JSON body the spec does not describe. + * + * @return the handler + */ + public static ResponseHandler jsonNode() { + return SuccessResponse::json; + } + + /** + * No body. + * + * @return the handler + */ + public static ResponseHandler<@Nullable Void> none() { + return response -> null; + } + + /** + * A binary body, streamed. + * + * @return the handler + */ + public static ResponseHandler binary() { + return new ResponseHandler<>() { + @Override + public BinaryResponse handle(SuccessResponse response) { + return new BinaryResponse(response.headers(), response.stream()); + } + + @Override + public boolean streaming() { + return true; + } + }; + } + + /** + * A body whose shape depends on the status. + * + * @param the response type + * @param fromResponse its {@code fromResponse(status, json)} method + * @return the handler + */ + public static ResponseHandler byStatus(BiFunction fromResponse) { + return response -> fromResponse.apply(response.statusCode(), response.json()); + } + + /** + * A list page with {@code count}, {@code next}, {@code previous} and {@code results}; the next + * page is the {@code next} link. + * + * @param the item type + * @param item the item converter + * @return the handler + */ + public static ResponseHandler> page(Conv item) { + return response -> Page.first(response, item); + } +} diff --git a/src/main/java/me/didit/core/StringEnum.java b/src/main/java/me/didit/core/StringEnum.java new file mode 100644 index 0000000..fbe51ef --- /dev/null +++ b/src/main/java/me/didit/core/StringEnum.java @@ -0,0 +1,77 @@ +package me.didit.core; + +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import org.jspecify.annotations.Nullable; + +/** + * Base class of the generated open enums: a string value with constants for the values this SDK + * version knows. Values from a newer API are kept, never rejected. + */ +public abstract class StringEnum { + private final String value; + + /** + * Creates the value. + * + * @param value the string sent on the wire + */ + protected StringEnum(String value) { + this.value = Objects.requireNonNull(value, "value"); + } + + /** + * Returns the known constant equal to {@code value}, or a new instance. + * + * @param the enum type + * @param known the known constants + * @param value the string value + * @param create creates an instance for an unknown value + * @return the enum value + */ + protected static T lookup( + List known, String value, Function create) { + for (T constant : known) { + if (constant.value().equals(value)) { + return constant; + } + } + return create.apply(value); + } + + /** + * The string sent on the wire. + * + * @return the value + */ + public final String value() { + return value; + } + + /** + * Whether this SDK version declares the value. + * + * @return true for a known value + */ + public abstract boolean isKnown(); + + // Two generated types with the same JSON are still different values. + @SuppressWarnings("EqualsGetClass") + @Override + public final boolean equals(@Nullable Object other) { + return other != null + && other.getClass() == getClass() + && value.equals(((StringEnum) other).value); + } + + @Override + public final int hashCode() { + return value.hashCode(); + } + + @Override + public final String toString() { + return value; + } +} diff --git a/src/main/java/me/didit/core/SuccessResponse.java b/src/main/java/me/didit/core/SuccessResponse.java new file mode 100644 index 0000000..4dd3acd --- /dev/null +++ b/src/main/java/me/didit/core/SuccessResponse.java @@ -0,0 +1,73 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.Locale; + +/** A 2xx response handed to a {@link ResponseHandler}. */ +public final class SuccessResponse { + final ApiClient client; + final ApiRequest request; + final RequestOptions options; + final URI uri; + private final TransportResponse response; + private final byte[] body; + + SuccessResponse( + ApiClient client, + ApiRequest request, + RequestOptions options, + URI uri, + TransportResponse response, + boolean streaming) + throws IOException { + this.client = client; + this.request = request; + this.options = options; + this.uri = uri; + this.response = response; + this.body = streaming ? new byte[0] : response.readBody(); + } + + /** + * The HTTP status. + * + * @return the status + */ + public int statusCode() { + return response.statusCode(); + } + + /** + * The response headers. + * + * @return the headers + */ + public Headers headers() { + return response.headers(); + } + + /** + * The body parsed as JSON. + * + * @return the JSON value; JSON null for an empty body + * @throws me.didit.errors.UnexpectedResponseException when the body is not JSON + */ + public JsonNode json() { + if (body.length == 0) { + return Json.nodes().nullNode(); + } + String contentType = headers().firstValue("Content-Type").orElse("").toLowerCase(Locale.ROOT); + if (!contentType.isEmpty() && !contentType.contains("json")) { + throw new me.didit.errors.UnexpectedResponseException( + request.describe() + " returned " + contentType + " instead of JSON"); + } + return Json.parse(body); + } + + InputStream stream() { + return response.body(); + } +} diff --git a/src/main/java/me/didit/core/TransportRequest.java b/src/main/java/me/didit/core/TransportRequest.java new file mode 100644 index 0000000..23624f2 --- /dev/null +++ b/src/main/java/me/didit/core/TransportRequest.java @@ -0,0 +1,115 @@ +package me.didit.core; + +import java.net.URI; +import java.time.Duration; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** One HTTP request as handed to an {@link HttpTransport}. */ +public final class TransportRequest { + private final String method; + private final URI uri; + private final Map> headers; + private final byte[] body; + private final Duration timeout; + private final boolean streamResponse; + + TransportRequest( + String method, + URI uri, + Map> headers, + byte[] body, + Duration timeout, + boolean streamResponse) { + this.method = method; + this.uri = uri; + this.headers = Collections.unmodifiableMap(new LinkedHashMap<>(headers)); + this.body = body; + this.timeout = timeout; + this.streamResponse = streamResponse; + } + + /** + * Creates a request whose response is read into memory. + * + * @param method the HTTP method + * @param uri the absolute URL + * @param headers header names to values + * @param body the body; empty for none + * @param timeout the time to wait for the response + * @return the request + */ + public static TransportRequest of( + String method, URI uri, Map> headers, byte[] body, Duration timeout) { + return new TransportRequest(method, uri, headers, body.clone(), timeout, false); + } + + /** + * The HTTP method. + * + * @return {@code GET}, {@code POST}, {@code PUT}, {@code PATCH} or {@code DELETE} + */ + public String method() { + return method; + } + + /** + * The absolute URL, with the query string. + * + * @return the URL + */ + public URI uri() { + return uri; + } + + /** + * The request headers, including the credentials. + * + * @return header names to values + */ + public Map> headers() { + return headers; + } + + /** + * The request body. + * + * @return the body bytes; empty when there is no body + */ + public byte[] body() { + return body.clone(); + } + + /** + * The time to wait for the response. + * + * @return the timeout + */ + public Duration timeout() { + return timeout; + } + + /** + * Whether the caller reads the response body as a stream (binary responses). When false the + * transport may buffer the body. + * + * @return true for streamed responses + */ + public boolean streamResponse() { + return streamResponse; + } + + @Override + public String toString() { + return "TransportRequest{" + + method + + " " + + uri.getScheme() + + "://" + + uri.getAuthority() + + uri.getRawPath() + + "}"; + } +} diff --git a/src/main/java/me/didit/core/TransportResponse.java b/src/main/java/me/didit/core/TransportResponse.java new file mode 100644 index 0000000..6486115 --- /dev/null +++ b/src/main/java/me/didit/core/TransportResponse.java @@ -0,0 +1,78 @@ +package me.didit.core; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** One HTTP response as returned by an {@link HttpTransport}. Close it to release the body. */ +public final class TransportResponse implements AutoCloseable { + private final int statusCode; + private final Headers headers; + private final InputStream body; + + /** + * Creates a response. + * + * @param statusCode the HTTP status + * @param headers the response headers + * @param body the response body; closed by {@link #close()} + */ + public TransportResponse(int statusCode, Headers headers, InputStream body) { + this.statusCode = statusCode; + this.headers = headers; + this.body = body; + } + + /** + * Creates a response with an in-memory body. + * + * @param statusCode the HTTP status + * @param headers the response headers + * @param body the response body + */ + public TransportResponse(int statusCode, Headers headers, byte[] body) { + this(statusCode, headers, new ByteArrayInputStream(body.clone())); + } + + /** + * The HTTP status. + * + * @return the status + */ + public int statusCode() { + return statusCode; + } + + /** + * The response headers. + * + * @return the headers + */ + public Headers headers() { + return headers; + } + + /** + * The response body. + * + * @return the body stream + */ + public InputStream body() { + return body; + } + + byte[] readBody() throws IOException { + try (InputStream in = body) { + return in.readAllBytes(); + } + } + + @Override + public void close() { + try { + body.close(); + } catch (IOException e) { + // Nothing useful to do: the response is being discarded. + } + } +} diff --git a/src/main/java/me/didit/core/Version.java b/src/main/java/me/didit/core/Version.java new file mode 100644 index 0000000..922fdbc --- /dev/null +++ b/src/main/java/me/didit/core/Version.java @@ -0,0 +1,9 @@ +package me.didit.core; + +/** The SDK version, sent in {@code User-Agent} and {@code X-Didit-Client}. */ +public final class Version { + /** This SDK's version. */ + public static final String VERSION = "0.1.0"; // x-release-please-version + + private Version() {} +} diff --git a/src/main/java/me/didit/core/package-info.java b/src/main/java/me/didit/core/package-info.java new file mode 100644 index 0000000..6eb88a6 --- /dev/null +++ b/src/main/java/me/didit/core/package-info.java @@ -0,0 +1,8 @@ +/** + * The hand-written core of the SDK: options, HTTP transport, retries, errors, pagination, files and + * the JSON model base classes the generated types build on. + */ +@NullMarked +package me.didit.core; + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/me/didit/errors/ApiConnectionException.java b/src/main/java/me/didit/errors/ApiConnectionException.java new file mode 100644 index 0000000..eb8133b --- /dev/null +++ b/src/main/java/me/didit/errors/ApiConnectionException.java @@ -0,0 +1,18 @@ +package me.didit.errors; + +import org.jspecify.annotations.Nullable; + +/** No HTTP response was received: DNS, TCP, TLS or I/O failure. */ +public class ApiConnectionException extends DiditException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message what failed + * @param cause the underlying I/O error + */ + public ApiConnectionException(String message, @Nullable Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/me/didit/errors/ApiStatusException.java b/src/main/java/me/didit/errors/ApiStatusException.java new file mode 100644 index 0000000..eb2ead7 --- /dev/null +++ b/src/main/java/me/didit/errors/ApiStatusException.java @@ -0,0 +1,137 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.Optional; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** + * The API answered with a status outside 2xx. Subclasses name the common statuses; {@link #create} + * picks the right one. + */ +public class ApiStatusException extends DiditException { + private static final long serialVersionUID = 1L; + + private final int statusCode; + private final transient @Nullable JsonNode body; + private final transient Headers headers; + private final @Nullable String requestId; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param statusCode the HTTP status + * @param body the parsed JSON body, or {@code null} when the body is not JSON + * @param headers the response headers + */ + public ApiStatusException( + String message, int statusCode, @Nullable JsonNode body, Headers headers) { + super(message); + this.statusCode = statusCode; + this.body = body == null ? null : body.deepCopy(); + this.headers = headers; + this.requestId = headers.requestId().orElse(null); + } + + /** + * The HTTP status code. + * + * @return the status + */ + public int statusCode() { + return statusCode; + } + + /** + * The response body parsed as JSON, when it is JSON. + * + * @return a copy of the body + */ + public Optional body() { + return body == null ? Optional.empty() : Optional.of(body.deepCopy()); + } + + /** + * The response headers. + * + * @return the headers + */ + public Headers headers() { + return headers; + } + + /** + * The request id the API assigned, for support requests. + * + * @return the request id, if the response carried one + */ + public Optional requestId() { + return Optional.ofNullable(requestId); + } + + /** + * Builds the exception that matches {@code statusCode}. + * + * @param statusCode the HTTP status + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + * @param context {@code METHOD path} of the request, for the message + * @return the exception to throw + */ + public static ApiStatusException create( + int statusCode, @Nullable JsonNode body, Headers headers, String context) { + String message = message(statusCode, body, headers, context); + switch (statusCode) { + case 400: + return new BadRequestException(message, body, headers); + case 401: + return new AuthenticationException(message, body, headers); + case 403: + return new PermissionDeniedException(message, body, headers); + case 404: + return new NotFoundException(message, body, headers); + case 409: + return new ConflictException(message, body, headers); + case 422: + return new UnprocessableEntityException(message, body, headers); + case 429: + return new RateLimitException(message, body, headers); + default: + if (statusCode >= 500) { + return new InternalServerException(message, statusCode, body, headers); + } + return new ApiStatusException(message, statusCode, body, headers); + } + } + + private static String message( + int statusCode, @Nullable JsonNode body, Headers headers, String context) { + StringBuilder out = new StringBuilder(); + out.append(context).append(" failed with status ").append(statusCode); + String detail = detail(body); + if (!detail.isEmpty()) { + out.append(": ").append(detail); + } + headers.requestId().ifPresent(id -> out.append(" (request id ").append(id).append(')')); + return out.toString(); + } + + private static String detail(@Nullable JsonNode body) { + if (body == null) { + return ""; + } + for (String key : new String[] {"detail", "error_description", "message", "error"}) { + JsonNode value = body.get(key); + if (value != null && value.isTextual() && !value.asText().isEmpty()) { + return truncate(value.asText()); + } + } + String text = body.toString(); + return truncate(text); + } + + private static String truncate(String text) { + return text.length() > 300 ? text.substring(0, 300) + "..." : text; + } +} diff --git a/src/main/java/me/didit/errors/ApiTimeoutException.java b/src/main/java/me/didit/errors/ApiTimeoutException.java new file mode 100644 index 0000000..faf48c7 --- /dev/null +++ b/src/main/java/me/didit/errors/ApiTimeoutException.java @@ -0,0 +1,18 @@ +package me.didit.errors; + +import org.jspecify.annotations.Nullable; + +/** The request timed out before a complete response was received. */ +public class ApiTimeoutException extends ApiConnectionException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message what timed out + * @param cause the underlying timeout, if any + */ + public ApiTimeoutException(String message, @Nullable Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/me/didit/errors/AuthenticationException.java b/src/main/java/me/didit/errors/AuthenticationException.java new file mode 100644 index 0000000..7ab01c4 --- /dev/null +++ b/src/main/java/me/didit/errors/AuthenticationException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The API key or token is missing, wrong, revoked or expired (401). */ +public class AuthenticationException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public AuthenticationException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 401, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/BadRequestException.java b/src/main/java/me/didit/errors/BadRequestException.java new file mode 100644 index 0000000..f1d7e14 --- /dev/null +++ b/src/main/java/me/didit/errors/BadRequestException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The request was invalid (400). */ +public class BadRequestException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public BadRequestException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 400, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/ConfigurationException.java b/src/main/java/me/didit/errors/ConfigurationException.java new file mode 100644 index 0000000..c1b0347 --- /dev/null +++ b/src/main/java/me/didit/errors/ConfigurationException.java @@ -0,0 +1,18 @@ +package me.didit.errors; + +/** + * The client or the call is misconfigured: a missing API key, organization id or application id, an + * empty webhook secret or an invalid path parameter. Thrown before any request is sent. + */ +public class ConfigurationException extends DiditException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message what is missing or invalid + */ + public ConfigurationException(String message) { + super(message); + } +} diff --git a/src/main/java/me/didit/errors/ConflictException.java b/src/main/java/me/didit/errors/ConflictException.java new file mode 100644 index 0000000..b9c7f53 --- /dev/null +++ b/src/main/java/me/didit/errors/ConflictException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The request conflicts with the current state of the resource (409). */ +public class ConflictException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public ConflictException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 409, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/DiditException.java b/src/main/java/me/didit/errors/DiditException.java new file mode 100644 index 0000000..9b70045 --- /dev/null +++ b/src/main/java/me/didit/errors/DiditException.java @@ -0,0 +1,27 @@ +package me.didit.errors; + +import org.jspecify.annotations.Nullable; + +/** Base class of every exception thrown by the Didit SDK. */ +public class DiditException extends RuntimeException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message what went wrong; never contains the API key + */ + public DiditException(String message) { + super(message); + } + + /** + * Creates the exception. + * + * @param message what went wrong; never contains the API key + * @param cause the underlying cause + */ + public DiditException(String message, @Nullable Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/me/didit/errors/InternalServerException.java b/src/main/java/me/didit/errors/InternalServerException.java new file mode 100644 index 0000000..401e483 --- /dev/null +++ b/src/main/java/me/didit/errors/InternalServerException.java @@ -0,0 +1,23 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The API failed (5xx). Idempotent requests were already retried. */ +public class InternalServerException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param statusCode the HTTP status, 500 or above + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public InternalServerException( + String message, int statusCode, @Nullable JsonNode body, Headers headers) { + super(message, statusCode, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/NotFoundException.java b/src/main/java/me/didit/errors/NotFoundException.java new file mode 100644 index 0000000..051d7d6 --- /dev/null +++ b/src/main/java/me/didit/errors/NotFoundException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The resource does not exist or is outside the credentials' scope (404). */ +public class NotFoundException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public NotFoundException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 404, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/PermissionDeniedException.java b/src/main/java/me/didit/errors/PermissionDeniedException.java new file mode 100644 index 0000000..d58952e --- /dev/null +++ b/src/main/java/me/didit/errors/PermissionDeniedException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The credentials have no access to this resource or action (403). */ +public class PermissionDeniedException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public PermissionDeniedException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 403, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/RateLimitException.java b/src/main/java/me/didit/errors/RateLimitException.java new file mode 100644 index 0000000..528cbf5 --- /dev/null +++ b/src/main/java/me/didit/errors/RateLimitException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** Too many requests (429). The SDK already retried; slow down. */ +public class RateLimitException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public RateLimitException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 429, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/TokenVerificationException.java b/src/main/java/me/didit/errors/TokenVerificationException.java new file mode 100644 index 0000000..e5b6a28 --- /dev/null +++ b/src/main/java/me/didit/errors/TokenVerificationException.java @@ -0,0 +1,74 @@ +package me.didit.errors; + +/** + * An Authentication token failed verification (DESIGN 10). Treat the request as unauthenticated; + * {@link #reason()} says why. + */ +public class TokenVerificationException extends DiditException { + private static final long serialVersionUID = 1L; + + /** Why a token was rejected. */ + public enum Reason { + /** Not a well-formed JWT. */ + MALFORMED("malformed"), + /** The algorithm is not ES256. */ + UNSUPPORTED_ALGORITHM("unsupported_algorithm"), + /** The {@code typ} header does not match the token kind. */ + INVALID_TYPE("invalid_type"), + /** No published key has the token's {@code kid}. */ + UNKNOWN_KEY("unknown_key"), + /** The signature does not match. */ + INVALID_SIGNATURE("invalid_signature"), + /** {@code iss} is not the issuer. */ + INVALID_ISSUER("invalid_issuer"), + /** {@code aud} does not contain the expected audience. */ + INVALID_AUDIENCE("invalid_audience"), + /** {@code exp} has passed. */ + EXPIRED("expired"), + /** {@code nbf} is in the future. */ + NOT_YET_VALID("not_yet_valid"), + /** {@code iat} is in the future. */ + INVALID_ISSUED_AT("invalid_issued_at"), + /** {@code nonce} differs from the one sent with the sign-in. */ + INVALID_NONCE("invalid_nonce"), + /** A required claim is missing. */ + MISSING_CLAIM("missing_claim"); + + private final String code; + + Reason(String code) { + this.code = code; + } + + /** + * The machine-readable code shared by every Didit SDK. + * + * @return for example {@code expired} + */ + public String code() { + return code; + } + } + + private final Reason reason; + + /** + * Creates the exception. + * + * @param reason why the token was rejected + * @param message a human-readable explanation; never contains the token + */ + public TokenVerificationException(Reason reason, String message) { + super(message); + this.reason = reason; + } + + /** + * Why the token was rejected. + * + * @return the reason + */ + public Reason reason() { + return reason; + } +} diff --git a/src/main/java/me/didit/errors/UnexpectedResponseException.java b/src/main/java/me/didit/errors/UnexpectedResponseException.java new file mode 100644 index 0000000..f5d7fcb --- /dev/null +++ b/src/main/java/me/didit/errors/UnexpectedResponseException.java @@ -0,0 +1,31 @@ +package me.didit.errors; + +import org.jspecify.annotations.Nullable; + +/** + * The API answered something this SDK cannot use: a success body that is not JSON, a field with an + * unexpected type, a required field that is missing, or a next page link to another origin or back + * to a page already read. + */ +public class UnexpectedResponseException extends DiditException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message what was unexpected + */ + public UnexpectedResponseException(String message) { + super(message); + } + + /** + * Creates the exception. + * + * @param message what was unexpected + * @param cause the parsing error + */ + public UnexpectedResponseException(String message, @Nullable Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/me/didit/errors/UnprocessableEntityException.java b/src/main/java/me/didit/errors/UnprocessableEntityException.java new file mode 100644 index 0000000..3a31378 --- /dev/null +++ b/src/main/java/me/didit/errors/UnprocessableEntityException.java @@ -0,0 +1,21 @@ +package me.didit.errors; + +import com.fasterxml.jackson.databind.JsonNode; +import me.didit.core.Headers; +import org.jspecify.annotations.Nullable; + +/** The request was well formed but could not be processed (422). */ +public class UnprocessableEntityException extends ApiStatusException { + private static final long serialVersionUID = 1L; + + /** + * Creates the exception. + * + * @param message a summary of the failure + * @param body the parsed JSON body, or {@code null} + * @param headers the response headers + */ + public UnprocessableEntityException(String message, @Nullable JsonNode body, Headers headers) { + super(message, 422, body, headers); + } +} diff --git a/src/main/java/me/didit/errors/WebhookVerificationException.java b/src/main/java/me/didit/errors/WebhookVerificationException.java new file mode 100644 index 0000000..ea8d0d0 --- /dev/null +++ b/src/main/java/me/didit/errors/WebhookVerificationException.java @@ -0,0 +1,62 @@ +package me.didit.errors; + +/** + * A webhook delivery failed verification (DESIGN 9.3). Answer it with 400 or 401 and do not act on + * its content; {@link #reason()} says why. + */ +public class WebhookVerificationException extends DiditException { + private static final long serialVersionUID = 1L; + + /** Why a delivery was rejected. */ + public enum Reason { + /** No signature header at all. */ + MISSING_SIGNATURE("missing_signature"), + /** No signature matched any secret. */ + INVALID_SIGNATURE("invalid_signature"), + /** The body has no integer {@code timestamp}. */ + MISSING_TIMESTAMP("missing_timestamp"), + /** {@code X-Timestamp} differs from the body's {@code timestamp}. */ + TIMESTAMP_MISMATCH("timestamp_mismatch"), + /** The timestamp is further from now than the tolerance. */ + TIMESTAMP_OUT_OF_TOLERANCE("timestamp_out_of_tolerance"), + /** The body is not a UTF-8 JSON object Didit could have sent. */ + INVALID_PAYLOAD("invalid_payload"); + + private final String code; + + Reason(String code) { + this.code = code; + } + + /** + * The machine-readable code shared by every Didit SDK. + * + * @return for example {@code invalid_signature} + */ + public String code() { + return code; + } + } + + private final Reason reason; + + /** + * Creates the exception. + * + * @param reason why the delivery was rejected + * @param message a human-readable explanation + */ + public WebhookVerificationException(Reason reason, String message) { + super(message); + this.reason = reason; + } + + /** + * Why the delivery was rejected. + * + * @return the reason + */ + public Reason reason() { + return reason; + } +} diff --git a/src/main/java/me/didit/errors/package-info.java b/src/main/java/me/didit/errors/package-info.java new file mode 100644 index 0000000..f973d1d --- /dev/null +++ b/src/main/java/me/didit/errors/package-info.java @@ -0,0 +1,8 @@ +/** + * The exceptions thrown by the SDK. Every one extends {@link me.didit.errors.DiditException}, an + * unchecked exception. + */ +@NullMarked +package me.didit.errors; + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/me/didit/package-info.java b/src/main/java/me/didit/package-info.java new file mode 100644 index 0000000..fa67006 --- /dev/null +++ b/src/main/java/me/didit/package-info.java @@ -0,0 +1,11 @@ +/** + * The official Didit Java and Kotlin library. Start with {@link me.didit.Didit}. + * + *

Packages: {@code me.didit.resources} and {@code me.didit.types} (generated from the OpenAPI + * documents), {@code me.didit.core} (options, transport, pagination, files), {@code + * me.didit.errors}, {@code me.didit.webhooks} and {@code me.didit.authentication}. + */ +@NullMarked +package me.didit; + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/me/didit/resources/AccountApplicationsResource.java b/src/main/java/me/didit/resources/AccountApplicationsResource.java new file mode 100644 index 0000000..06cedb1 --- /dev/null +++ b/src/main/java/me/didit/resources/AccountApplicationsResource.java @@ -0,0 +1,558 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.Application; +import me.didit.types.ApplicationCreateRequest; +import me.didit.types.ApplicationUpdateRequest; + +/** The {@code account.applications} resource: {@code client.account().applications()}. */ +public final class AccountApplicationsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + AccountApplicationsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List the organization's applications + * + *

List every application in the organization. Use this to discover app_id values when recovering credentials from a new machine โ€” follow with GET /organizations/me/{org_id}/applications/{app_id}/ for the API key. Requires an owner or admin Bearer token. + * + *

{@code GET /organizations/me/{org_id}/applications/} + * + * @param orgId UUID of the organization. Look it up with `GET /organizations/me/`. + * @param options per-request options that override the client options + * @return the response body + */ + public JsonNode list(String orgId, RequestOptions options) { + return client.execute(listRequest(orgId), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)}. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listAsync(String orgId, RequestOptions options) { + return client.executeAsync(listRequest(orgId), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @return the result + */ + public JsonNode list(String orgId) { + return client.execute(listRequest(orgId), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @return a future completed with the result + */ + public CompletableFuture listAsync(String orgId) { + return client.executeAsync(listRequest(orgId), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create Application + * + *

Create an application inside an organization. The response includes api_key; persist it now (recoverable via GET). Requires owner/admin JWT. + * + *

{@code POST /organizations/me/{org_id}/applications/} + * + * @param orgId UUID of the organization. Look it up with `GET /organizations/me/`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Application create(String orgId, ApplicationCreateRequest params, RequestOptions options) { + return client.execute(createRequest(orgId, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)}. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String orgId, ApplicationCreateRequest params, RequestOptions options) { + return client.executeAsync(createRequest(orgId, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, ApplicationCreateRequest, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @return the result + */ + public Application create(String orgId, ApplicationCreateRequest params) { + return client.execute(createRequest(orgId, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String orgId, ApplicationCreateRequest params) { + return client.executeAsync(createRequest(orgId, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, ApplicationCreateRequest, RequestOptions)}, without parameters. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return the result + */ + public Application create(String orgId, RequestOptions options) { + return client.execute(createRequest(orgId, ApplicationCreateRequest.builder().build()), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)}, without parameters. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String orgId, RequestOptions options) { + return client.executeAsync(createRequest(orgId, ApplicationCreateRequest.builder().build()), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, ApplicationCreateRequest, RequestOptions)}, without parameters, with the client's options. + * + * @param orgId the {@code org_id} + * @return the result + */ + public Application create(String orgId) { + return client.execute(createRequest(orgId, ApplicationCreateRequest.builder().build()), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)}, without parameters, with the client's options. + * + * @param orgId the {@code org_id} + * @return a future completed with the result + */ + public CompletableFuture createAsync(String orgId) { + return client.executeAsync(createRequest(orgId, ApplicationCreateRequest.builder().build()), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get Application Credentials + * + *

Read one application's full record including client_id and api_key. Use this to recover a lost api_key. + * + *

{@code GET /organizations/me/{org_id}/applications/{app_id}/} + * + * @param orgId UUID of the organization that owns the application. + * @param appId UUID of the application whose credentials you want to read. + * @param options per-request options that override the client options + * @return the response body + */ + public Application retrieve(String orgId, String appId, RequestOptions options) { + return client.execute(retrieveRequest(orgId, appId), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, String, RequestOptions)}. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String orgId, String appId, RequestOptions options) { + return client.executeAsync(retrieveRequest(orgId, appId), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, String, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @return the result + */ + public Application retrieve(String orgId, String appId) { + return client.execute(retrieveRequest(orgId, appId), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, String, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String orgId, String appId) { + return client.executeAsync(retrieveRequest(orgId, appId), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update Application + * + *

Update application metadata (name, URLs, redirect URIs). api_key and client_id are never rotated. Requires owner/admin JWT. + * + *

{@code PATCH /organizations/me/{org_id}/applications/{app_id}/} + * + * @param orgId UUID of the organization that owns the application. + * @param appId UUID of the application to update. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Application update(String orgId, String appId, ApplicationUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(orgId, appId, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)}. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String orgId, String appId, ApplicationUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(orgId, appId, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @return the result + */ + public Application update(String orgId, String appId, ApplicationUpdateRequest params) { + return client.execute(updateRequest(orgId, appId, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)}, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String orgId, String appId, ApplicationUpdateRequest params) { + return client.executeAsync(updateRequest(orgId, appId, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler LIST_RESPONSE = Responses.jsonNode(); + + private static ApiRequest listRequest(String orgId) { + return ApiRequest.builder("GET", "/organizations/me/{org_id}/applications/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .pathParam("org_id", orgId) + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(Application::fromJson)); + + private static ApiRequest createRequest(String orgId, ApplicationCreateRequest params) { + return ApiRequest.builder("POST", "/organizations/me/{org_id}/applications/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .pathParam("org_id", orgId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(Application::fromJson)); + + private static ApiRequest retrieveRequest(String orgId, String appId) { + return ApiRequest.builder("GET", "/organizations/me/{org_id}/applications/{app_id}/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .pathParam("org_id", orgId) + .pathParam("app_id", appId) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(Application::fromJson)); + + private static ApiRequest updateRequest(String orgId, String appId, ApplicationUpdateRequest params) { + return ApiRequest.builder("PATCH", "/organizations/me/{org_id}/applications/{app_id}/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .pathParam("org_id", orgId) + .pathParam("app_id", appId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code account.applications} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return the result + */ + public RawResponse list(String orgId, RequestOptions options) { + return client.execute(listRequest(orgId), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String orgId, RequestOptions options) { + return client.executeAsync(listRequest(orgId), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @return the result + */ + public RawResponse list(String orgId) { + return client.execute(listRequest(orgId), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String orgId) { + return client.executeAsync(listRequest(orgId), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String orgId, ApplicationCreateRequest params, RequestOptions options) { + return client.execute(createRequest(orgId, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String orgId, ApplicationCreateRequest params, RequestOptions options) { + return client.executeAsync(createRequest(orgId, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String orgId, ApplicationCreateRequest params) { + return client.execute(createRequest(orgId, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String orgId, ApplicationCreateRequest params) { + return client.executeAsync(createRequest(orgId, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response, without parameters. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return the result + */ + public RawResponse create(String orgId, RequestOptions options) { + return client.execute(createRequest(orgId, ApplicationCreateRequest.builder().build()), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response, without parameters. + * + * @param orgId the {@code org_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String orgId, RequestOptions options) { + return client.executeAsync(createRequest(orgId, ApplicationCreateRequest.builder().build()), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param orgId the {@code org_id} + * @return the result + */ + public RawResponse create(String orgId) { + return client.execute(createRequest(orgId, ApplicationCreateRequest.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, ApplicationCreateRequest, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param orgId the {@code org_id} + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String orgId) { + return client.executeAsync(createRequest(orgId, ApplicationCreateRequest.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, String, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String orgId, String appId, RequestOptions options) { + return client.execute(retrieveRequest(orgId, appId), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, String, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String orgId, String appId, RequestOptions options) { + return client.executeAsync(retrieveRequest(orgId, appId), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @return the result + */ + public RawResponse retrieve(String orgId, String appId) { + return client.execute(retrieveRequest(orgId, appId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String orgId, String appId) { + return client.executeAsync(retrieveRequest(orgId, appId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String orgId, String appId, ApplicationUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(orgId, appId, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)} with the raw response. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String orgId, String appId, ApplicationUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(orgId, appId, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String orgId, String appId, ApplicationUpdateRequest params) { + return client.execute(updateRequest(orgId, appId, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, String, ApplicationUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param orgId the {@code org_id} + * @param appId the {@code app_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String orgId, String appId, ApplicationUpdateRequest params) { + return client.executeAsync(updateRequest(orgId, appId, params), RequestOptions.none(), UPDATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/AccountOrganizationsResource.java b/src/main/java/me/didit/resources/AccountOrganizationsResource.java new file mode 100644 index 0000000..4fc8373 --- /dev/null +++ b/src/main/java/me/didit/resources/AccountOrganizationsResource.java @@ -0,0 +1,131 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.Organization; + +/** The {@code account.organizations} resource: {@code client.account().organizations()}. */ +public final class AccountOrganizationsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + AccountOrganizationsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List My Organizations + * + *

List organizations the authenticated user belongs to. Each entry's uuid is the org_id used on the application endpoints. + * + *

{@code GET /organizations/me/} + * + * @param options per-request options that override the client options + * @return the response body + */ + public List list(RequestOptions options) { + return client.execute(listRequest(), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(RequestOptions)}, with the client's options. + * + * @return the result + */ + public List list() { + return client.execute(listRequest(), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.json(Conv.list(Conv.model(Organization::fromJson))); + + private static ApiRequest listRequest() { + return ApiRequest.builder("GET", "/organizations/me/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .build(); + } + + /** The {@code account.organizations} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(), options, LIST_RESPONSE); + } + + /** + * {@link #list(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(), RequestOptions.none(), LIST_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/AccountResource.java b/src/main/java/me/didit/resources/AccountResource.java new file mode 100644 index 0000000..e2201a2 --- /dev/null +++ b/src/main/java/me/didit/resources/AccountResource.java @@ -0,0 +1,468 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.AccountResendOtpParams; +import me.didit.types.LoginRequest; +import me.didit.types.LoginResponse; +import me.didit.types.RegisterRequest; +import me.didit.types.RegisterResponse; +import me.didit.types.VerifyEmailRequest; +import me.didit.types.VerifyEmailResponse; + +/** The {@code account} resource: {@code client.account()}. */ +public final class AccountResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + private final AccountApplicationsResource applications; + private final AccountOrganizationsResource organizations; + + AccountResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + this.applications = new AccountApplicationsResource(client); + this.organizations = new AccountOrganizationsResource(client); + } + + /** + * The {@code account.applications} resource. + * + * @return the resource + */ + public AccountApplicationsResource applications() { + return applications; + } + + /** + * The {@code account.organizations} resource. + * + * @return the resource + */ + public AccountOrganizationsResource organizations() { + return organizations; + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Register Account + * + *

Step 1 of programmatic onboarding. Creates a pending account and emails a 6-char code (10 min TTL). Rate limit: 5/IP/hour. + * + *

{@code POST /programmatic/register/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RegisterResponse register(RegisterRequest params, RequestOptions options) { + return client.execute(registerRequest(params), options, REGISTER_RESPONSE).data(); + } + + /** + * Asynchronous {@link #register(RegisterRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture registerAsync(RegisterRequest params, RequestOptions options) { + return client.executeAsync(registerRequest(params), options, REGISTER_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #register(RegisterRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RegisterResponse register(RegisterRequest params) { + return client.execute(registerRequest(params), RequestOptions.none(), REGISTER_RESPONSE).data(); + } + + /** + * Asynchronous {@link #register(RegisterRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture registerAsync(RegisterRequest params) { + return client.executeAsync(registerRequest(params), RequestOptions.none(), REGISTER_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Verify Email and Issue Credentials + * + *

Step 2 of onboarding. Exchanges the 6-char code for a verified account, a default org+app, and a JWT pair. Persist the returned api_key. + * + *

{@code POST /programmatic/verify-email/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public VerifyEmailResponse verifyEmail(VerifyEmailRequest params, RequestOptions options) { + return client.execute(verifyEmailRequest(params), options, VERIFY_EMAIL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #verifyEmail(VerifyEmailRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture verifyEmailAsync(VerifyEmailRequest params, RequestOptions options) { + return client.executeAsync(verifyEmailRequest(params), options, VERIFY_EMAIL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #verifyEmail(VerifyEmailRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public VerifyEmailResponse verifyEmail(VerifyEmailRequest params) { + return client.execute(verifyEmailRequest(params), RequestOptions.none(), VERIFY_EMAIL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #verifyEmail(VerifyEmailRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture verifyEmailAsync(VerifyEmailRequest params) { + return client.executeAsync(verifyEmailRequest(params), RequestOptions.none(), VERIFY_EMAIL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Programmatic Login + * + *

Authenticate any verified email/password Didit account and receive an RS256 JWT pair (default lifetime 86400s). Console-created email/password accounts can use this endpoint; OAuth-only console accounts must set a password first. + * + *

{@code POST /programmatic/login/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public LoginResponse login(LoginRequest params, RequestOptions options) { + return client.execute(loginRequest(params), options, LOGIN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #login(LoginRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture loginAsync(LoginRequest params, RequestOptions options) { + return client.executeAsync(loginRequest(params), options, LOGIN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #login(LoginRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public LoginResponse login(LoginRequest params) { + return client.execute(loginRequest(params), RequestOptions.none(), LOGIN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #login(LoginRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture loginAsync(LoginRequest params) { + return client.executeAsync(loginRequest(params), RequestOptions.none(), LOGIN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Resend the email verification code + * + *

Resend the 6-character verification code for an unverified programmatic account. Requires the account's email and password so only the owner can trigger a new code (no console Basic Auth). A fresh code replaces the previous one and is valid for 10 minutes. + * + *

Rate limits: a per-email cooldown of 60 seconds between resends (HTTP 429 with Retry-After), and the same 5-per-IP-per-hour budget as registration. + * + *

{@code POST /programmatic/resend-otp/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public JsonNode resendOtp(AccountResendOtpParams params, RequestOptions options) { + return client.execute(resendOtpRequest(params), options, RESEND_OTP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #resendOtp(AccountResendOtpParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture resendOtpAsync(AccountResendOtpParams params, RequestOptions options) { + return client.executeAsync(resendOtpRequest(params), options, RESEND_OTP_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #resendOtp(AccountResendOtpParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public JsonNode resendOtp(AccountResendOtpParams params) { + return client.execute(resendOtpRequest(params), RequestOptions.none(), RESEND_OTP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #resendOtp(AccountResendOtpParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture resendOtpAsync(AccountResendOtpParams params) { + return client.executeAsync(resendOtpRequest(params), RequestOptions.none(), RESEND_OTP_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler REGISTER_RESPONSE = Responses.json(Conv.model(RegisterResponse::fromJson)); + + private static ApiRequest registerRequest(RegisterRequest params) { + return ApiRequest.builder("POST", "/programmatic/register/") + .account() + .auth(ApiRequest.Auth.NONE) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler VERIFY_EMAIL_RESPONSE = Responses.json(Conv.model(VerifyEmailResponse::fromJson)); + + private static ApiRequest verifyEmailRequest(VerifyEmailRequest params) { + return ApiRequest.builder("POST", "/programmatic/verify-email/") + .account() + .auth(ApiRequest.Auth.NONE) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LOGIN_RESPONSE = Responses.json(Conv.model(LoginResponse::fromJson)); + + private static ApiRequest loginRequest(LoginRequest params) { + return ApiRequest.builder("POST", "/programmatic/login/") + .account() + .auth(ApiRequest.Auth.NONE) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RESEND_OTP_RESPONSE = Responses.jsonNode(); + + private static ApiRequest resendOtpRequest(AccountResendOtpParams params) { + return ApiRequest.builder("POST", "/programmatic/resend-otp/") + .account() + .auth(ApiRequest.Auth.NONE) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code account} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #register(RegisterRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse register(RegisterRequest params, RequestOptions options) { + return client.execute(registerRequest(params), options, REGISTER_RESPONSE); + } + + /** + * Asynchronous {@link #register(RegisterRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> registerAsync(RegisterRequest params, RequestOptions options) { + return client.executeAsync(registerRequest(params), options, REGISTER_RESPONSE); + } + + /** + * {@link #register(RegisterRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse register(RegisterRequest params) { + return client.execute(registerRequest(params), RequestOptions.none(), REGISTER_RESPONSE); + } + + /** + * Asynchronous {@link #register(RegisterRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> registerAsync(RegisterRequest params) { + return client.executeAsync(registerRequest(params), RequestOptions.none(), REGISTER_RESPONSE); + } + + /** + * {@link #verifyEmail(VerifyEmailRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse verifyEmail(VerifyEmailRequest params, RequestOptions options) { + return client.execute(verifyEmailRequest(params), options, VERIFY_EMAIL_RESPONSE); + } + + /** + * Asynchronous {@link #verifyEmail(VerifyEmailRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> verifyEmailAsync(VerifyEmailRequest params, RequestOptions options) { + return client.executeAsync(verifyEmailRequest(params), options, VERIFY_EMAIL_RESPONSE); + } + + /** + * {@link #verifyEmail(VerifyEmailRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse verifyEmail(VerifyEmailRequest params) { + return client.execute(verifyEmailRequest(params), RequestOptions.none(), VERIFY_EMAIL_RESPONSE); + } + + /** + * Asynchronous {@link #verifyEmail(VerifyEmailRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> verifyEmailAsync(VerifyEmailRequest params) { + return client.executeAsync(verifyEmailRequest(params), RequestOptions.none(), VERIFY_EMAIL_RESPONSE); + } + + /** + * {@link #login(LoginRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse login(LoginRequest params, RequestOptions options) { + return client.execute(loginRequest(params), options, LOGIN_RESPONSE); + } + + /** + * Asynchronous {@link #login(LoginRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> loginAsync(LoginRequest params, RequestOptions options) { + return client.executeAsync(loginRequest(params), options, LOGIN_RESPONSE); + } + + /** + * {@link #login(LoginRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse login(LoginRequest params) { + return client.execute(loginRequest(params), RequestOptions.none(), LOGIN_RESPONSE); + } + + /** + * Asynchronous {@link #login(LoginRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> loginAsync(LoginRequest params) { + return client.executeAsync(loginRequest(params), RequestOptions.none(), LOGIN_RESPONSE); + } + + /** + * {@link #resendOtp(AccountResendOtpParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse resendOtp(AccountResendOtpParams params, RequestOptions options) { + return client.execute(resendOtpRequest(params), options, RESEND_OTP_RESPONSE); + } + + /** + * Asynchronous {@link #resendOtp(AccountResendOtpParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> resendOtpAsync(AccountResendOtpParams params, RequestOptions options) { + return client.executeAsync(resendOtpRequest(params), options, RESEND_OTP_RESPONSE); + } + + /** + * {@link #resendOtp(AccountResendOtpParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse resendOtp(AccountResendOtpParams params) { + return client.execute(resendOtpRequest(params), RequestOptions.none(), RESEND_OTP_RESPONSE); + } + + /** + * Asynchronous {@link #resendOtp(AccountResendOtpParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> resendOtpAsync(AccountResendOtpParams params) { + return client.executeAsync(resendOtpRequest(params), RequestOptions.none(), RESEND_OTP_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/AgeEstimationResource.java b/src/main/java/me/didit/resources/AgeEstimationResource.java new file mode 100644 index 0000000..5d43973 --- /dev/null +++ b/src/main/java/me/didit/resources/AgeEstimationResource.java @@ -0,0 +1,153 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.AgeEstimationEstimateParams; +import me.didit.types.AgeEstimationEstimateResponse; + +/** The {@code age_estimation} resource: {@code client.ageEstimation()}. */ +public final class AgeEstimationResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + AgeEstimationResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Age Estimation (face age + passive liveness) + * + *

Estimate a person's age from a single face photo and run a passive liveness check in the same call โ€” returns the model-predicted age_estimation (in years), a liveness score (0โ€“100), and an Approved/Declined status. The age is model-predicted from the face, not verified against a document โ€” use it for age gates and low-friction checks, not as legal proof of age. + * + *

How it works. The image is analyzed for faces (set rotate_image=true if captures may be sideways or upside down); each detected face gets an estimated age, and the largest face in the frame drives age_estimation. In parallel, a passive liveness model scores whether the photo shows a live person (no user challenge required) and detects presentation attacks (photos of photos, screens, masks). Submit one clear, front-facing, well-lit face per image for best results. + * + *

Decision logic. Any warning declines: status is Approved only when the warnings array is empty. A liveness score at or below face_liveness_score_decline_threshold (default 30) adds LOW_LIVENESS_SCORE; a detected attack adds LIVENESS_FACE_ATTACK; no face found by the liveness model adds NO_FACE_DETECTED; no estimable face age adds AGE_NOT_DETECTED (age_estimation is null); an estimated age below age_estimation_decline_threshold (default 18) adds AGE_BELOW_MINIMUM. Borderline ages near your threshold deserve a fallback to document-based verification โ€” the model's error grows for faces close to the limit. + * + *

Billing. Each 200 response consumes one Age Estimation API credit (standalone APIs have no free tier). When the organization's balance cannot cover the call, the endpoint returns 403 with the not-enough-credits error before any image processing. + * + *

**Session persistence (save_api_request, default true).** When true, the call is persisted as an API-type session: it appears in the Business Console, the returned request_id is a real session id you can pass to GET /v3/session/{sessionId}/decision/ (the result is exposed there in liveness_checks[], with features: ["AGE_ESTIMATION"]), the face crop and reference image are stored, the face embedding is added to your application's face index (used by face search and duplicate detection), and a status.updated webhook is emitted. When false, nothing is stored and request_id is a one-off correlation UUID that cannot be looked up later. + * + *

Sandbox. Sandbox API keys skip all processing and billing: after request validation (malformed input still returns 400), the endpoint returns a static Approved mock payload (age_estimation: 30, no warnings), no session is persisted, and no credits are consumed. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

{@code POST /v3/age-estimation/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public AgeEstimationEstimateResponse estimate(AgeEstimationEstimateParams params, RequestOptions options) { + return client.execute(estimateRequest(params), options, ESTIMATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #estimate(AgeEstimationEstimateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture estimateAsync(AgeEstimationEstimateParams params, RequestOptions options) { + return client.executeAsync(estimateRequest(params), options, ESTIMATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #estimate(AgeEstimationEstimateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public AgeEstimationEstimateResponse estimate(AgeEstimationEstimateParams params) { + return client.execute(estimateRequest(params), RequestOptions.none(), ESTIMATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #estimate(AgeEstimationEstimateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture estimateAsync(AgeEstimationEstimateParams params) { + return client.executeAsync(estimateRequest(params), RequestOptions.none(), ESTIMATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler ESTIMATE_RESPONSE = Responses.json(Conv.model(AgeEstimationEstimateResponse::fromJson)); + + private static ApiRequest estimateRequest(AgeEstimationEstimateParams params) { + return ApiRequest.builder("POST", "/v3/age-estimation/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code age_estimation} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #estimate(AgeEstimationEstimateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse estimate(AgeEstimationEstimateParams params, RequestOptions options) { + return client.execute(estimateRequest(params), options, ESTIMATE_RESPONSE); + } + + /** + * Asynchronous {@link #estimate(AgeEstimationEstimateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> estimateAsync(AgeEstimationEstimateParams params, RequestOptions options) { + return client.executeAsync(estimateRequest(params), options, ESTIMATE_RESPONSE); + } + + /** + * {@link #estimate(AgeEstimationEstimateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse estimate(AgeEstimationEstimateParams params) { + return client.execute(estimateRequest(params), RequestOptions.none(), ESTIMATE_RESPONSE); + } + + /** + * Asynchronous {@link #estimate(AgeEstimationEstimateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> estimateAsync(AgeEstimationEstimateParams params) { + return client.executeAsync(estimateRequest(params), RequestOptions.none(), ESTIMATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/AmlMonitoringResource.java b/src/main/java/me/didit/resources/AmlMonitoringResource.java new file mode 100644 index 0000000..1e685ca --- /dev/null +++ b/src/main/java/me/didit/resources/AmlMonitoringResource.java @@ -0,0 +1,137 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.AmlMonitoringRetrieveJobResponse; + +/** The {@code aml_monitoring} resource: {@code client.amlMonitoring()}. */ +public final class AmlMonitoringResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + AmlMonitoringResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Get AML ongoing monitoring job + * + *

Status, outcome counters and per-record results of a monitoring toggle job started from POST /v3/users/aml-monitoring/ or POST /v3/businesses/aml-monitoring/. Poll every couple of seconds while status is PENDING or PROCESSING; results is complete once it is COMPLETED. + * + *

{@code GET /v3/aml-monitoring/jobs/{job_id}/} + * + * @param jobId The `job_id` returned by the toggle endpoint. + * @param options per-request options that override the client options + * @return the response body + */ + public AmlMonitoringRetrieveJobResponse retrieveJob(String jobId, RequestOptions options) { + return client.execute(retrieveJobRequest(jobId), options, RETRIEVE_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveJob(String, RequestOptions)}. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveJobRequest(jobId), options, RETRIEVE_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public AmlMonitoringRetrieveJobResponse retrieveJob(String jobId) { + return client.execute(retrieveJobRequest(jobId), RequestOptions.none(), RETRIEVE_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveJobAsync(String jobId) { + return client.executeAsync(retrieveJobRequest(jobId), RequestOptions.none(), RETRIEVE_JOB_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler RETRIEVE_JOB_RESPONSE = Responses.json(Conv.model(AmlMonitoringRetrieveJobResponse::fromJson)); + + private static ApiRequest retrieveJobRequest(String jobId) { + return ApiRequest.builder("GET", "/v3/aml-monitoring/jobs/{job_id}/") + .pathParam("job_id", jobId) + .build(); + } + + /** The {@code aml_monitoring} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #retrieveJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveJob(String jobId, RequestOptions options) { + return client.execute(retrieveJobRequest(jobId), options, RETRIEVE_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveJobRequest(jobId), options, RETRIEVE_JOB_RESPONSE); + } + + /** + * {@link #retrieveJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public RawResponse retrieveJob(String jobId) { + return client.execute(retrieveJobRequest(jobId), RequestOptions.none(), RETRIEVE_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveJobAsync(String jobId) { + return client.executeAsync(retrieveJobRequest(jobId), RequestOptions.none(), RETRIEVE_JOB_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/AmlResource.java b/src/main/java/me/didit/resources/AmlResource.java new file mode 100644 index 0000000..40869c6 --- /dev/null +++ b/src/main/java/me/didit/resources/AmlResource.java @@ -0,0 +1,154 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.AmlScreenParams; +import me.didit.types.AmlScreenResponse; + +/** The {@code aml} resource: {@code client.aml()}. */ +public final class AmlResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + AmlResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * AML screening (standalone) + * + *

Screen a person or company against PEP, sanctions, warning/watchlist, and adverse-media datasets in one call. + * + *

Two-score model. Each hit carries a match_score (0โ€“100, identity confidence) and a risk_score (0โ€“100, entity risk). Hits whose match_score is below aml_match_score_threshold (default 93) are tagged review_status: "False Positive" and ignored for risk purposes; the highest risk_score among the remaining hits becomes aml.score. The final aml.status follows your thresholds: score > aml_score_review_threshold (default 100) โ†’ Declined; score > aml_score_approve_threshold (default 80) โ†’ In Review; otherwise Approved. Whenever score is non-zero and โ‰ฅ the approve threshold a POSSIBLE_MATCH_FOUND warning is added (a score of exactly 0 never warns). + * + *

Match-score weights. aml_name_weight + aml_dob_weight + aml_country_weight must sum to exactly 100 (defaults 60/25/15). Components missing from the request are re-normalized away; a matching document_number acts as a golden key that overrides match_score to 100. + * + *

Latency. Plain screenings typically complete in a few seconds. With include_adverse_media=true the API waits for adverse-media enrichment (an initial ~5 s pause plus up to ~25 s of polling) โ€” configure a client timeout of at least 60 seconds. + * + *

Persistence. save_api_request defaults to true: the screening is stored as a session (request_id works with GET /v3/session/{sessionId}/decision/), it appears in the console, a status.updated webhook fires, and hit review statuses can be updated later. With save_api_request=false nothing is stored and request_id is a transient correlation id. include_ongoing_monitoring=true keeps re-screening the profile and requires save_api_request=true (enforced with a 400). + * + *

Idempotency. Send an Idempotency-Key header when retrying after a timeout or transient error. The key is scoped to your application and the exact request body. The first completed request stores its response; later identical retries return that same response and do not run or bill another AML screening. If the original request is still running, retry later with the same key. If the same key is reused with a different body, the API returns 409. + * + *

Billing. One AML API credit is charged after the first successful screening. Replayed idempotent responses are not charged again; an insufficient balance returns 403 before any new screening happens. + * + *

Sandbox. Keys from sandbox applications skip screening and billing entirely and return a mocked result โ€” Approved with zero hits unless you pass sandbox_scenario. save_api_request works the same as on live keys, so a saved sandbox screening is retrievable through GET /v3/session/{sessionId}/decision/ and GET /v3/session/{sessionId}/generate-pdf/. + * + *

{@code POST /v3/aml/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public AmlScreenResponse screen(AmlScreenParams params, RequestOptions options) { + return client.execute(screenRequest(params), options, SCREEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #screen(AmlScreenParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture screenAsync(AmlScreenParams params, RequestOptions options) { + return client.executeAsync(screenRequest(params), options, SCREEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #screen(AmlScreenParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public AmlScreenResponse screen(AmlScreenParams params) { + return client.execute(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #screen(AmlScreenParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture screenAsync(AmlScreenParams params) { + return client.executeAsync(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler SCREEN_RESPONSE = Responses.json(Conv.model(AmlScreenResponse::fromJson)); + + private static ApiRequest screenRequest(AmlScreenParams params) { + return ApiRequest.builder("POST", "/v3/aml/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code aml} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #screen(AmlScreenParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse screen(AmlScreenParams params, RequestOptions options) { + return client.execute(screenRequest(params), options, SCREEN_RESPONSE); + } + + /** + * Asynchronous {@link #screen(AmlScreenParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> screenAsync(AmlScreenParams params, RequestOptions options) { + return client.executeAsync(screenRequest(params), options, SCREEN_RESPONSE); + } + + /** + * {@link #screen(AmlScreenParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse screen(AmlScreenParams params) { + return client.execute(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE); + } + + /** + * Asynchronous {@link #screen(AmlScreenParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> screenAsync(AmlScreenParams params) { + return client.executeAsync(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/BillingResource.java b/src/main/java/me/didit/resources/BillingResource.java new file mode 100644 index 0000000..1f7f074 --- /dev/null +++ b/src/main/java/me/didit/resources/BillingResource.java @@ -0,0 +1,227 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.BillingRetrieveBalanceResponse; +import me.didit.types.BillingTopUpParams; +import me.didit.types.BillingTopUpResponse; + +/** The {@code billing} resource: {@code client.billing()}. */ +public final class BillingResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + BillingResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Get credit balance + * + *

Get current pre-paid credit balance in USD (organization-wide) plus auto-refill config. Amounts are decimal strings โ€” parse with a decimal library. + * + *

{@code GET /v3/billing/balance/} + * + * @param options per-request options that override the client options + * @return the response body + */ + public BillingRetrieveBalanceResponse retrieveBalance(RequestOptions options) { + return client.execute(retrieveBalanceRequest(), options, RETRIEVE_BALANCE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveBalance(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveBalanceAsync(RequestOptions options) { + return client.executeAsync(retrieveBalanceRequest(), options, RETRIEVE_BALANCE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveBalance(RequestOptions)}, with the client's options. + * + * @return the result + */ + public BillingRetrieveBalanceResponse retrieveBalance() { + return client.execute(retrieveBalanceRequest(), RequestOptions.none(), RETRIEVE_BALANCE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveBalance(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture retrieveBalanceAsync() { + return client.executeAsync(retrieveBalanceRequest(), RequestOptions.none(), RETRIEVE_BALANCE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Top up credits + * + *

Add credits via a hosted Stripe Checkout session ($50 minimum); not available on annual plans. Redirect the customer to the returned checkout_session_url. + * + *

{@code POST /v3/billing/top-up/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BillingTopUpResponse topUp(BillingTopUpParams params, RequestOptions options) { + return client.execute(topUpRequest(params), options, TOP_UP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #topUp(BillingTopUpParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture topUpAsync(BillingTopUpParams params, RequestOptions options) { + return client.executeAsync(topUpRequest(params), options, TOP_UP_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #topUp(BillingTopUpParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BillingTopUpResponse topUp(BillingTopUpParams params) { + return client.execute(topUpRequest(params), RequestOptions.none(), TOP_UP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #topUp(BillingTopUpParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture topUpAsync(BillingTopUpParams params) { + return client.executeAsync(topUpRequest(params), RequestOptions.none(), TOP_UP_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler RETRIEVE_BALANCE_RESPONSE = Responses.json(Conv.model(BillingRetrieveBalanceResponse::fromJson)); + + private static ApiRequest retrieveBalanceRequest() { + return ApiRequest.builder("GET", "/v3/billing/balance/") + .build(); + } + + private static final ResponseHandler TOP_UP_RESPONSE = Responses.json(Conv.model(BillingTopUpResponse::fromJson)); + + private static ApiRequest topUpRequest(BillingTopUpParams params) { + return ApiRequest.builder("POST", "/v3/billing/top-up/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code billing} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #retrieveBalance(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse retrieveBalance(RequestOptions options) { + return client.execute(retrieveBalanceRequest(), options, RETRIEVE_BALANCE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveBalance(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveBalanceAsync(RequestOptions options) { + return client.executeAsync(retrieveBalanceRequest(), options, RETRIEVE_BALANCE_RESPONSE); + } + + /** + * {@link #retrieveBalance(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse retrieveBalance() { + return client.execute(retrieveBalanceRequest(), RequestOptions.none(), RETRIEVE_BALANCE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveBalance(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> retrieveBalanceAsync() { + return client.executeAsync(retrieveBalanceRequest(), RequestOptions.none(), RETRIEVE_BALANCE_RESPONSE); + } + + /** + * {@link #topUp(BillingTopUpParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse topUp(BillingTopUpParams params, RequestOptions options) { + return client.execute(topUpRequest(params), options, TOP_UP_RESPONSE); + } + + /** + * Asynchronous {@link #topUp(BillingTopUpParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> topUpAsync(BillingTopUpParams params, RequestOptions options) { + return client.executeAsync(topUpRequest(params), options, TOP_UP_RESPONSE); + } + + /** + * {@link #topUp(BillingTopUpParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse topUp(BillingTopUpParams params) { + return client.execute(topUpRequest(params), RequestOptions.none(), TOP_UP_RESPONSE); + } + + /** + * Asynchronous {@link #topUp(BillingTopUpParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> topUpAsync(BillingTopUpParams params) { + return client.executeAsync(topUpRequest(params), RequestOptions.none(), TOP_UP_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/BiometricTemplatesResource.java b/src/main/java/me/didit/resources/BiometricTemplatesResource.java new file mode 100644 index 0000000..51fbd53 --- /dev/null +++ b/src/main/java/me/didit/resources/BiometricTemplatesResource.java @@ -0,0 +1,777 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.BiometricTemplatesBatchDeleteParams; +import me.didit.types.BiometricTemplatesBatchDeleteResponse; +import me.didit.types.BiometricTemplatesCountParams; +import me.didit.types.BiometricTemplatesCountResponse; +import me.didit.types.BiometricTemplatesDeleteResponse; +import me.didit.types.BiometricTemplatesListParams; +import me.didit.types.BiometricTemplatesListResponse; +import me.didit.types.BiometricTemplatesRetrieveResponse; + +/** The {@code biometric_templates} resource: {@code client.biometricTemplates()}. */ +public final class BiometricTemplatesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + BiometricTemplatesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List retained biometric templates + * + *

An opted-in application keeps one separately managed, image-free face biometric template anchored to the User when a session is deleted (see DELETE /v3/session/{sessionId}/delete/). Templates are biometric data with a finite expires_at; they never contain images, session data, or identity fields, and they are purged on User deletion, privacy erasure, expiry, or an explicit purge. These endpoints accept application API keys (x-api-key) only; Business Console user tokens are rejected with 403. + * + *

Returns a paginated list of the templates the application currently holds. Purged templates are not listed. + * + *

{@code GET /v3/biometric-templates/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(BiometricTemplatesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(BiometricTemplatesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(BiometricTemplatesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(BiometricTemplatesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(BiometricTemplatesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(BiometricTemplatesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(BiometricTemplatesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(BiometricTemplatesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(BiometricTemplatesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(BiometricTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(BiometricTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Count retained biometric templates + * + *

An opted-in application keeps one separately managed, image-free face biometric template anchored to the User when a session is deleted (see DELETE /v3/session/{sessionId}/delete/). Templates are biometric data with a finite expires_at; they never contain images, session data, or identity fields, and they are purged on User deletion, privacy erasure, expiry, or an explicit purge. These endpoints accept application API keys (x-api-key) only; Business Console user tokens are rejected with 403. + * + *

Returns the number of templates matching the same filters as the list endpoint. Use it to check what a filtered bulk purge with delete_all: true would touch. + * + *

{@code GET /v3/biometric-templates/count/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BiometricTemplatesCountResponse count(BiometricTemplatesCountParams params, RequestOptions options) { + return client.execute(countRequest(params), options, COUNT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture countAsync(BiometricTemplatesCountParams params, RequestOptions options) { + return client.executeAsync(countRequest(params), options, COUNT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #count(BiometricTemplatesCountParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BiometricTemplatesCountResponse count(BiometricTemplatesCountParams params) { + return client.execute(countRequest(params), RequestOptions.none(), COUNT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture countAsync(BiometricTemplatesCountParams params) { + return client.executeAsync(countRequest(params), RequestOptions.none(), COUNT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #count(BiometricTemplatesCountParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public BiometricTemplatesCountResponse count(RequestOptions options) { + return client.execute(countRequest(BiometricTemplatesCountParams.builder().build()), options, COUNT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture countAsync(RequestOptions options) { + return client.executeAsync(countRequest(BiometricTemplatesCountParams.builder().build()), options, COUNT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #count(BiometricTemplatesCountParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public BiometricTemplatesCountResponse count() { + return client.execute(countRequest(BiometricTemplatesCountParams.builder().build()), RequestOptions.none(), COUNT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture countAsync() { + return client.executeAsync(countRequest(BiometricTemplatesCountParams.builder().build()), RequestOptions.none(), COUNT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get a retained biometric template + * + *

An opted-in application keeps one separately managed, image-free face biometric template anchored to the User when a session is deleted (see DELETE /v3/session/{sessionId}/delete/). Templates are biometric data with a finite expires_at; they never contain images, session data, or identity fields, and they are purged on User deletion, privacy erasure, expiry, or an explicit purge. These endpoints accept application API keys (x-api-key) only; Business Console user tokens are rejected with 403. + * + *

Returns one template. The response never includes an image, a vector, the deleted session's id, or identity data. + * + *

{@code GET /v3/biometric-templates/{template_uuid}/} + * + * @param templateUuid Template id, as returned in `biometric_template_uuid` by the session deletion endpoints, `biometric_template_id` on a Face Search match, or the list endpoint. + * @param options per-request options that override the client options + * @return the response body + */ + public BiometricTemplatesRetrieveResponse retrieve(String templateUuid, RequestOptions options) { + return client.execute(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public BiometricTemplatesRetrieveResponse retrieve(String templateUuid) { + return client.execute(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String templateUuid) { + return client.executeAsync(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Purge a retained biometric template + * + *

An opted-in application keeps one separately managed, image-free face biometric template anchored to the User when a session is deleted (see DELETE /v3/session/{sessionId}/delete/). Templates are biometric data with a finite expires_at; they never contain images, session data, or identity fields, and they are purged on User deletion, privacy erasure, expiry, or an explicit purge. These endpoints accept application API keys (x-api-key) only; Business Console user tokens are rejected with 403. + * + *

Purges one template: it is removed from every kind of matching and the stored template is deleted. Irreversible and recorded on the audit trail with the acting principal. + * + *

Retry semantics: Didit deletes the stored template first and only then marks the template purged. If a biometric store is unavailable the call returns 503, the template moves to status: purge_failed and is already excluded from matching; repeat the same call to finish. Repeating a purge of an already purged template returns already_purged. + * + *

Templates are also purged by POST /v3/users/delete/ for the owning User, by any deletion of that User's sessions with deletion_instruction: privacy_erasure, and automatically at expires_at. + * + *

{@code DELETE /v3/biometric-templates/{template_uuid}/} + * + * @param templateUuid Template id, as returned in `biometric_template_uuid` by the session deletion endpoints, `biometric_template_id` on a Face Search match, or the list endpoint. + * @param options per-request options that override the client options + * @return the response body + */ + public BiometricTemplatesDeleteResponse delete(String templateUuid, RequestOptions options) { + return client.execute(deleteRequest(templateUuid), options, DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(templateUuid), options, DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public BiometricTemplatesDeleteResponse delete(String templateUuid) { + return client.execute(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String templateUuid) { + return client.executeAsync(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Bulk purge retained biometric templates + * + *

An opted-in application keeps one separately managed, image-free face biometric template anchored to the User when a session is deleted (see DELETE /v3/session/{sessionId}/delete/). Templates are biometric data with a finite expires_at; they never contain images, session data, or identity fields, and they are purged on User deletion, privacy erasure, expiry, or an explicit purge. These endpoints accept application API keys (x-api-key) only; Business Console user tokens are rejected with 403. + * + *

Purges many templates in one call, by explicit id list or with delete_all: true optionally narrowed by the same filters as the list endpoint. Templates are purged one by one and each result reports purged or already_purged. If a biometric store is unavailable the call returns 503 at the first failing template: templates purged earlier in the request stay purged, the failing one moves to purge_failed (already excluded from matching), and repeating the request finishes the job. + * + *

**delete_all: true without filters purges every biometric template in the application and cannot be undone.** Run the count endpoint with the same filters first. + * + *

{@code POST /v3/biometric-templates/delete/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BiometricTemplatesBatchDeleteResponse batchDelete(BiometricTemplatesBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(BiometricTemplatesBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BiometricTemplatesBatchDeleteResponse batchDelete(BiometricTemplatesBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(BiometricTemplatesBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public BiometricTemplatesBatchDeleteResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public BiometricTemplatesBatchDeleteResponse batchDelete() { + return client.execute(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(BiometricTemplatesListResponse.Results::fromJson)); + + private static ApiRequest listRequest(BiometricTemplatesListParams params) { + return ApiRequest.builder("GET", "/v3/biometric-templates/") + .params(params) + .queryFields("vendor_data", "vendor_user_uuid", "status", "source_type", "retained_from", "retained_to", "ordering", "limit", "offset") + .build(); + } + + private static final ResponseHandler COUNT_RESPONSE = Responses.json(Conv.model(BiometricTemplatesCountResponse::fromJson)); + + private static ApiRequest countRequest(BiometricTemplatesCountParams params) { + return ApiRequest.builder("GET", "/v3/biometric-templates/count/") + .params(params) + .queryFields("vendor_data", "vendor_user_uuid", "status", "source_type", "retained_from", "retained_to") + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(BiometricTemplatesRetrieveResponse::fromJson)); + + private static ApiRequest retrieveRequest(String templateUuid) { + return ApiRequest.builder("GET", "/v3/biometric-templates/{template_uuid}/") + .pathParam("template_uuid", templateUuid) + .build(); + } + + private static final ResponseHandler DELETE_RESPONSE = Responses.json(Conv.model(BiometricTemplatesDeleteResponse::fromJson)); + + private static ApiRequest deleteRequest(String templateUuid) { + return ApiRequest.builder("DELETE", "/v3/biometric-templates/{template_uuid}/") + .pathParam("template_uuid", templateUuid) + .build(); + } + + private static final ResponseHandler BATCH_DELETE_RESPONSE = Responses.json(Conv.model(BiometricTemplatesBatchDeleteResponse::fromJson)); + + private static ApiRequest batchDeleteRequest(BiometricTemplatesBatchDeleteParams params) { + return ApiRequest.builder("POST", "/v3/biometric-templates/delete/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code biometric_templates} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(BiometricTemplatesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(BiometricTemplatesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(BiometricTemplatesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(BiometricTemplatesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(BiometricTemplatesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(BiometricTemplatesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(BiometricTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BiometricTemplatesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(BiometricTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse count(BiometricTemplatesCountParams params, RequestOptions options) { + return client.execute(countRequest(params), options, COUNT_RESPONSE); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> countAsync(BiometricTemplatesCountParams params, RequestOptions options) { + return client.executeAsync(countRequest(params), options, COUNT_RESPONSE); + } + + /** + * {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse count(BiometricTemplatesCountParams params) { + return client.execute(countRequest(params), RequestOptions.none(), COUNT_RESPONSE); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> countAsync(BiometricTemplatesCountParams params) { + return client.executeAsync(countRequest(params), RequestOptions.none(), COUNT_RESPONSE); + } + + /** + * {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse count(RequestOptions options) { + return client.execute(countRequest(BiometricTemplatesCountParams.builder().build()), options, COUNT_RESPONSE); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> countAsync(RequestOptions options) { + return client.executeAsync(countRequest(BiometricTemplatesCountParams.builder().build()), options, COUNT_RESPONSE); + } + + /** + * {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse count() { + return client.execute(countRequest(BiometricTemplatesCountParams.builder().build()), RequestOptions.none(), COUNT_RESPONSE); + } + + /** + * Asynchronous {@link #count(BiometricTemplatesCountParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> countAsync() { + return client.executeAsync(countRequest(BiometricTemplatesCountParams.builder().build()), RequestOptions.none(), COUNT_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String templateUuid, RequestOptions options) { + return client.execute(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public RawResponse retrieve(String templateUuid) { + return client.execute(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String templateUuid) { + return client.executeAsync(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse delete(String templateUuid, RequestOptions options) { + return client.execute(deleteRequest(templateUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(templateUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public RawResponse delete(String templateUuid) { + return client.execute(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String templateUuid) { + return client.executeAsync(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(BiometricTemplatesBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(BiometricTemplatesBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse batchDelete(BiometricTemplatesBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(BiometricTemplatesBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse batchDelete() { + return client.execute(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BiometricTemplatesBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(BiometricTemplatesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/BusinessSessionsResource.java b/src/main/java/me/didit/resources/BusinessSessionsResource.java new file mode 100644 index 0000000..7ae1fbb --- /dev/null +++ b/src/main/java/me/didit/resources/BusinessSessionsResource.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.BusinessSessionsListNetworksResponse; + +/** The {@code business_sessions} resource: {@code client.businessSessions()}. */ +public final class BusinessSessionsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + BusinessSessionsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List networks for a business session + * + *

List the networks the business session's vendor business belongs to. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/business-sessions/{business_session_id}/networks/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param businessSessionId Business session UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessSessionsListNetworksResponse listNetworks(String businessSessionId, RequestOptions options) { + return client.execute(listNetworksRequest(businessSessionId), options, LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}. + * + * @param businessSessionId the {@code business_session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String businessSessionId, RequestOptions options) { + return client.executeAsync(listNetworksRequest(businessSessionId), options, LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param businessSessionId the {@code business_session_id} + * @return the result + */ + public BusinessSessionsListNetworksResponse listNetworks(String businessSessionId) { + return client.execute(listNetworksRequest(businessSessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param businessSessionId the {@code business_session_id} + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String businessSessionId) { + return client.executeAsync(listNetworksRequest(businessSessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler LIST_NETWORKS_RESPONSE = Responses.json(Conv.model(BusinessSessionsListNetworksResponse::fromJson)); + + private static ApiRequest listNetworksRequest(String businessSessionId) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/business-sessions/{business_session_id}/networks/") + .applicationScoped() + .pathParam("business_session_id", businessSessionId) + .build(); + } + + /** The {@code business_sessions} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param businessSessionId the {@code business_session_id} + * @param options per-request options + * @return the result + */ + public RawResponse listNetworks(String businessSessionId, RequestOptions options) { + return client.execute(listNetworksRequest(businessSessionId), options, LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param businessSessionId the {@code business_session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String businessSessionId, RequestOptions options) { + return client.executeAsync(listNetworksRequest(businessSessionId), options, LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param businessSessionId the {@code business_session_id} + * @return the result + */ + public RawResponse listNetworks(String businessSessionId) { + return client.execute(listNetworksRequest(businessSessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param businessSessionId the {@code business_session_id} + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String businessSessionId) { + return client.executeAsync(listNetworksRequest(businessSessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/BusinessesResource.java b/src/main/java/me/didit/resources/BusinessesResource.java new file mode 100644 index 0000000..c2c2c5a --- /dev/null +++ b/src/main/java/me/didit/resources/BusinessesResource.java @@ -0,0 +1,1561 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.BusinessDetailItem; +import me.didit.types.BusinessListItem; +import me.didit.types.BusinessesBatchDeleteParams; +import me.didit.types.BusinessesBatchDeleteResponse; +import me.didit.types.BusinessesCreateParams; +import me.didit.types.BusinessesListNetworksResponse; +import me.didit.types.BusinessesListParams; +import me.didit.types.BusinessesRetrieveOngoingMonitoringJobResponse; +import me.didit.types.BusinessesRetrieveSessionOngoingMonitoringJobResponse; +import me.didit.types.BusinessesSetAmlMonitoringParams; +import me.didit.types.BusinessesSetAmlMonitoringResponse; +import me.didit.types.BusinessesSetOngoingMonitoringParams; +import me.didit.types.BusinessesSetOngoingMonitoringResponse; +import me.didit.types.BusinessesSetSessionOngoingMonitoringParams; +import me.didit.types.BusinessesSetSessionOngoingMonitoringResponse; +import me.didit.types.BusinessesUpdateParams; +import me.didit.types.BusinessesUpdateStatusParams; + +/** The {@code businesses} resource: {@code client.businesses()}. */ +public final class BusinessesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + BusinessesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List businesses + * + *

List [businesses](/entities/businesses) Didit assembles from KYB sessions sharing the same vendor_data (free-form string, NOT a UUID), plus businesses created via the API. Paginated, ordered by last_session_at desc. This endpoint does not support filtering or search parameters โ€” fetch pages and filter client-side. + * + *

{@code GET /v3/businesses/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(BusinessesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(BusinessesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(BusinessesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(BusinessesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(BusinessesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(BusinessesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(BusinessesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(BusinessesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(BusinessesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(BusinessesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(BusinessesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get business + * + *

Fetch one [business](/entities/businesses) by vendor_data (exact match). Adds metadata and updated_at to the list view. Deleted businesses return 404. + * + *

{@code GET /v3/businesses/{vendor_data}/} + * + * @param vendorData Your unique identifier for the business โ€” a free-form string (NOT a UUID), matched exactly as sent. + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessDetailItem retrieve(String vendorData, RequestOptions options) { + return client.execute(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String vendorData, RequestOptions options) { + return client.executeAsync(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public BusinessDetailItem retrieve(String vendorData) { + return client.execute(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String vendorData) { + return client.executeAsync(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update business + * + *

Partial update of a business: display_name, legal_name, registration_number, country_code, status, metadata. metadata fully replaces. Setting status to BLOCKED adds the vendor_data to the system blocklist; moving away from BLOCKED removes that entry. + * + *

{@code PATCH /v3/businesses/{vendor_data}/} + * + * @param vendorData Your unique identifier for the business (free-form string, NOT a UUID). + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessDetailItem update(String vendorData, BusinessesUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(vendorData, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData, BusinessesUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, BusinessesUpdateParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public BusinessDetailItem update(String vendorData, BusinessesUpdateParams params) { + return client.execute(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData, BusinessesUpdateParams params) { + return client.executeAsync(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, BusinessesUpdateParams, RequestOptions)}, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public BusinessDetailItem update(String vendorData, RequestOptions options) { + return client.execute(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)}, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, BusinessesUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public BusinessDetailItem update(String vendorData) { + return client.execute(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData) { + return client.executeAsync(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update business status + * + *

Flip only the lifecycle status of a business โ€” VendorBusinessStatusChoices (ACTIVE/FLAGGED/BLOCKED, NOT session statuses). BLOCKED adds vendor_data to the system blocklist. + * + *

{@code PATCH /v3/businesses/{vendor_data}/update-status/} + * + * @param vendorData Your unique identifier for the business (free-form string, NOT a UUID). + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessDetailItem updateStatus(String vendorData, BusinessesUpdateStatusParams params, RequestOptions options) { + return client.execute(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateStatusAsync(String vendorData, BusinessesUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public BusinessDetailItem updateStatus(String vendorData, BusinessesUpdateStatusParams params) { + return client.execute(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateStatusAsync(String vendorData, BusinessesUpdateStatusParams params) { + return client.executeAsync(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Batch delete businesses + * + *

Permanently delete businesses โ€” this cannot be undone. For blocking prefer [Update Business Status](#patch-/v3/businesses/-vendor_data-/update-status/) with BLOCKED. + * + *

{@code POST /v3/businesses/delete/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesBatchDeleteResponse batchDelete(BusinessesBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(BusinessesBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BusinessesBatchDeleteResponse batchDelete(BusinessesBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(BusinessesBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public BusinessesBatchDeleteResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public BusinessesBatchDeleteResponse batchDelete() { + return client.execute(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Enable or disable AML ongoing monitoring for businesses + * + *

Turns AML ongoing monitoring on or off for the selected businesses, with the same semantics as the Business Console. Exactly one monitored AML screening is kept per business, so a profile that verified several times is monitored and billed once; disabling turns monitoring off across all of the profile's screenings. Businesses without any AML screening are screened first (billed as a regular AML screening) when they have the legal or display name needed; otherwise they are reported as skipped_no_identity_data. + * + *

Set estimate_only: true to preview counts and costs without writing anything. Selections of 20 profiles or fewer resolve inline and return 200 with the completed job; larger selections return 202 and run in the background - poll [Get AML monitoring job](#get-/v3/aml-monitoring/jobs/-job_id-/) with the returned job_id. Enabling is refused with 403 when the organization balance does not cover the estimate. Identifiers that match nothing are listed in unmatched and never fail the request: a selection that matches nothing completes as an empty job (total 0), the same convention as the batch delete endpoints. + * + *

{@code POST /v3/businesses/aml-monitoring/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesSetAmlMonitoringResponse setAmlMonitoring(BusinessesSetAmlMonitoringParams params, RequestOptions options) { + return client.execute(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture setAmlMonitoringAsync(BusinessesSetAmlMonitoringParams params, RequestOptions options) { + return client.executeAsync(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BusinessesSetAmlMonitoringResponse setAmlMonitoring(BusinessesSetAmlMonitoringParams params) { + return client.execute(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture setAmlMonitoringAsync(BusinessesSetAmlMonitoringParams params) { + return client.executeAsync(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create business + * + *

Pre-create a [business](/entities/businesses) *without* a KYB session. All fields are optional, but you should always send vendor_data โ€” without it the record cannot be linked to sessions or transactions. When provided, vendor_data must be unique among non-deleted businesses (exact match; conflicts return 400). Not idempotent. + * + *

{@code POST /v3/businesses/create/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessDetailItem create(BusinessesCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(BusinessesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(BusinessesCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BusinessDetailItem create(BusinessesCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(BusinessesCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(BusinessesCreateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public BusinessDetailItem create(RequestOptions options) { + return client.execute(createRequest(BusinessesCreateParams.builder().build()), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(RequestOptions options) { + return client.executeAsync(createRequest(BusinessesCreateParams.builder().build()), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(BusinessesCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public BusinessDetailItem create() { + return client.execute(createRequest(BusinessesCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture createAsync() { + return client.executeAsync(createRequest(BusinessesCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Toggle AML ongoing monitoring for businesses + * + *

Business-level equivalent of the user toggle: one monitored AML screening per business, with businesses lacking any AML screening screened first (company entity). Same estimate_only, inline fast-path and async job contract. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/vendor-businesses/toggle-ongoing-monitoring/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesSetOngoingMonitoringResponse setOngoingMonitoring(BusinessesSetOngoingMonitoringParams params, RequestOptions options) { + return client.execute(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture setOngoingMonitoringAsync(BusinessesSetOngoingMonitoringParams params, RequestOptions options) { + return client.executeAsync(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BusinessesSetOngoingMonitoringResponse setOngoingMonitoring(BusinessesSetOngoingMonitoringParams params) { + return client.execute(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture setOngoingMonitoringAsync(BusinessesSetOngoingMonitoringParams params) { + return client.executeAsync(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get AML ongoing monitoring job + * + *

Progress and per-outcome counters of a monitoring toggle job. Poll every couple of seconds while status is PENDING or PROCESSING. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/vendor-businesses/toggle-ongoing-monitoring/{job_id}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param jobId Monitoring job UUID returned by the toggle endpoint. + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesRetrieveOngoingMonitoringJobResponse retrieveOngoingMonitoringJob(String jobId, RequestOptions options) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)}. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveOngoingMonitoringJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveOngoingMonitoringJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public BusinessesRetrieveOngoingMonitoringJobResponse retrieveOngoingMonitoringJob(String jobId) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveOngoingMonitoringJobAsync(String jobId) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Toggle AML ongoing monitoring for business sessions + * + *

Session-level toggle for KYB verifications, addressed by session number. Sessions without an AML screening get one created and attached to the session itself. Same estimate_only, inline fast-path and async job contract as the user-level endpoints. Replaces the legacy synchronous behavior that skipped sessions without an AML screening. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/businesses/toggle-ongoing-monitoring/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesSetSessionOngoingMonitoringResponse setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams params, RequestOptions options) { + return client.execute(setSessionOngoingMonitoringRequest(params), options, SET_SESSION_ONGOING_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture setSessionOngoingMonitoringAsync(BusinessesSetSessionOngoingMonitoringParams params, RequestOptions options) { + return client.executeAsync(setSessionOngoingMonitoringRequest(params), options, SET_SESSION_ONGOING_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BusinessesSetSessionOngoingMonitoringResponse setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams params) { + return client.execute(setSessionOngoingMonitoringRequest(params), RequestOptions.none(), SET_SESSION_ONGOING_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture setSessionOngoingMonitoringAsync(BusinessesSetSessionOngoingMonitoringParams params) { + return client.executeAsync(setSessionOngoingMonitoringRequest(params), RequestOptions.none(), SET_SESSION_ONGOING_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get AML ongoing monitoring job + * + *

Progress and per-outcome counters of a monitoring toggle job. Poll every couple of seconds while status is PENDING or PROCESSING. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/businesses/toggle-ongoing-monitoring/{job_id}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param jobId Monitoring job UUID returned by the toggle endpoint. + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesRetrieveSessionOngoingMonitoringJobResponse retrieveSessionOngoingMonitoringJob(String jobId, RequestOptions options) { + return client.execute(retrieveSessionOngoingMonitoringJobRequest(jobId), options, RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)}. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveSessionOngoingMonitoringJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveSessionOngoingMonitoringJobRequest(jobId), options, RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public BusinessesRetrieveSessionOngoingMonitoringJobResponse retrieveSessionOngoingMonitoringJob(String jobId) { + return client.execute(retrieveSessionOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveSessionOngoingMonitoringJobAsync(String jobId) { + return client.executeAsync(retrieveSessionOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List networks for a business + * + *

List the networks a vendor business belongs to. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/businesses/{vendor_business_uuid}/networks/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param vendorBusinessUuid Vendor business UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public BusinessesListNetworksResponse listNetworks(String vendorBusinessUuid, RequestOptions options) { + return client.execute(listNetworksRequest(vendorBusinessUuid), options, LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String vendorBusinessUuid, RequestOptions options) { + return client.executeAsync(listNetworksRequest(vendorBusinessUuid), options, LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @return the result + */ + public BusinessesListNetworksResponse listNetworks(String vendorBusinessUuid) { + return client.execute(listNetworksRequest(vendorBusinessUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String vendorBusinessUuid) { + return client.executeAsync(listNetworksRequest(vendorBusinessUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(BusinessListItem::fromJson)); + + private static ApiRequest listRequest(BusinessesListParams params) { + return ApiRequest.builder("GET", "/v3/businesses/") + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(BusinessDetailItem::fromJson)); + + private static ApiRequest retrieveRequest(String vendorData) { + return ApiRequest.builder("GET", "/v3/businesses/{vendor_data}/") + .pathParam("vendor_data", vendorData) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(BusinessDetailItem::fromJson)); + + private static ApiRequest updateRequest(String vendorData, BusinessesUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/businesses/{vendor_data}/") + .pathParam("vendor_data", vendorData) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_STATUS_RESPONSE = Responses.json(Conv.model(BusinessDetailItem::fromJson)); + + private static ApiRequest updateStatusRequest(String vendorData, BusinessesUpdateStatusParams params) { + return ApiRequest.builder("PATCH", "/v3/businesses/{vendor_data}/update-status/") + .pathParam("vendor_data", vendorData) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler BATCH_DELETE_RESPONSE = Responses.json(Conv.model(BusinessesBatchDeleteResponse::fromJson)); + + private static ApiRequest batchDeleteRequest(BusinessesBatchDeleteParams params) { + return ApiRequest.builder("POST", "/v3/businesses/delete/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SET_AML_MONITORING_RESPONSE = Responses.byStatus(BusinessesSetAmlMonitoringResponse::fromResponse); + + private static ApiRequest setAmlMonitoringRequest(BusinessesSetAmlMonitoringParams params) { + return ApiRequest.builder("POST", "/v3/businesses/aml-monitoring/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(BusinessDetailItem::fromJson)); + + private static ApiRequest createRequest(BusinessesCreateParams params) { + return ApiRequest.builder("POST", "/v3/businesses/create/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SET_ONGOING_MONITORING_RESPONSE = Responses.byStatus(BusinessesSetOngoingMonitoringResponse::fromResponse); + + private static ApiRequest setOngoingMonitoringRequest(BusinessesSetOngoingMonitoringParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/vendor-businesses/toggle-ongoing-monitoring/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE = Responses.json(Conv.model(BusinessesRetrieveOngoingMonitoringJobResponse::fromJson)); + + private static ApiRequest retrieveOngoingMonitoringJobRequest(String jobId) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/vendor-businesses/toggle-ongoing-monitoring/{job_id}/") + .applicationScoped() + .pathParam("job_id", jobId) + .build(); + } + + private static final ResponseHandler SET_SESSION_ONGOING_MONITORING_RESPONSE = Responses.byStatus(BusinessesSetSessionOngoingMonitoringResponse::fromResponse); + + private static ApiRequest setSessionOngoingMonitoringRequest(BusinessesSetSessionOngoingMonitoringParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/businesses/toggle-ongoing-monitoring/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE = Responses.json(Conv.model(BusinessesRetrieveSessionOngoingMonitoringJobResponse::fromJson)); + + private static ApiRequest retrieveSessionOngoingMonitoringJobRequest(String jobId) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/businesses/toggle-ongoing-monitoring/{job_id}/") + .applicationScoped() + .pathParam("job_id", jobId) + .build(); + } + + private static final ResponseHandler LIST_NETWORKS_RESPONSE = Responses.json(Conv.model(BusinessesListNetworksResponse::fromJson)); + + private static ApiRequest listNetworksRequest(String vendorBusinessUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/businesses/{vendor_business_uuid}/networks/") + .applicationScoped() + .pathParam("vendor_business_uuid", vendorBusinessUuid) + .build(); + } + + /** The {@code businesses} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(BusinessesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(BusinessesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(BusinessesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(BusinessesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(BusinessesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(BusinessesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(BusinessesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(BusinessesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(BusinessesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(BusinessesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(BusinessesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(BusinessesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(BusinessesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String vendorData, RequestOptions options) { + return client.execute(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String vendorData, RequestOptions options) { + return client.executeAsync(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public RawResponse retrieve(String vendorData) { + return client.execute(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String vendorData) { + return client.executeAsync(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String vendorData, BusinessesUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(vendorData, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData, BusinessesUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String vendorData, BusinessesUpdateParams params) { + return client.execute(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData, BusinessesUpdateParams params) { + return client.executeAsync(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public RawResponse update(String vendorData, RequestOptions options) { + return client.execute(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public RawResponse update(String vendorData) { + return client.execute(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, BusinessesUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData) { + return client.executeAsync(updateRequest(vendorData, BusinessesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateStatus(String vendorData, BusinessesUpdateStatusParams params, RequestOptions options) { + return client.execute(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateStatusAsync(String vendorData, BusinessesUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public RawResponse updateStatus(String vendorData, BusinessesUpdateStatusParams params) { + return client.execute(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateStatus(String, BusinessesUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateStatusAsync(String vendorData, BusinessesUpdateStatusParams params) { + return client.executeAsync(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(BusinessesBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(BusinessesBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse batchDelete(BusinessesBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(BusinessesBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse batchDelete() { + return client.execute(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(BusinessesBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(BusinessesBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse setAmlMonitoring(BusinessesSetAmlMonitoringParams params, RequestOptions options) { + return client.execute(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> setAmlMonitoringAsync(BusinessesSetAmlMonitoringParams params, RequestOptions options) { + return client.executeAsync(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE); + } + + /** + * {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse setAmlMonitoring(BusinessesSetAmlMonitoringParams params) { + return client.execute(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setAmlMonitoring(BusinessesSetAmlMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> setAmlMonitoringAsync(BusinessesSetAmlMonitoringParams params) { + return client.executeAsync(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE); + } + + /** + * {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(BusinessesCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(BusinessesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(BusinessesCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(BusinessesCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse create(RequestOptions options) { + return client.execute(createRequest(BusinessesCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(RequestOptions options) { + return client.executeAsync(createRequest(BusinessesCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse create() { + return client.execute(createRequest(BusinessesCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(BusinessesCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> createAsync() { + return client.executeAsync(createRequest(BusinessesCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse setOngoingMonitoring(BusinessesSetOngoingMonitoringParams params, RequestOptions options) { + return client.execute(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> setOngoingMonitoringAsync(BusinessesSetOngoingMonitoringParams params, RequestOptions options) { + return client.executeAsync(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse setOngoingMonitoring(BusinessesSetOngoingMonitoringParams params) { + return client.execute(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(BusinessesSetOngoingMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> setOngoingMonitoringAsync(BusinessesSetOngoingMonitoringParams params) { + return client.executeAsync(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveOngoingMonitoringJob(String jobId, RequestOptions options) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveOngoingMonitoringJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public RawResponse retrieveOngoingMonitoringJob(String jobId) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveOngoingMonitoringJobAsync(String jobId) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams params, RequestOptions options) { + return client.execute(setSessionOngoingMonitoringRequest(params), options, SET_SESSION_ONGOING_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> setSessionOngoingMonitoringAsync(BusinessesSetSessionOngoingMonitoringParams params, RequestOptions options) { + return client.executeAsync(setSessionOngoingMonitoringRequest(params), options, SET_SESSION_ONGOING_MONITORING_RESPONSE); + } + + /** + * {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams params) { + return client.execute(setSessionOngoingMonitoringRequest(params), RequestOptions.none(), SET_SESSION_ONGOING_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setSessionOngoingMonitoring(BusinessesSetSessionOngoingMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> setSessionOngoingMonitoringAsync(BusinessesSetSessionOngoingMonitoringParams params) { + return client.executeAsync(setSessionOngoingMonitoringRequest(params), RequestOptions.none(), SET_SESSION_ONGOING_MONITORING_RESPONSE); + } + + /** + * {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveSessionOngoingMonitoringJob(String jobId, RequestOptions options) { + return client.execute(retrieveSessionOngoingMonitoringJobRequest(jobId), options, RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveSessionOngoingMonitoringJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveSessionOngoingMonitoringJobRequest(jobId), options, RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public RawResponse retrieveSessionOngoingMonitoringJob(String jobId) { + return client.execute(retrieveSessionOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveSessionOngoingMonitoringJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveSessionOngoingMonitoringJobAsync(String jobId) { + return client.executeAsync(retrieveSessionOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_SESSION_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listNetworks(String vendorBusinessUuid, RequestOptions options) { + return client.execute(listNetworksRequest(vendorBusinessUuid), options, LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String vendorBusinessUuid, RequestOptions options) { + return client.executeAsync(listNetworksRequest(vendorBusinessUuid), options, LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @return the result + */ + public RawResponse listNetworks(String vendorBusinessUuid) { + return client.execute(listNetworksRequest(vendorBusinessUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorBusinessUuid the {@code vendor_business_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String vendorBusinessUuid) { + return client.executeAsync(listNetworksRequest(vendorBusinessUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesBlueprintsResource.java b/src/main/java/me/didit/resources/CasesBlueprintsResource.java new file mode 100644 index 0000000..c4b23cc --- /dev/null +++ b/src/main/java/me/didit/resources/CasesBlueprintsResource.java @@ -0,0 +1,1575 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseBlueprintDetail; +import me.didit.types.CaseBlueprintListItem; +import me.didit.types.CasePublicationCaseBlueprint; +import me.didit.types.CasePublicationPolicyDraft; +import me.didit.types.CasePublicationPolicyDraftPreconditionRequest; +import me.didit.types.CasePublicationPolicyDraftResponse; +import me.didit.types.CasePublicationPolicyDraftWriteRequest; +import me.didit.types.CasePublicationPolicyRevision; +import me.didit.types.CasesBlueprintsCreateParams; +import me.didit.types.CasesBlueprintsInstallPresetsParams; +import me.didit.types.CasesBlueprintsInstallPresetsResponse; +import me.didit.types.CasesBlueprintsListHistoryParams; +import me.didit.types.CasesBlueprintsListParams; +import me.didit.types.CasesBlueprintsListPresetsResponse; +import me.didit.types.CasesBlueprintsUpdateParams; +import org.jspecify.annotations.Nullable; + +/** The {@code cases.blueprints} resource: {@code client.cases().blueprints()}. */ +public final class CasesBlueprintsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesBlueprintsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List blueprints + * + *

List case blueprints for the application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(CasesBlueprintsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesBlueprintsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesBlueprintsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(CasesBlueprintsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesBlueprintsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesBlueprintsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(CasesBlueprintsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesBlueprintsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesBlueprintsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(CasesBlueprintsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(CasesBlueprintsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create blueprint + * + *

Create a case blueprint: general settings (assignment, escalation, transfer, 4-eyes pairing) plus content_config, the six sections that drive the case page. Set publish=false to create an unpublished draft; Publish creates its first live version. Discarding a never-published draft deletes it. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseBlueprintDetail create(CasesBlueprintsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CasesBlueprintsCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(CasesBlueprintsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(CasesBlueprintsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CaseBlueprintDetail create(CasesBlueprintsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CasesBlueprintsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(CasesBlueprintsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get blueprint + * + *

Retrieve a blueprint, including its connected creation sources (AML config, transaction rules, workflow nodes) and which blueprints escalate to it. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid Blueprint UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CaseBlueprintDetail retrieve(String blueprintUuid, RequestOptions options) { + return client.execute(retrieveRequest(blueprintUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(blueprintUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public CaseBlueprintDetail retrieve(String blueprintUuid) { + return client.execute(retrieveRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String blueprintUuid) { + return client.executeAsync(retrieveRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update blueprint + * + *

Partially update a blueprint's general settings or content_config. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid Blueprint UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseBlueprintDetail update(String blueprintUuid, CasesBlueprintsUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(blueprintUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String blueprintUuid, CasesBlueprintsUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(blueprintUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public CaseBlueprintDetail update(String blueprintUuid, CasesBlueprintsUpdateParams params) { + return client.execute(updateRequest(blueprintUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String blueprintUuid, CasesBlueprintsUpdateParams params) { + return client.executeAsync(updateRequest(blueprintUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public CaseBlueprintDetail update(String blueprintUuid, RequestOptions options) { + return client.execute(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public CaseBlueprintDetail update(String blueprintUuid) { + return client.execute(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String blueprintUuid) { + return client.executeAsync(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete blueprint + * + *

Delete a blueprint. Deletion always succeeds and does not touch the blueprint's cases: existing cases keep their blueprint reference and its settings continue to apply to them. A deleted blueprint no longer appears in blueprint lists and can no longer be chosen as a transfer target; if a maker blueprint is deleted while a resolution is pending 4-eyes approval, a rejected resolution leaves the case on the checker blueprint. + * + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid Blueprint UUID. + * @param options per-request options that override the client options + */ + public void delete(String blueprintUuid, RequestOptions options) { + client.execute(deleteRequest(blueprintUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(blueprintUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + */ + public void delete(String blueprintUuid) { + client.execute(deleteRequest(blueprintUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String blueprintUuid) { + return client.executeAsync(deleteRequest(blueprintUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * List blueprint presets + * + *

List the four built-in presets (Screening hit, AML investigation, Suspicious activity, KYC review) with their content_config and whether each is already installed on this application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/presets/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param options per-request options that override the client options + * @return the response body + */ + public CasesBlueprintsListPresetsResponse listPresets(RequestOptions options) { + return client.execute(listPresetsRequest(), options, LIST_PRESETS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listPresets(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listPresetsAsync(RequestOptions options) { + return client.executeAsync(listPresetsRequest(), options, LIST_PRESETS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listPresets(RequestOptions)}, with the client's options. + * + * @return the result + */ + public CasesBlueprintsListPresetsResponse listPresets() { + return client.execute(listPresetsRequest(), RequestOptions.none(), LIST_PRESETS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listPresets(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture listPresetsAsync() { + return client.executeAsync(listPresetsRequest(), RequestOptions.none(), LIST_PRESETS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Install blueprint presets + * + *

Copy one or more presets into the application as editable blueprints. Idempotent per preset_key; omit preset_keys to install every preset not yet installed. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/presets/install/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasesBlueprintsInstallPresetsResponse installPresets(CasesBlueprintsInstallPresetsParams params, RequestOptions options) { + return client.execute(installPresetsRequest(params), options, INSTALL_PRESETS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture installPresetsAsync(CasesBlueprintsInstallPresetsParams params, RequestOptions options) { + return client.executeAsync(installPresetsRequest(params), options, INSTALL_PRESETS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CasesBlueprintsInstallPresetsResponse installPresets(CasesBlueprintsInstallPresetsParams params) { + return client.execute(installPresetsRequest(params), RequestOptions.none(), INSTALL_PRESETS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture installPresetsAsync(CasesBlueprintsInstallPresetsParams params) { + return client.executeAsync(installPresetsRequest(params), RequestOptions.none(), INSTALL_PRESETS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public CasesBlueprintsInstallPresetsResponse installPresets(RequestOptions options) { + return client.execute(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), options, INSTALL_PRESETS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture installPresetsAsync(RequestOptions options) { + return client.executeAsync(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), options, INSTALL_PRESETS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public CasesBlueprintsInstallPresetsResponse installPresets() { + return client.execute(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), RequestOptions.none(), INSTALL_PRESETS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture installPresetsAsync() { + return client.executeAsync(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), RequestOptions.none(), INSTALL_PRESETS_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/publish/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasePublicationCaseBlueprint publish(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.execute(publishRequest(blueprintUuid, params), options, PUBLISH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture publishAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(publishRequest(blueprintUuid, params), options, PUBLISH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public CasePublicationCaseBlueprint publish(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.execute(publishRequest(blueprintUuid, params), RequestOptions.none(), PUBLISH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture publishAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(publishRequest(blueprintUuid, params), RequestOptions.none(), PUBLISH_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/draft/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public CasePublicationPolicyDraftResponse retrieveDraft(String blueprintUuid, RequestOptions options) { + return client.execute(retrieveDraftRequest(blueprintUuid), options, RETRIEVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDraftAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(retrieveDraftRequest(blueprintUuid), options, RETRIEVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDraft(String, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public CasePublicationPolicyDraftResponse retrieveDraft(String blueprintUuid) { + return client.execute(retrieveDraftRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveDraftAsync(String blueprintUuid) { + return client.executeAsync(retrieveDraftRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code PUT /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/draft/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasePublicationPolicyDraft saveDraft(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.execute(saveDraftRequest(blueprintUuid, params), options, SAVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture saveDraftAsync(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.executeAsync(saveDraftRequest(blueprintUuid, params), options, SAVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public CasePublicationPolicyDraft saveDraft(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params) { + return client.execute(saveDraftRequest(blueprintUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture saveDraftAsync(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params) { + return client.executeAsync(saveDraftRequest(blueprintUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/draft/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + */ + public void discardDraft(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + client.execute(discardDraftRequest(blueprintUuid, params), options, DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture discardDraftAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(discardDraftRequest(blueprintUuid, params), options, DISCARD_DRAFT_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + */ + public void discardDraft(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + client.execute(discardDraftRequest(blueprintUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture discardDraftAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(discardDraftRequest(blueprintUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE).thenAccept(response -> {}); + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/history/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page listHistory(String blueprintUuid, CasesBlueprintsListHistoryParams params, RequestOptions options) { + return client.execute(listHistoryRequest(blueprintUuid, params), options, LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String blueprintUuid, CasesBlueprintsListHistoryParams params, RequestOptions options) { + return client.executeAsync(listHistoryRequest(blueprintUuid, params), options, LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public Page listHistory(String blueprintUuid, CasesBlueprintsListHistoryParams params) { + return client.execute(listHistoryRequest(blueprintUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String blueprintUuid, CasesBlueprintsListHistoryParams params) { + return client.executeAsync(listHistoryRequest(blueprintUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public Page listHistory(String blueprintUuid, RequestOptions options) { + return client.execute(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public Page listHistory(String blueprintUuid) { + return client.execute(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)}, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String blueprintUuid) { + return client.executeAsync(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(CaseBlueprintListItem::fromJson)); + + private static ApiRequest listRequest(CasesBlueprintsListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/") + .applicationScoped() + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CaseBlueprintDetail::fromJson)); + + private static ApiRequest createRequest(CasesBlueprintsCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(CaseBlueprintDetail::fromJson)); + + private static ApiRequest retrieveRequest(String blueprintUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(CaseBlueprintDetail::fromJson)); + + private static ApiRequest updateRequest(String blueprintUuid, CasesBlueprintsUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String blueprintUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .build(); + } + + private static final ResponseHandler LIST_PRESETS_RESPONSE = Responses.json(Conv.model(CasesBlueprintsListPresetsResponse::fromJson)); + + private static ApiRequest listPresetsRequest() { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/presets/") + .applicationScoped() + .build(); + } + + private static final ResponseHandler INSTALL_PRESETS_RESPONSE = Responses.byStatus(CasesBlueprintsInstallPresetsResponse::fromResponse); + + private static ApiRequest installPresetsRequest(CasesBlueprintsInstallPresetsParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/presets/install/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler PUBLISH_RESPONSE = Responses.json(Conv.model(CasePublicationCaseBlueprint::fromJson)); + + private static ApiRequest publishRequest(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/publish/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_DRAFT_RESPONSE = Responses.json(Conv.model(CasePublicationPolicyDraftResponse::fromJson)); + + private static ApiRequest retrieveDraftRequest(String blueprintUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/draft/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .build(); + } + + private static final ResponseHandler SAVE_DRAFT_RESPONSE = Responses.json(Conv.model(CasePublicationPolicyDraft::fromJson)); + + private static ApiRequest saveDraftRequest(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params) { + return ApiRequest.builder("PUT", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/draft/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DISCARD_DRAFT_RESPONSE = Responses.none(); + + private static ApiRequest discardDraftRequest(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/draft/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler> LIST_HISTORY_RESPONSE = Responses.page(Conv.model(CasePublicationPolicyRevision::fromJson)); + + private static ApiRequest listHistoryRequest(String blueprintUuid, CasesBlueprintsListHistoryParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/blueprints/{blueprint_uuid}/history/") + .applicationScoped() + .pathParam("blueprint_uuid", blueprintUuid) + .params(params) + .queryFields("ordering", "limit", "offset") + .build(); + } + + /** The {@code cases.blueprints} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(CasesBlueprintsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesBlueprintsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(CasesBlueprintsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesBlueprintsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(CasesBlueprintsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesBlueprintsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(CasesBlueprintsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesBlueprintsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(CasesBlueprintsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(CasesBlueprintsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(CasesBlueprintsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CasesBlueprintsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CasesBlueprintsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(CasesBlueprintsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(CasesBlueprintsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CasesBlueprintsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CasesBlueprintsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String blueprintUuid, RequestOptions options) { + return client.execute(retrieveRequest(blueprintUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(blueprintUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public RawResponse retrieve(String blueprintUuid) { + return client.execute(retrieveRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String blueprintUuid) { + return client.executeAsync(retrieveRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String blueprintUuid, CasesBlueprintsUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(blueprintUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String blueprintUuid, CasesBlueprintsUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(blueprintUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String blueprintUuid, CasesBlueprintsUpdateParams params) { + return client.execute(updateRequest(blueprintUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String blueprintUuid, CasesBlueprintsUpdateParams params) { + return client.executeAsync(updateRequest(blueprintUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse update(String blueprintUuid, RequestOptions options) { + return client.execute(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public RawResponse update(String blueprintUuid) { + return client.execute(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesBlueprintsUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String blueprintUuid) { + return client.executeAsync(updateRequest(blueprintUuid, CasesBlueprintsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String blueprintUuid, RequestOptions options) { + return client.execute(deleteRequest(blueprintUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(blueprintUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String blueprintUuid) { + return client.execute(deleteRequest(blueprintUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String blueprintUuid) { + return client.executeAsync(deleteRequest(blueprintUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #listPresets(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse listPresets(RequestOptions options) { + return client.execute(listPresetsRequest(), options, LIST_PRESETS_RESPONSE); + } + + /** + * Asynchronous {@link #listPresets(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listPresetsAsync(RequestOptions options) { + return client.executeAsync(listPresetsRequest(), options, LIST_PRESETS_RESPONSE); + } + + /** + * {@link #listPresets(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse listPresets() { + return client.execute(listPresetsRequest(), RequestOptions.none(), LIST_PRESETS_RESPONSE); + } + + /** + * Asynchronous {@link #listPresets(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listPresetsAsync() { + return client.executeAsync(listPresetsRequest(), RequestOptions.none(), LIST_PRESETS_RESPONSE); + } + + /** + * {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse installPresets(CasesBlueprintsInstallPresetsParams params, RequestOptions options) { + return client.execute(installPresetsRequest(params), options, INSTALL_PRESETS_RESPONSE); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> installPresetsAsync(CasesBlueprintsInstallPresetsParams params, RequestOptions options) { + return client.executeAsync(installPresetsRequest(params), options, INSTALL_PRESETS_RESPONSE); + } + + /** + * {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse installPresets(CasesBlueprintsInstallPresetsParams params) { + return client.execute(installPresetsRequest(params), RequestOptions.none(), INSTALL_PRESETS_RESPONSE); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> installPresetsAsync(CasesBlueprintsInstallPresetsParams params) { + return client.executeAsync(installPresetsRequest(params), RequestOptions.none(), INSTALL_PRESETS_RESPONSE); + } + + /** + * {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse installPresets(RequestOptions options) { + return client.execute(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), options, INSTALL_PRESETS_RESPONSE); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> installPresetsAsync(RequestOptions options) { + return client.executeAsync(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), options, INSTALL_PRESETS_RESPONSE); + } + + /** + * {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse installPresets() { + return client.execute(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), RequestOptions.none(), INSTALL_PRESETS_RESPONSE); + } + + /** + * Asynchronous {@link #installPresets(CasesBlueprintsInstallPresetsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> installPresetsAsync() { + return client.executeAsync(installPresetsRequest(CasesBlueprintsInstallPresetsParams.builder().build()), RequestOptions.none(), INSTALL_PRESETS_RESPONSE); + } + + /** + * {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse publish(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.execute(publishRequest(blueprintUuid, params), options, PUBLISH_RESPONSE); + } + + /** + * Asynchronous {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> publishAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(publishRequest(blueprintUuid, params), options, PUBLISH_RESPONSE); + } + + /** + * {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse publish(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.execute(publishRequest(blueprintUuid, params), RequestOptions.none(), PUBLISH_RESPONSE); + } + + /** + * Asynchronous {@link #publish(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> publishAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(publishRequest(blueprintUuid, params), RequestOptions.none(), PUBLISH_RESPONSE); + } + + /** + * {@link #retrieveDraft(String, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDraft(String blueprintUuid, RequestOptions options) { + return client.execute(retrieveDraftRequest(blueprintUuid), options, RETRIEVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDraftAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(retrieveDraftRequest(blueprintUuid), options, RETRIEVE_DRAFT_RESPONSE); + } + + /** + * {@link #retrieveDraft(String, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public RawResponse retrieveDraft(String blueprintUuid) { + return client.execute(retrieveDraftRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveDraftAsync(String blueprintUuid) { + return client.executeAsync(retrieveDraftRequest(blueprintUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE); + } + + /** + * {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse saveDraft(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.execute(saveDraftRequest(blueprintUuid, params), options, SAVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> saveDraftAsync(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.executeAsync(saveDraftRequest(blueprintUuid, params), options, SAVE_DRAFT_RESPONSE); + } + + /** + * {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse saveDraft(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params) { + return client.execute(saveDraftRequest(blueprintUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #saveDraft(String, CasePublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> saveDraftAsync(String blueprintUuid, CasePublicationPolicyDraftWriteRequest params) { + return client.executeAsync(saveDraftRequest(blueprintUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE); + } + + /** + * {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> discardDraft(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.execute(discardDraftRequest(blueprintUuid, params), options, DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> discardDraftAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(discardDraftRequest(blueprintUuid, params), options, DISCARD_DRAFT_RESPONSE); + } + + /** + * {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse<@Nullable Void> discardDraft(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.execute(discardDraftRequest(blueprintUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, CasePublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> discardDraftAsync(String blueprintUuid, CasePublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(discardDraftRequest(blueprintUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> listHistory(String blueprintUuid, CasesBlueprintsListHistoryParams params, RequestOptions options) { + return client.execute(listHistoryRequest(blueprintUuid, params), options, LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String blueprintUuid, CasesBlueprintsListHistoryParams params, RequestOptions options) { + return client.executeAsync(listHistoryRequest(blueprintUuid, params), options, LIST_HISTORY_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> listHistory(String blueprintUuid, CasesBlueprintsListHistoryParams params) { + return client.execute(listHistoryRequest(blueprintUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String blueprintUuid, CasesBlueprintsListHistoryParams params) { + return client.executeAsync(listHistoryRequest(blueprintUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> listHistory(String blueprintUuid, RequestOptions options) { + return client.execute(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response, without parameters. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String blueprintUuid, RequestOptions options) { + return client.executeAsync(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return the result + */ + public RawResponse> listHistory(String blueprintUuid) { + return client.execute(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesBlueprintsListHistoryParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param blueprintUuid the {@code blueprint_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String blueprintUuid) { + return client.executeAsync(listHistoryRequest(blueprintUuid, CasesBlueprintsListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesChecklistResource.java b/src/main/java/me/didit/resources/CasesChecklistResource.java new file mode 100644 index 0000000..abc0f74 --- /dev/null +++ b/src/main/java/me/didit/resources/CasesChecklistResource.java @@ -0,0 +1,258 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseChecklistItem; +import me.didit.types.CasesChecklistToggleItemParams; + +/** The {@code cases.checklist} resource: {@code client.cases().checklist()}. */ +public final class CasesChecklistResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesChecklistResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List case checklist + * + *

List the case's checklist items, copied from the blueprint's content_config.checklist.items at creation, ordered. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/checklist/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public List list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public List list(String caseUuid) { + return client.execute(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Toggle checklist item + * + *

Mark a checklist item complete or incomplete. Resolution is blocked while any item is incomplete, unless the blueprint marks the checklist optional. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/checklist/{item_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param itemUuid Checklist item UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseChecklistItem toggleItem(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params, RequestOptions options) { + return client.execute(toggleItemRequest(caseUuid, itemUuid, params), options, TOGGLE_ITEM_RESPONSE).data(); + } + + /** + * Asynchronous {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture toggleItemAsync(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params, RequestOptions options) { + return client.executeAsync(toggleItemRequest(caseUuid, itemUuid, params), options, TOGGLE_ITEM_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @return the result + */ + public CaseChecklistItem toggleItem(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params) { + return client.execute(toggleItemRequest(caseUuid, itemUuid, params), RequestOptions.none(), TOGGLE_ITEM_RESPONSE).data(); + } + + /** + * Asynchronous {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture toggleItemAsync(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params) { + return client.executeAsync(toggleItemRequest(caseUuid, itemUuid, params), RequestOptions.none(), TOGGLE_ITEM_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.json(Conv.list(Conv.model(CaseChecklistItem::fromJson))); + + private static ApiRequest listRequest(String caseUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/checklist/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler TOGGLE_ITEM_RESPONSE = Responses.json(Conv.model(CaseChecklistItem::fromJson)); + + private static ApiRequest toggleItemRequest(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/checklist/{item_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("item_uuid", itemUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code cases.checklist} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse> list(String caseUuid) { + return client.execute(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse toggleItem(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params, RequestOptions options) { + return client.execute(toggleItemRequest(caseUuid, itemUuid, params), options, TOGGLE_ITEM_RESPONSE); + } + + /** + * Asynchronous {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> toggleItemAsync(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params, RequestOptions options) { + return client.executeAsync(toggleItemRequest(caseUuid, itemUuid, params), options, TOGGLE_ITEM_RESPONSE); + } + + /** + * {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse toggleItem(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params) { + return client.execute(toggleItemRequest(caseUuid, itemUuid, params), RequestOptions.none(), TOGGLE_ITEM_RESPONSE); + } + + /** + * Asynchronous {@link #toggleItem(String, String, CasesChecklistToggleItemParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param itemUuid the {@code item_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> toggleItemAsync(String caseUuid, String itemUuid, CasesChecklistToggleItemParams params) { + return client.executeAsync(toggleItemRequest(caseUuid, itemUuid, params), RequestOptions.none(), TOGGLE_ITEM_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesLinksResource.java b/src/main/java/me/didit/resources/CasesLinksResource.java new file mode 100644 index 0000000..cd9e6eb --- /dev/null +++ b/src/main/java/me/didit/resources/CasesLinksResource.java @@ -0,0 +1,355 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseLink; +import me.didit.types.CasesLinksCreateParams; +import org.jspecify.annotations.Nullable; + +/** The {@code cases.links} resource: {@code client.cases().links()}. */ +public final class CasesLinksResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesLinksResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List case links + * + *

List sessions, business sessions, and transactions attached to the case. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/links/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public List list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public List list(String caseUuid) { + return client.execute(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Add case link + * + *

Attach a session, business session, or transaction to the case. Rejected with 400 if the entity belongs to a different subject than the case. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/links/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseLink create(String caseUuid, CasesLinksCreateParams params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CasesLinksCreateParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CasesLinksCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, CasesLinksCreateParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseLink create(String caseUuid, CasesLinksCreateParams params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CasesLinksCreateParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CasesLinksCreateParams params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Remove case link + * + *

Detach a linked session, business session, or transaction from the case. + * + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/links/{link_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param linkUuid Link UUID. + * @param options per-request options that override the client options + */ + public void delete(String caseUuid, String linkUuid, RequestOptions options) { + client.execute(deleteRequest(caseUuid, linkUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String caseUuid, String linkUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(caseUuid, linkUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + */ + public void delete(String caseUuid, String linkUuid) { + client.execute(deleteRequest(caseUuid, linkUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String caseUuid, String linkUuid) { + return client.executeAsync(deleteRequest(caseUuid, linkUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.json(Conv.list(Conv.model(CaseLink::fromJson))); + + private static ApiRequest listRequest(String caseUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/links/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CaseLink::fromJson)); + + private static ApiRequest createRequest(String caseUuid, CasesLinksCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/links/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String caseUuid, String linkUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/links/{link_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("link_uuid", linkUuid) + .build(); + } + + /** The {@code cases.links} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse> list(String caseUuid) { + return client.execute(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, CasesLinksCreateParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String caseUuid, CasesLinksCreateParams params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CasesLinksCreateParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CasesLinksCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, CasesLinksCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String caseUuid, CasesLinksCreateParams params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CasesLinksCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CasesLinksCreateParams params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #delete(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String caseUuid, String linkUuid, RequestOptions options) { + return client.execute(deleteRequest(caseUuid, linkUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String caseUuid, String linkUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(caseUuid, linkUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String caseUuid, String linkUuid) { + return client.execute(deleteRequest(caseUuid, linkUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param linkUuid the {@code link_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String caseUuid, String linkUuid) { + return client.executeAsync(deleteRequest(caseUuid, linkUuid), RequestOptions.none(), DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesNotesResource.java b/src/main/java/me/didit/resources/CasesNotesResource.java new file mode 100644 index 0000000..91c7a18 --- /dev/null +++ b/src/main/java/me/didit/resources/CasesNotesResource.java @@ -0,0 +1,869 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseCollaborationCaseNote; +import me.didit.types.CaseCollaborationCaseNoteCreateRequest; +import me.didit.types.CaseCollaborationPatchedCaseNoteUpdateRequest; +import me.didit.types.CasesNotesCreateAttachmentUploadParams; +import me.didit.types.CasesNotesCreateAttachmentUploadResponse; +import me.didit.types.CasesNotesListParams; +import me.didit.types.CasesNotesRetrieveAttachmentUrlParams; +import me.didit.types.CasesNotesRetrieveAttachmentUrlResponse; +import org.jspecify.annotations.Nullable; + +/** The {@code cases.notes} resource: {@code client.cases().notes()}. */ +public final class CasesNotesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesNotesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(String caseUuid, CasesNotesListParams params, RequestOptions options) { + return client.execute(listRequest(caseUuid, params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, CasesNotesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesNotesListParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public Page list(String caseUuid, CasesNotesListParams params) { + return client.execute(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, CasesNotesListParams params) { + return client.executeAsync(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesNotesListParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public Page list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid, CasesNotesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, CasesNotesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesNotesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public Page list(String caseUuid) { + return client.execute(listRequest(caseUuid, CasesNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid, CasesNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Add a case-scoped note. An optional client_reference makes an unchanged retry return the same note without duplicate activity or notifications. reply_to must identify a live note in this case. The response includes a bounded parent excerpt without copying that excerpt into the saved reply. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseCollaborationCaseNote create(String caseUuid, CaseCollaborationCaseNoteCreateRequest params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CaseCollaborationCaseNoteCreateRequest params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseCollaborationCaseNote create(String caseUuid, CaseCollaborationCaseNoteCreateRequest params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CaseCollaborationCaseNoteCreateRequest params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Pin or unpin an existing note. Pinned notes appear first. Pin changes are recorded in case activity and do not change evidence or source decisions. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/{note_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseCollaborationCaseNote update(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(caseUuid, noteUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @return the result + */ + public CaseCollaborationCaseNote update(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params) { + return client.execute(updateRequest(caseUuid, noteUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return the result + */ + public CaseCollaborationCaseNote update(String caseUuid, String noteUuid, RequestOptions options) { + return client.execute(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, String noteUuid, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return the result + */ + public CaseCollaborationCaseNote update(String caseUuid, String noteUuid) { + return client.execute(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, String noteUuid) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/{note_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options that override the client options + */ + public void delete(String caseUuid, String noteUuid, RequestOptions options) { + client.execute(deleteRequest(caseUuid, noteUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String caseUuid, String noteUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(caseUuid, noteUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + */ + public void delete(String caseUuid, String noteUuid) { + client.execute(deleteRequest(caseUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String caseUuid, String noteUuid) { + return client.executeAsync(deleteRequest(caseUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Get note attachment URL + * + *

Mint a fresh presigned download URL for an attachment already stored on one of the case's notes. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/presign/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasesNotesRetrieveAttachmentUrlResponse retrieveAttachmentUrl(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params, RequestOptions options) { + return client.execute(retrieveAttachmentUrlRequest(caseUuid, params), options, RETRIEVE_ATTACHMENT_URL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAttachmentUrlAsync(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params, RequestOptions options) { + return client.executeAsync(retrieveAttachmentUrlRequest(caseUuid, params), options, RETRIEVE_ATTACHMENT_URL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CasesNotesRetrieveAttachmentUrlResponse retrieveAttachmentUrl(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params) { + return client.execute(retrieveAttachmentUrlRequest(caseUuid, params), RequestOptions.none(), RETRIEVE_ATTACHMENT_URL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture retrieveAttachmentUrlAsync(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params) { + return client.executeAsync(retrieveAttachmentUrlRequest(caseUuid, params), RequestOptions.none(), RETRIEVE_ATTACHMENT_URL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Upload note attachment + * + *

Upload a file (JPEG, PNG, WebP, PDF, plain text, or CSV; max 5 MB) to attach to a note. Returns the s3_key to pass in the note's attachments array. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/presign/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasesNotesCreateAttachmentUploadResponse createAttachmentUpload(String caseUuid, CasesNotesCreateAttachmentUploadParams params, RequestOptions options) { + return client.execute(createAttachmentUploadRequest(caseUuid, params), options, CREATE_ATTACHMENT_UPLOAD_RESPONSE).data(); + } + + /** + * Asynchronous {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAttachmentUploadAsync(String caseUuid, CasesNotesCreateAttachmentUploadParams params, RequestOptions options) { + return client.executeAsync(createAttachmentUploadRequest(caseUuid, params), options, CREATE_ATTACHMENT_UPLOAD_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CasesNotesCreateAttachmentUploadResponse createAttachmentUpload(String caseUuid, CasesNotesCreateAttachmentUploadParams params) { + return client.execute(createAttachmentUploadRequest(caseUuid, params), RequestOptions.none(), CREATE_ATTACHMENT_UPLOAD_RESPONSE).data(); + } + + /** + * Asynchronous {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAttachmentUploadAsync(String caseUuid, CasesNotesCreateAttachmentUploadParams params) { + return client.executeAsync(createAttachmentUploadRequest(caseUuid, params), RequestOptions.none(), CREATE_ATTACHMENT_UPLOAD_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(CaseCollaborationCaseNote::fromJson)); + + private static ApiRequest listRequest(String caseUuid, CasesNotesListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .queryFields("ordering", "limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CaseCollaborationCaseNote::fromJson)); + + private static ApiRequest createRequest(String caseUuid, CaseCollaborationCaseNoteCreateRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(CaseCollaborationCaseNote::fromJson)); + + private static ApiRequest updateRequest(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/{note_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("note_uuid", noteUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String caseUuid, String noteUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/{note_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("note_uuid", noteUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_ATTACHMENT_URL_RESPONSE = Responses.json(Conv.model(CasesNotesRetrieveAttachmentUrlResponse::fromJson)); + + private static ApiRequest retrieveAttachmentUrlRequest(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/presign/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .queryFields("s3_key") + .build(); + } + + private static final ResponseHandler CREATE_ATTACHMENT_UPLOAD_RESPONSE = Responses.json(Conv.model(CasesNotesCreateAttachmentUploadResponse::fromJson)); + + private static ApiRequest createAttachmentUploadRequest(String caseUuid, CasesNotesCreateAttachmentUploadParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/notes/presign/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code cases.notes} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, CasesNotesListParams params, RequestOptions options) { + return client.execute(listRequest(caseUuid, params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, CasesNotesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, params), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> list(String caseUuid, CasesNotesListParams params) { + return client.execute(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, CasesNotesListParams params) { + return client.executeAsync(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid, CasesNotesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, CasesNotesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse> list(String caseUuid) { + return client.execute(listRequest(caseUuid, CasesNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesNotesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid, CasesNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String caseUuid, CaseCollaborationCaseNoteCreateRequest params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CaseCollaborationCaseNoteCreateRequest params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String caseUuid, CaseCollaborationCaseNoteCreateRequest params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CaseCollaborationCaseNoteCreateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CaseCollaborationCaseNoteCreateRequest params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(caseUuid, noteUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params) { + return client.execute(updateRequest(caseUuid, noteUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, String noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest params) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse update(String caseUuid, String noteUuid, RequestOptions options) { + return client.execute(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, String noteUuid, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return the result + */ + public RawResponse update(String caseUuid, String noteUuid) { + return client.execute(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, String, CaseCollaborationPatchedCaseNoteUpdateRequest, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, String noteUuid) { + return client.executeAsync(updateRequest(caseUuid, noteUuid, CaseCollaborationPatchedCaseNoteUpdateRequest.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String caseUuid, String noteUuid, RequestOptions options) { + return client.execute(deleteRequest(caseUuid, noteUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String caseUuid, String noteUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(caseUuid, noteUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String caseUuid, String noteUuid) { + return client.execute(deleteRequest(caseUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param noteUuid the {@code note_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String caseUuid, String noteUuid) { + return client.executeAsync(deleteRequest(caseUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse retrieveAttachmentUrl(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params, RequestOptions options) { + return client.execute(retrieveAttachmentUrlRequest(caseUuid, params), options, RETRIEVE_ATTACHMENT_URL_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAttachmentUrlAsync(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params, RequestOptions options) { + return client.executeAsync(retrieveAttachmentUrlRequest(caseUuid, params), options, RETRIEVE_ATTACHMENT_URL_RESPONSE); + } + + /** + * {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse retrieveAttachmentUrl(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params) { + return client.execute(retrieveAttachmentUrlRequest(caseUuid, params), RequestOptions.none(), RETRIEVE_ATTACHMENT_URL_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveAttachmentUrl(String, CasesNotesRetrieveAttachmentUrlParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> retrieveAttachmentUrlAsync(String caseUuid, CasesNotesRetrieveAttachmentUrlParams params) { + return client.executeAsync(retrieveAttachmentUrlRequest(caseUuid, params), RequestOptions.none(), RETRIEVE_ATTACHMENT_URL_RESPONSE); + } + + /** + * {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse createAttachmentUpload(String caseUuid, CasesNotesCreateAttachmentUploadParams params, RequestOptions options) { + return client.execute(createAttachmentUploadRequest(caseUuid, params), options, CREATE_ATTACHMENT_UPLOAD_RESPONSE); + } + + /** + * Asynchronous {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAttachmentUploadAsync(String caseUuid, CasesNotesCreateAttachmentUploadParams params, RequestOptions options) { + return client.executeAsync(createAttachmentUploadRequest(caseUuid, params), options, CREATE_ATTACHMENT_UPLOAD_RESPONSE); + } + + /** + * {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse createAttachmentUpload(String caseUuid, CasesNotesCreateAttachmentUploadParams params) { + return client.execute(createAttachmentUploadRequest(caseUuid, params), RequestOptions.none(), CREATE_ATTACHMENT_UPLOAD_RESPONSE); + } + + /** + * Asynchronous {@link #createAttachmentUpload(String, CasesNotesCreateAttachmentUploadParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAttachmentUploadAsync(String caseUuid, CasesNotesCreateAttachmentUploadParams params) { + return client.executeAsync(createAttachmentUploadRequest(caseUuid, params), RequestOptions.none(), CREATE_ATTACHMENT_UPLOAD_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesRegulatoryReportsResource.java b/src/main/java/me/didit/resources/CasesRegulatoryReportsResource.java new file mode 100644 index 0000000..7b29e64 --- /dev/null +++ b/src/main/java/me/didit/resources/CasesRegulatoryReportsResource.java @@ -0,0 +1,429 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CasesRegulatoryReportsCreateParams; +import me.didit.types.CasesRegulatoryReportsListParams; +import me.didit.types.RegulatoryReportDetail; + +/** The {@code cases.regulatory_reports} resource: {@code client.cases().regulatoryReports()}. */ +public final class CasesRegulatoryReportsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesRegulatoryReportsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List reports for case + * + *

List FIU reports generated for the case. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/regulatory-reports/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(String caseUuid, CasesRegulatoryReportsListParams params, RequestOptions options) { + return client.execute(listRequest(caseUuid, params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, CasesRegulatoryReportsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public Page list(String caseUuid, CasesRegulatoryReportsListParams params) { + return client.execute(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, CasesRegulatoryReportsListParams params) { + return client.executeAsync(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public Page list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public Page list(String caseUuid) { + return client.execute(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create report from case + * + *

Create a draft FIU report for the case: DRAFT status, auto-populated from the optional template plus the case's subject, linked transactions, and narrative. Validate then finalize to produce the goAML XML and PDF. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/regulatory-reports/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportDetail create(String caseUuid, CasesRegulatoryReportsCreateParams params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CasesRegulatoryReportsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RegulatoryReportDetail create(String caseUuid, CasesRegulatoryReportsCreateParams params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CasesRegulatoryReportsCreateParams params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RegulatoryReportDetail create(String caseUuid, RequestOptions options) { + return client.execute(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RegulatoryReportDetail create(String caseUuid) { + return client.execute(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid) { + return client.executeAsync(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest listRequest(String caseUuid, CasesRegulatoryReportsListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/regulatory-reports/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest createRequest(String caseUuid, CasesRegulatoryReportsCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/regulatory-reports/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code cases.regulatory_reports} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, CasesRegulatoryReportsListParams params, RequestOptions options) { + return client.execute(listRequest(caseUuid, params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, CasesRegulatoryReportsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, params), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> list(String caseUuid, CasesRegulatoryReportsListParams params) { + return client.execute(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, CasesRegulatoryReportsListParams params) { + return client.executeAsync(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse> list(String caseUuid) { + return client.execute(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid, CasesRegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String caseUuid, CasesRegulatoryReportsCreateParams params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CasesRegulatoryReportsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String caseUuid, CasesRegulatoryReportsCreateParams params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CasesRegulatoryReportsCreateParams params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse create(String caseUuid, RequestOptions options) { + return client.execute(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse create(String caseUuid) { + return client.execute(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CasesRegulatoryReportsCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid) { + return client.executeAsync(createRequest(caseUuid, CasesRegulatoryReportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesRequestsResource.java b/src/main/java/me/didit/resources/CasesRequestsResource.java new file mode 100644 index 0000000..36e696c --- /dev/null +++ b/src/main/java/me/didit/resources/CasesRequestsResource.java @@ -0,0 +1,751 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.BinaryResponse; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CasesRequestsListParams; +import me.didit.types.CustomerMessagingCaseRequest; +import me.didit.types.CustomerMessagingCaseRequestConfirmRequest; +import me.didit.types.CustomerMessagingCaseRequestOptions; +import me.didit.types.CustomerMessagingCaseRequestPreviewRequest; +import me.didit.types.CustomerMessagingCaseRequestPreviewResponse; + +/** The {@code cases.requests} resource: {@code client.cases().requests()}. */ +public final class CasesRequestsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesRequestsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(String caseUuid, CasesRequestsListParams params, RequestOptions options) { + return client.execute(listRequest(caseUuid, params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, CasesRequestsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesRequestsListParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public Page list(String caseUuid, CasesRequestsListParams params) { + return client.execute(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, CasesRequestsListParams params) { + return client.executeAsync(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesRequestsListParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public Page list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid, CasesRequestsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, CasesRequestsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, CasesRequestsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public Page list(String caseUuid) { + return client.execute(listRequest(caseUuid, CasesRequestsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid, CasesRequestsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Confirm the exact signed preview within 15 minutes. Only fixed templates and an OTP-verified contact belonging to the case subject are accepted. The request ID makes retries idempotent. Delivery is queued; SENT, SIMULATED and UNKNOWN are distinct outcomes. An actionable request sets the case to Awaiting user. A review update leaves its status unchanged. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CustomerMessagingCaseRequest create(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CustomerMessagingCaseRequest create(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/{request_uuid}/cancel/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public CustomerMessagingCaseRequest cancel(String caseUuid, String requestUuid, RequestOptions options) { + return client.execute(cancelRequest(caseUuid, requestUuid), options, CANCEL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #cancel(String, String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture cancelAsync(String caseUuid, String requestUuid, RequestOptions options) { + return client.executeAsync(cancelRequest(caseUuid, requestUuid), options, CANCEL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #cancel(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return the result + */ + public CustomerMessagingCaseRequest cancel(String caseUuid, String requestUuid) { + return client.execute(cancelRequest(caseUuid, requestUuid), RequestOptions.none(), CANCEL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #cancel(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return a future completed with the result + */ + public CompletableFuture cancelAsync(String caseUuid, String requestUuid) { + return client.executeAsync(cancelRequest(caseUuid, requestUuid), RequestOptions.none(), CANCEL_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/options/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public CustomerMessagingCaseRequestOptions retrieveOptions(String caseUuid, RequestOptions options) { + return client.execute(retrieveOptionsRequest(caseUuid), options, RETRIEVE_OPTIONS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveOptions(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveOptionsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(retrieveOptionsRequest(caseUuid), options, RETRIEVE_OPTIONS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveOptions(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CustomerMessagingCaseRequestOptions retrieveOptions(String caseUuid) { + return client.execute(retrieveOptionsRequest(caseUuid), RequestOptions.none(), RETRIEVE_OPTIONS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveOptions(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveOptionsAsync(String caseUuid) { + return client.executeAsync(retrieveOptionsRequest(caseUuid), RequestOptions.none(), RETRIEVE_OPTIONS_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/{request_uuid}/attachment/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public BinaryResponse retrieveAttachment(String caseUuid, String requestUuid, RequestOptions options) { + return client.execute(retrieveAttachmentRequest(caseUuid, requestUuid), options, RETRIEVE_ATTACHMENT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveAttachment(String, String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAttachmentAsync(String caseUuid, String requestUuid, RequestOptions options) { + return client.executeAsync(retrieveAttachmentRequest(caseUuid, requestUuid), options, RETRIEVE_ATTACHMENT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveAttachment(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return the result + */ + public BinaryResponse retrieveAttachment(String caseUuid, String requestUuid) { + return client.execute(retrieveAttachmentRequest(caseUuid, requestUuid), RequestOptions.none(), RETRIEVE_ATTACHMENT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveAttachment(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAttachmentAsync(String caseUuid, String requestUuid) { + return client.executeAsync(retrieveAttachmentRequest(caseUuid, requestUuid), RequestOptions.none(), RETRIEVE_ATTACHMENT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Render the production email without sending or changing the case. Returns the exact recipient, sender, subject, body and a signed preview_token. Send the same contact_id, purpose, language, request_id, expires_at and preview_token to confirm within 15 minutes. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/preview/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CustomerMessagingCaseRequestPreviewResponse preview(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params, RequestOptions options) { + return client.execute(previewRequest(caseUuid, params), options, PREVIEW_RESPONSE).data(); + } + + /** + * Asynchronous {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture previewAsync(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params, RequestOptions options) { + return client.executeAsync(previewRequest(caseUuid, params), options, PREVIEW_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CustomerMessagingCaseRequestPreviewResponse preview(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params) { + return client.execute(previewRequest(caseUuid, params), RequestOptions.none(), PREVIEW_RESPONSE).data(); + } + + /** + * Asynchronous {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture previewAsync(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params) { + return client.executeAsync(previewRequest(caseUuid, params), RequestOptions.none(), PREVIEW_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(CustomerMessagingCaseRequest::fromJson)); + + private static ApiRequest listRequest(String caseUuid, CasesRequestsListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .queryFields("ordering", "limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CustomerMessagingCaseRequest::fromJson)); + + private static ApiRequest createRequest(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CANCEL_RESPONSE = Responses.json(Conv.model(CustomerMessagingCaseRequest::fromJson)); + + private static ApiRequest cancelRequest(String caseUuid, String requestUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/{request_uuid}/cancel/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("request_uuid", requestUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_OPTIONS_RESPONSE = Responses.json(Conv.model(CustomerMessagingCaseRequestOptions::fromJson)); + + private static ApiRequest retrieveOptionsRequest(String caseUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/options/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_ATTACHMENT_RESPONSE = Responses.binary(); + + private static ApiRequest retrieveAttachmentRequest(String caseUuid, String requestUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/{request_uuid}/attachment/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("request_uuid", requestUuid) + .accept("image/jpeg") + .build(); + } + + private static final ResponseHandler PREVIEW_RESPONSE = Responses.json(Conv.model(CustomerMessagingCaseRequestPreviewResponse::fromJson)); + + private static ApiRequest previewRequest(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/requests/preview/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code cases.requests} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, CasesRequestsListParams params, RequestOptions options) { + return client.execute(listRequest(caseUuid, params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, CasesRequestsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, params), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> list(String caseUuid, CasesRequestsListParams params) { + return client.execute(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, CasesRequestsListParams params) { + return client.executeAsync(listRequest(caseUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String caseUuid, RequestOptions options) { + return client.execute(listRequest(caseUuid, CasesRequestsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listRequest(caseUuid, CasesRequestsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse> list(String caseUuid) { + return client.execute(listRequest(caseUuid, CasesRequestsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, CasesRequestsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String caseUuid) { + return client.executeAsync(listRequest(caseUuid, CasesRequestsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params, RequestOptions options) { + return client.execute(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params, RequestOptions options) { + return client.executeAsync(createRequest(caseUuid, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params) { + return client.execute(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, CustomerMessagingCaseRequestConfirmRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String caseUuid, CustomerMessagingCaseRequestConfirmRequest params) { + return client.executeAsync(createRequest(caseUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #cancel(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse cancel(String caseUuid, String requestUuid, RequestOptions options) { + return client.execute(cancelRequest(caseUuid, requestUuid), options, CANCEL_RESPONSE); + } + + /** + * Asynchronous {@link #cancel(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> cancelAsync(String caseUuid, String requestUuid, RequestOptions options) { + return client.executeAsync(cancelRequest(caseUuid, requestUuid), options, CANCEL_RESPONSE); + } + + /** + * {@link #cancel(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return the result + */ + public RawResponse cancel(String caseUuid, String requestUuid) { + return client.execute(cancelRequest(caseUuid, requestUuid), RequestOptions.none(), CANCEL_RESPONSE); + } + + /** + * Asynchronous {@link #cancel(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return a future completed with the result + */ + public CompletableFuture> cancelAsync(String caseUuid, String requestUuid) { + return client.executeAsync(cancelRequest(caseUuid, requestUuid), RequestOptions.none(), CANCEL_RESPONSE); + } + + /** + * {@link #retrieveOptions(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveOptions(String caseUuid, RequestOptions options) { + return client.execute(retrieveOptionsRequest(caseUuid), options, RETRIEVE_OPTIONS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveOptions(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveOptionsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(retrieveOptionsRequest(caseUuid), options, RETRIEVE_OPTIONS_RESPONSE); + } + + /** + * {@link #retrieveOptions(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse retrieveOptions(String caseUuid) { + return client.execute(retrieveOptionsRequest(caseUuid), RequestOptions.none(), RETRIEVE_OPTIONS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveOptions(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveOptionsAsync(String caseUuid) { + return client.executeAsync(retrieveOptionsRequest(caseUuid), RequestOptions.none(), RETRIEVE_OPTIONS_RESPONSE); + } + + /** + * {@link #retrieveAttachment(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveAttachment(String caseUuid, String requestUuid, RequestOptions options) { + return client.execute(retrieveAttachmentRequest(caseUuid, requestUuid), options, RETRIEVE_ATTACHMENT_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveAttachment(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAttachmentAsync(String caseUuid, String requestUuid, RequestOptions options) { + return client.executeAsync(retrieveAttachmentRequest(caseUuid, requestUuid), options, RETRIEVE_ATTACHMENT_RESPONSE); + } + + /** + * {@link #retrieveAttachment(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return the result + */ + public RawResponse retrieveAttachment(String caseUuid, String requestUuid) { + return client.execute(retrieveAttachmentRequest(caseUuid, requestUuid), RequestOptions.none(), RETRIEVE_ATTACHMENT_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveAttachment(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param requestUuid the {@code request_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAttachmentAsync(String caseUuid, String requestUuid) { + return client.executeAsync(retrieveAttachmentRequest(caseUuid, requestUuid), RequestOptions.none(), RETRIEVE_ATTACHMENT_RESPONSE); + } + + /** + * {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse preview(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params, RequestOptions options) { + return client.execute(previewRequest(caseUuid, params), options, PREVIEW_RESPONSE); + } + + /** + * Asynchronous {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> previewAsync(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params, RequestOptions options) { + return client.executeAsync(previewRequest(caseUuid, params), options, PREVIEW_RESPONSE); + } + + /** + * {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse preview(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params) { + return client.execute(previewRequest(caseUuid, params), RequestOptions.none(), PREVIEW_RESPONSE); + } + + /** + * Asynchronous {@link #preview(String, CustomerMessagingCaseRequestPreviewRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> previewAsync(String caseUuid, CustomerMessagingCaseRequestPreviewRequest params) { + return client.executeAsync(previewRequest(caseUuid, params), RequestOptions.none(), PREVIEW_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesResource.java b/src/main/java/me/didit/resources/CasesResource.java new file mode 100644 index 0000000..be21271 --- /dev/null +++ b/src/main/java/me/didit/resources/CasesResource.java @@ -0,0 +1,3153 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseActionCaseActionReceipt; +import me.didit.types.CaseActionCaseActionReceiptPage; +import me.didit.types.CaseActionCaseEntityActionRequest; +import me.didit.types.CaseActionCaseEntityActionResult; +import me.didit.types.CaseDetail; +import me.didit.types.CaseDuplicateCaseDuplicatePage; +import me.didit.types.CaseDuplicateCaseDuplicateQueryRequest; +import me.didit.types.CaseEvent; +import me.didit.types.CaseListItem; +import me.didit.types.CasesAssignParams; +import me.didit.types.CasesBulkAssignParams; +import me.didit.types.CasesBulkAssignResponse; +import me.didit.types.CasesBulkUpdateStatusParams; +import me.didit.types.CasesBulkUpdateStatusResponse; +import me.didit.types.CasesCreateParams; +import me.didit.types.CasesListActionReceiptsParams; +import me.didit.types.CasesListEventsParams; +import me.didit.types.CasesListParams; +import me.didit.types.CasesListReviewersResponse; +import me.didit.types.CasesPrintResponse; +import me.didit.types.CasesRejectResolutionParams; +import me.didit.types.CasesResolveParams; +import me.didit.types.CasesRetrieveStatisticsParams; +import me.didit.types.CasesRetrieveStatisticsResponse; +import me.didit.types.CasesTransferParams; +import me.didit.types.CasesUpdateParams; +import org.jspecify.annotations.Nullable; + +/** The {@code cases} resource: {@code client.cases()}. */ +public final class CasesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + private final CasesBlueprintsResource blueprints; + private final CasesChecklistResource checklist; + private final CasesLinksResource links; + private final CasesNotesResource notes; + private final CasesRegulatoryReportsResource regulatoryReports; + private final CasesRequestsResource requests; + private final CasesRoutingRulesResource routingRules; + private final CasesTeamsResource teams; + + CasesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + this.blueprints = new CasesBlueprintsResource(client); + this.checklist = new CasesChecklistResource(client); + this.links = new CasesLinksResource(client); + this.notes = new CasesNotesResource(client); + this.regulatoryReports = new CasesRegulatoryReportsResource(client); + this.requests = new CasesRequestsResource(client); + this.routingRules = new CasesRoutingRulesResource(client); + this.teams = new CasesTeamsResource(client); + } + + /** + * The {@code cases.blueprints} resource. + * + * @return the resource + */ + public CasesBlueprintsResource blueprints() { + return blueprints; + } + + /** + * The {@code cases.checklist} resource. + * + * @return the resource + */ + public CasesChecklistResource checklist() { + return checklist; + } + + /** + * The {@code cases.links} resource. + * + * @return the resource + */ + public CasesLinksResource links() { + return links; + } + + /** + * The {@code cases.notes} resource. + * + * @return the resource + */ + public CasesNotesResource notes() { + return notes; + } + + /** + * The {@code cases.regulatory_reports} resource. + * + * @return the resource + */ + public CasesRegulatoryReportsResource regulatoryReports() { + return regulatoryReports; + } + + /** + * The {@code cases.requests} resource. + * + * @return the resource + */ + public CasesRequestsResource requests() { + return requests; + } + + /** + * The {@code cases.routing_rules} resource. + * + * @return the resource + */ + public CasesRoutingRulesResource routingRules() { + return routingRules; + } + + /** + * The {@code cases.teams} resource. + * + * @return the resource + */ + public CasesTeamsResource teams() { + return teams; + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List cases + * + *

List cases for the application, newest first. Supports filtering, search, and sorting; see query parameters. Paginated with limit/offset. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(CasesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(CasesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(CasesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(CasesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(CasesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create case + * + *

Create a case anchored to exactly one subject (a user or a business), directly or by deriving the subject from an attached session/transaction link. Source is always MANUAL for API-created cases. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail create(CasesCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CasesCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(CasesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(CasesCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CaseDetail create(CasesCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CasesCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(CasesCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get case + * + *

Retrieve a case with its subject, blueprint, notes, events, links, and checklist. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail retrieve(String caseUuid, RequestOptions options) { + return client.execute(retrieveRequest(caseUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(caseUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail retrieve(String caseUuid) { + return client.execute(retrieveRequest(caseUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String caseUuid) { + return client.executeAsync(retrieveRequest(caseUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update case + * + *

Update the case's title, priority, due date, or tags. Logs PRIORITY_CHANGED/DUE_DATE_CHANGED/TAG_ADDED/TAG_REMOVED events as applicable. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail update(String caseUuid, CasesUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(caseUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, CasesUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CasesUpdateParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseDetail update(String caseUuid, CasesUpdateParams params) { + return client.execute(updateRequest(caseUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, CasesUpdateParams params) { + return client.executeAsync(updateRequest(caseUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CasesUpdateParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public CaseDetail update(String caseUuid, RequestOptions options) { + return client.execute(updateRequest(caseUuid, CasesUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, CasesUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CasesUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail update(String caseUuid) { + return client.execute(updateRequest(caseUuid, CasesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String caseUuid) { + return client.executeAsync(updateRequest(caseUuid, CasesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete case + * + *

Delete a case. There is no undelete endpoint. + * + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + */ + public void delete(String caseUuid, RequestOptions options) { + client.execute(deleteRequest(caseUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(caseUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + */ + public void delete(String caseUuid) { + client.execute(deleteRequest(caseUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String caseUuid) { + return client.executeAsync(deleteRequest(caseUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Assign or unassign case + * + *

Assign the case to a user, or unassign it by sending assignee_user_id: null. assignee_email/assignee_name auto-provision a User row when the assignee does not exist yet. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/assign/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail assign(String caseUuid, CasesAssignParams params, RequestOptions options) { + return client.execute(assignRequest(caseUuid, params), options, ASSIGN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assign(String, CasesAssignParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture assignAsync(String caseUuid, CasesAssignParams params, RequestOptions options) { + return client.executeAsync(assignRequest(caseUuid, params), options, ASSIGN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #assign(String, CasesAssignParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseDetail assign(String caseUuid, CasesAssignParams params) { + return client.execute(assignRequest(caseUuid, params), RequestOptions.none(), ASSIGN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assign(String, CasesAssignParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture assignAsync(String caseUuid, CasesAssignParams params) { + return client.executeAsync(assignRequest(caseUuid, params), RequestOptions.none(), ASSIGN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Resolve case + * + *

Resolve the case as false_positive or valid_threat. Blocked with 400 if the blueprint's checklist is not optional and items remain incomplete, or if the blueprint requires a resolution note and none is given. When the case's blueprint has a four_eyes_checker_blueprint configured, the resolution is staged (case.pending_resolution) and the case moves to the checker blueprint instead of resolving immediately; a different user must call approve or reject-approval. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/resolve/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail resolve(String caseUuid, CasesResolveParams params, RequestOptions options) { + return client.execute(resolveRequest(caseUuid, params), options, RESOLVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #resolve(String, CasesResolveParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture resolveAsync(String caseUuid, CasesResolveParams params, RequestOptions options) { + return client.executeAsync(resolveRequest(caseUuid, params), options, RESOLVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #resolve(String, CasesResolveParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseDetail resolve(String caseUuid, CasesResolveParams params) { + return client.execute(resolveRequest(caseUuid, params), RequestOptions.none(), RESOLVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #resolve(String, CasesResolveParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture resolveAsync(String caseUuid, CasesResolveParams params) { + return client.executeAsync(resolveRequest(caseUuid, params), RequestOptions.none(), RESOLVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Reopen case + * + *

Move an awaiting-user or resolved case back to open, clearing resolution, resolution_notes, resolved_at, and resolved_by_email. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/reopen/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail reopen(String caseUuid, RequestOptions options) { + return client.execute(reopenRequest(caseUuid), options, REOPEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #reopen(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture reopenAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(reopenRequest(caseUuid), options, REOPEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #reopen(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail reopen(String caseUuid) { + return client.execute(reopenRequest(caseUuid), RequestOptions.none(), REOPEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #reopen(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture reopenAsync(String caseUuid) { + return client.executeAsync(reopenRequest(caseUuid), RequestOptions.none(), REOPEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Request info (awaiting user) + * + *

Move an open case to awaiting_user while more information is collected from the verified user. Fails with 400 if a resolution is currently pending 4-eyes approval. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/request-info/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail requestInfo(String caseUuid, RequestOptions options) { + return client.execute(requestInfoRequest(caseUuid), options, REQUEST_INFO_RESPONSE).data(); + } + + /** + * Asynchronous {@link #requestInfo(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture requestInfoAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(requestInfoRequest(caseUuid), options, REQUEST_INFO_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #requestInfo(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail requestInfo(String caseUuid) { + return client.execute(requestInfoRequest(caseUuid), RequestOptions.none(), REQUEST_INFO_RESPONSE).data(); + } + + /** + * Asynchronous {@link #requestInfo(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture requestInfoAsync(String caseUuid) { + return client.executeAsync(requestInfoRequest(caseUuid), RequestOptions.none(), REQUEST_INFO_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Escalate case + * + *

Move the case to its blueprint's configured escalation_blueprint. Requires the current blueprint to have escalation_enabled and an escalation_blueprint set, otherwise 400. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/escalate/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail escalate(String caseUuid, RequestOptions options) { + return client.execute(escalateRequest(caseUuid), options, ESCALATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #escalate(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture escalateAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(escalateRequest(caseUuid), options, ESCALATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #escalate(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail escalate(String caseUuid) { + return client.execute(escalateRequest(caseUuid), RequestOptions.none(), ESCALATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #escalate(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture escalateAsync(String caseUuid) { + return client.executeAsync(escalateRequest(caseUuid), RequestOptions.none(), ESCALATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Transfer case + * + *

Move the case to a different, active blueprint of the same application. Requires the current blueprint to have transfer_enabled, otherwise 400. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/transfer/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail transfer(String caseUuid, CasesTransferParams params, RequestOptions options) { + return client.execute(transferRequest(caseUuid, params), options, TRANSFER_RESPONSE).data(); + } + + /** + * Asynchronous {@link #transfer(String, CasesTransferParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture transferAsync(String caseUuid, CasesTransferParams params, RequestOptions options) { + return client.executeAsync(transferRequest(caseUuid, params), options, TRANSFER_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #transfer(String, CasesTransferParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseDetail transfer(String caseUuid, CasesTransferParams params) { + return client.execute(transferRequest(caseUuid, params), RequestOptions.none(), TRANSFER_RESPONSE).data(); + } + + /** + * Asynchronous {@link #transfer(String, CasesTransferParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture transferAsync(String caseUuid, CasesTransferParams params) { + return client.executeAsync(transferRequest(caseUuid, params), RequestOptions.none(), TRANSFER_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Approve staged resolution (4-eyes) + * + *

Apply a resolution staged by resolve on a maker blueprint. The caller must be a different user than the one who submitted it, otherwise 403. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/approve/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail approveResolution(String caseUuid, RequestOptions options) { + return client.execute(approveResolutionRequest(caseUuid), options, APPROVE_RESOLUTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #approveResolution(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture approveResolutionAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(approveResolutionRequest(caseUuid), options, APPROVE_RESOLUTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #approveResolution(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail approveResolution(String caseUuid) { + return client.execute(approveResolutionRequest(caseUuid), RequestOptions.none(), APPROVE_RESOLUTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #approveResolution(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture approveResolutionAsync(String caseUuid) { + return client.executeAsync(approveResolutionRequest(caseUuid), RequestOptions.none(), APPROVE_RESOLUTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Reject staged resolution (4-eyes) + * + *

Reject a resolution staged by resolve and return the case to its maker blueprint. The caller must be a different user than the one who submitted it, otherwise 403. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/reject-approval/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDetail rejectResolution(String caseUuid, CasesRejectResolutionParams params, RequestOptions options) { + return client.execute(rejectResolutionRequest(caseUuid, params), options, REJECT_RESOLUTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture rejectResolutionAsync(String caseUuid, CasesRejectResolutionParams params, RequestOptions options) { + return client.executeAsync(rejectResolutionRequest(caseUuid, params), options, REJECT_RESOLUTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseDetail rejectResolution(String caseUuid, CasesRejectResolutionParams params) { + return client.execute(rejectResolutionRequest(caseUuid, params), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture rejectResolutionAsync(String caseUuid, CasesRejectResolutionParams params) { + return client.executeAsync(rejectResolutionRequest(caseUuid, params), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public CaseDetail rejectResolution(String caseUuid, RequestOptions options) { + return client.execute(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), options, REJECT_RESOLUTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture rejectResolutionAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), options, REJECT_RESOLUTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseDetail rejectResolution(String caseUuid) { + return client.execute(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture rejectResolutionAsync(String caseUuid) { + return client.executeAsync(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Apply one explicit action to the case subject. Supply a unique client_reference to obtain an action receipt and make retries idempotent. Reusing that reference with a different payload returns 409. With a reference, inspect receipt.status even when HTTP status is 200: FAILED means no action was applied. Repeating a failed request does not execute it again unless retry is true. Omitting client_reference preserves the legacy response. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/entity-actions/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseActionCaseEntityActionResult applyEntityAction(String caseUuid, CaseActionCaseEntityActionRequest params, RequestOptions options) { + return client.execute(applyEntityActionRequest(caseUuid, params), options, APPLY_ENTITY_ACTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture applyEntityActionAsync(String caseUuid, CaseActionCaseEntityActionRequest params, RequestOptions options) { + return client.executeAsync(applyEntityActionRequest(caseUuid, params), options, APPLY_ENTITY_ACTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseActionCaseEntityActionResult applyEntityAction(String caseUuid, CaseActionCaseEntityActionRequest params) { + return client.execute(applyEntityActionRequest(caseUuid, params), RequestOptions.none(), APPLY_ENTITY_ACTION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture applyEntityActionAsync(String caseUuid, CaseActionCaseEntityActionRequest params) { + return client.executeAsync(applyEntityActionRequest(caseUuid, params), RequestOptions.none(), APPLY_ENTITY_ACTION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Print case (PDF) + * + *

Render the full case (summary, subject, checklist state, notes, attached sessions/transactions, events, FIU report list) as a PDF and return a presigned download URL. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/print/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public CasesPrintResponse print(String caseUuid, RequestOptions options) { + return client.execute(printRequest(caseUuid), options, PRINT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #print(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture printAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(printRequest(caseUuid), options, PRINT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #print(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CasesPrintResponse print(String caseUuid) { + return client.execute(printRequest(caseUuid), RequestOptions.none(), PRINT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #print(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture printAsync(String caseUuid) { + return client.executeAsync(printRequest(caseUuid), RequestOptions.none(), PRINT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List case events + * + *

Read-only audit timeline of the case (created, status changes, assignment, resolution, escalation, transfers, tag/priority/due-date changes, entity actions, and more). + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/events/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param caseUuid Case UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page listEvents(String caseUuid, CasesListEventsParams params, RequestOptions options) { + return client.execute(listEventsRequest(caseUuid, params), options, LIST_EVENTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listEventsAsync(String caseUuid, CasesListEventsParams params, RequestOptions options) { + return client.executeAsync(listEventsRequest(caseUuid, params), options, LIST_EVENTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listEvents(String, CasesListEventsParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public Page listEvents(String caseUuid, CasesListEventsParams params) { + return client.execute(listEventsRequest(caseUuid, params), RequestOptions.none(), LIST_EVENTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listEventsAsync(String caseUuid, CasesListEventsParams params) { + return client.executeAsync(listEventsRequest(caseUuid, params), RequestOptions.none(), LIST_EVENTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listEvents(String, CasesListEventsParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public Page listEvents(String caseUuid, RequestOptions options) { + return client.execute(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), options, LIST_EVENTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listEventsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), options, LIST_EVENTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listEvents(String, CasesListEventsParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public Page listEvents(String caseUuid) { + return client.execute(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), RequestOptions.none(), LIST_EVENTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listEventsAsync(String caseUuid) { + return client.executeAsync(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), RequestOptions.none(), LIST_EVENTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List case AML hits + * + *

List AML screening hits for the case's subject. Same shape as the hits returned by POST /v3/aml/. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/aml/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid Case UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public List> listAmlHits(String caseUuid, RequestOptions options) { + return client.execute(listAmlHitsRequest(caseUuid), options, LIST_AML_HITS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listAmlHits(String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAmlHitsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listAmlHitsRequest(caseUuid), options, LIST_AML_HITS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listAmlHits(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public List> listAmlHits(String caseUuid) { + return client.execute(listAmlHitsRequest(caseUuid), RequestOptions.none(), LIST_AML_HITS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listAmlHits(String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAmlHitsAsync(String caseUuid) { + return client.executeAsync(listAmlHitsRequest(caseUuid), RequestOptions.none(), LIST_AML_HITS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Case analytics + * + *

Aggregate case analytics for the date range (defaults to the last 30 days; max 731 days). Charts, tables, totals, assignment events, and current queue counts use the same application-scoped filters. Filters use current case values. Dates apply to each metric event, so older cases assigned or resolved during the period remain included. Queue depth is independent of the date range. Invalid filters return 400; an unknown blueprint or assignee returns an empty result. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/statistics/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasesRetrieveStatisticsResponse retrieveStatistics(CasesRetrieveStatisticsParams params, RequestOptions options) { + return client.execute(retrieveStatisticsRequest(params), options, RETRIEVE_STATISTICS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveStatisticsAsync(CasesRetrieveStatisticsParams params, RequestOptions options) { + return client.executeAsync(retrieveStatisticsRequest(params), options, RETRIEVE_STATISTICS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CasesRetrieveStatisticsResponse retrieveStatistics(CasesRetrieveStatisticsParams params) { + return client.execute(retrieveStatisticsRequest(params), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture retrieveStatisticsAsync(CasesRetrieveStatisticsParams params) { + return client.executeAsync(retrieveStatisticsRequest(params), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public CasesRetrieveStatisticsResponse retrieveStatistics(RequestOptions options) { + return client.execute(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), options, RETRIEVE_STATISTICS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveStatisticsAsync(RequestOptions options) { + return client.executeAsync(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), options, RETRIEVE_STATISTICS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public CasesRetrieveStatisticsResponse retrieveStatistics() { + return client.execute(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture retrieveStatisticsAsync() { + return client.executeAsync(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Bulk update case status + * + *

Apply the same status transition to several cases in one call: OPEN reopens, AWAITING_USER requests info, RESOLVED resolves (resolution required). Each case is evaluated independently; gate failures (incomplete checklist, missing required note) are reported per case without aborting the batch. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/bulk/status/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasesBulkUpdateStatusResponse bulkUpdateStatus(CasesBulkUpdateStatusParams params, RequestOptions options) { + return client.execute(bulkUpdateStatusRequest(params), options, BULK_UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture bulkUpdateStatusAsync(CasesBulkUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(bulkUpdateStatusRequest(params), options, BULK_UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CasesBulkUpdateStatusResponse bulkUpdateStatus(CasesBulkUpdateStatusParams params) { + return client.execute(bulkUpdateStatusRequest(params), RequestOptions.none(), BULK_UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture bulkUpdateStatusAsync(CasesBulkUpdateStatusParams params) { + return client.executeAsync(bulkUpdateStatusRequest(params), RequestOptions.none(), BULK_UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Bulk assign cases + * + *

Assign (or unassign, with assignee_user_id: null) several cases at once. All cases must share the same blueprint; mismatches are reported per case without aborting the batch. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/bulk/assign/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CasesBulkAssignResponse bulkAssign(CasesBulkAssignParams params, RequestOptions options) { + return client.execute(bulkAssignRequest(params), options, BULK_ASSIGN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture bulkAssignAsync(CasesBulkAssignParams params, RequestOptions options) { + return client.executeAsync(bulkAssignRequest(params), options, BULK_ASSIGN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CasesBulkAssignResponse bulkAssign(CasesBulkAssignParams params) { + return client.execute(bulkAssignRequest(params), RequestOptions.none(), BULK_ASSIGN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture bulkAssignAsync(CasesBulkAssignParams params) { + return client.executeAsync(bulkAssignRequest(params), RequestOptions.none(), BULK_ASSIGN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List subject-action receipts, newest first, with at most 20 results per page. Use next_offset for the next page. Input note text is not exposed in the history. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/action-receipts/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseActionCaseActionReceiptPage listActionReceipts(String caseUuid, CasesListActionReceiptsParams params, RequestOptions options) { + return client.execute(listActionReceiptsRequest(caseUuid, params), options, LIST_ACTION_RECEIPTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listActionReceiptsAsync(String caseUuid, CasesListActionReceiptsParams params, RequestOptions options) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, params), options, LIST_ACTION_RECEIPTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public CaseActionCaseActionReceiptPage listActionReceipts(String caseUuid, CasesListActionReceiptsParams params) { + return client.execute(listActionReceiptsRequest(caseUuid, params), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture listActionReceiptsAsync(String caseUuid, CasesListActionReceiptsParams params) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, params), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public CaseActionCaseActionReceiptPage listActionReceipts(String caseUuid, RequestOptions options) { + return client.execute(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), options, LIST_ACTION_RECEIPTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listActionReceiptsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), options, LIST_ACTION_RECEIPTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public CaseActionCaseActionReceiptPage listActionReceipts(String caseUuid) { + return client.execute(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)}, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture listActionReceiptsAsync(String caseUuid) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Retry only this failed subject action using its saved inputs. Current write permission is checked. Applied actions return their receipt without executing again. Case closure is independent. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/action-receipts/{receipt_uuid}/retry/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public CaseActionCaseActionReceipt retryActionReceipt(String caseUuid, String receiptUuid, RequestOptions options) { + return client.execute(retryActionReceiptRequest(caseUuid, receiptUuid), options, RETRY_ACTION_RECEIPT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retryActionReceipt(String, String, RequestOptions)}. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retryActionReceiptAsync(String caseUuid, String receiptUuid, RequestOptions options) { + return client.executeAsync(retryActionReceiptRequest(caseUuid, receiptUuid), options, RETRY_ACTION_RECEIPT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retryActionReceipt(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @return the result + */ + public CaseActionCaseActionReceipt retryActionReceipt(String caseUuid, String receiptUuid) { + return client.execute(retryActionReceiptRequest(caseUuid, receiptUuid), RequestOptions.none(), RETRY_ACTION_RECEIPT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retryActionReceipt(String, String, RequestOptions)}, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @return a future completed with the result + */ + public CompletableFuture retryActionReceiptAsync(String caseUuid, String receiptUuid) { + return client.executeAsync(retryActionReceiptRequest(caseUuid, receiptUuid), RequestOptions.none(), RETRY_ACTION_RECEIPT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Review existing cases for a subject or owned source record before manual case creation. Both open and resolved investigations are returned. Each page contains at most 20 cases; use next_offset to request another page. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/duplicates/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseDuplicateCaseDuplicatePage findDuplicates(CaseDuplicateCaseDuplicateQueryRequest params, RequestOptions options) { + return client.execute(findDuplicatesRequest(params), options, FIND_DUPLICATES_RESPONSE).data(); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture findDuplicatesAsync(CaseDuplicateCaseDuplicateQueryRequest params, RequestOptions options) { + return client.executeAsync(findDuplicatesRequest(params), options, FIND_DUPLICATES_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CaseDuplicateCaseDuplicatePage findDuplicates(CaseDuplicateCaseDuplicateQueryRequest params) { + return client.execute(findDuplicatesRequest(params), RequestOptions.none(), FIND_DUPLICATES_RESPONSE).data(); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture findDuplicatesAsync(CaseDuplicateCaseDuplicateQueryRequest params) { + return client.executeAsync(findDuplicatesRequest(params), RequestOptions.none(), FIND_DUPLICATES_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public CaseDuplicateCaseDuplicatePage findDuplicates(RequestOptions options) { + return client.execute(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), options, FIND_DUPLICATES_RESPONSE).data(); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture findDuplicatesAsync(RequestOptions options) { + return client.executeAsync(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), options, FIND_DUPLICATES_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public CaseDuplicateCaseDuplicatePage findDuplicates() { + return client.execute(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), RequestOptions.none(), FIND_DUPLICATES_RESPONSE).data(); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture findDuplicatesAsync() { + return client.executeAsync(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), RequestOptions.none(), FIND_DUPLICATES_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List eligible case reviewers + * + *

Requires list:cases for the requested application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/reviewers/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param options per-request options that override the client options + * @return the response body + */ + public CasesListReviewersResponse listReviewers(RequestOptions options) { + return client.execute(listReviewersRequest(), options, LIST_REVIEWERS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listReviewers(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listReviewersAsync(RequestOptions options) { + return client.executeAsync(listReviewersRequest(), options, LIST_REVIEWERS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listReviewers(RequestOptions)}, with the client's options. + * + * @return the result + */ + public CasesListReviewersResponse listReviewers() { + return client.execute(listReviewersRequest(), RequestOptions.none(), LIST_REVIEWERS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listReviewers(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture listReviewersAsync() { + return client.executeAsync(listReviewersRequest(), RequestOptions.none(), LIST_REVIEWERS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(CaseListItem::fromJson)); + + private static ApiRequest listRequest(CasesListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/") + .applicationScoped() + .params(params) + .queryFields("limit", "offset", "status__in", "priority", "source__in", "blueprint", "assigned_to", "unassigned", "tag", "search", "date_from", "date_to", "due_before", "overdue", "ordering") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest createRequest(CasesCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest retrieveRequest(String caseUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest updateRequest(String caseUuid, CasesUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String caseUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler ASSIGN_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest assignRequest(String caseUuid, CasesAssignParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/assign/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RESOLVE_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest resolveRequest(String caseUuid, CasesResolveParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/resolve/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler REOPEN_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest reopenRequest(String caseUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/reopen/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler REQUEST_INFO_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest requestInfoRequest(String caseUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/request-info/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler ESCALATE_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest escalateRequest(String caseUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/escalate/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler TRANSFER_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest transferRequest(String caseUuid, CasesTransferParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/transfer/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler APPROVE_RESOLUTION_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest approveResolutionRequest(String caseUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/approve/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler REJECT_RESOLUTION_RESPONSE = Responses.json(Conv.model(CaseDetail::fromJson)); + + private static ApiRequest rejectResolutionRequest(String caseUuid, CasesRejectResolutionParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/reject-approval/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler APPLY_ENTITY_ACTION_RESPONSE = Responses.json(Conv.model(CaseActionCaseEntityActionResult::fromJson)); + + private static ApiRequest applyEntityActionRequest(String caseUuid, CaseActionCaseEntityActionRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/entity-actions/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler PRINT_RESPONSE = Responses.json(Conv.model(CasesPrintResponse::fromJson)); + + private static ApiRequest printRequest(String caseUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/print/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler> LIST_EVENTS_RESPONSE = Responses.page(Conv.model(CaseEvent::fromJson)); + + private static ApiRequest listEventsRequest(String caseUuid, CasesListEventsParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/events/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler>> LIST_AML_HITS_RESPONSE = Responses.json(Conv.list(Conv.OBJECT)); + + private static ApiRequest listAmlHitsRequest(String caseUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/aml/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_STATISTICS_RESPONSE = Responses.json(Conv.model(CasesRetrieveStatisticsResponse::fromJson)); + + private static ApiRequest retrieveStatisticsRequest(CasesRetrieveStatisticsParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/statistics/") + .applicationScoped() + .params(params) + .queryFields("date_from", "date_to", "blueprint", "assigned_to", "priority", "source", "status") + .build(); + } + + private static final ResponseHandler BULK_UPDATE_STATUS_RESPONSE = Responses.json(Conv.model(CasesBulkUpdateStatusResponse::fromJson)); + + private static ApiRequest bulkUpdateStatusRequest(CasesBulkUpdateStatusParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/bulk/status/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler BULK_ASSIGN_RESPONSE = Responses.json(Conv.model(CasesBulkAssignResponse::fromJson)); + + private static ApiRequest bulkAssignRequest(CasesBulkAssignParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/bulk/assign/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LIST_ACTION_RECEIPTS_RESPONSE = Responses.json(Conv.model(CaseActionCaseActionReceiptPage::fromJson)); + + private static ApiRequest listActionReceiptsRequest(String caseUuid, CasesListActionReceiptsParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/action-receipts/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .params(params) + .queryFields("offset") + .build(); + } + + private static final ResponseHandler RETRY_ACTION_RECEIPT_RESPONSE = Responses.json(Conv.model(CaseActionCaseActionReceipt::fromJson)); + + private static ApiRequest retryActionReceiptRequest(String caseUuid, String receiptUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/action-receipts/{receipt_uuid}/retry/") + .applicationScoped() + .pathParam("case_uuid", caseUuid) + .pathParam("receipt_uuid", receiptUuid) + .build(); + } + + private static final ResponseHandler FIND_DUPLICATES_RESPONSE = Responses.json(Conv.model(CaseDuplicateCaseDuplicatePage::fromJson)); + + private static ApiRequest findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/duplicates/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LIST_REVIEWERS_RESPONSE = Responses.json(Conv.model(CasesListReviewersResponse::fromJson)); + + private static ApiRequest listReviewersRequest() { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/reviewers/") + .applicationScoped() + .build(); + } + + /** The {@code cases} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(CasesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(CasesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(CasesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(CasesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(CasesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(CasesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(CasesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(CasesCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(CasesCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CasesCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CasesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(CasesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(CasesCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CasesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CasesCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String caseUuid, RequestOptions options) { + return client.execute(retrieveRequest(caseUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(caseUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse retrieve(String caseUuid) { + return client.execute(retrieveRequest(caseUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String caseUuid) { + return client.executeAsync(retrieveRequest(caseUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String caseUuid, CasesUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(caseUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, CasesUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String caseUuid, CasesUpdateParams params) { + return client.execute(updateRequest(caseUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, CasesUpdateParams params) { + return client.executeAsync(updateRequest(caseUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse update(String caseUuid, RequestOptions options) { + return client.execute(updateRequest(caseUuid, CasesUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(updateRequest(caseUuid, CasesUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse update(String caseUuid) { + return client.execute(updateRequest(caseUuid, CasesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CasesUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String caseUuid) { + return client.executeAsync(updateRequest(caseUuid, CasesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String caseUuid, RequestOptions options) { + return client.execute(deleteRequest(caseUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(caseUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String caseUuid) { + return client.execute(deleteRequest(caseUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String caseUuid) { + return client.executeAsync(deleteRequest(caseUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #assign(String, CasesAssignParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse assign(String caseUuid, CasesAssignParams params, RequestOptions options) { + return client.execute(assignRequest(caseUuid, params), options, ASSIGN_RESPONSE); + } + + /** + * Asynchronous {@link #assign(String, CasesAssignParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> assignAsync(String caseUuid, CasesAssignParams params, RequestOptions options) { + return client.executeAsync(assignRequest(caseUuid, params), options, ASSIGN_RESPONSE); + } + + /** + * {@link #assign(String, CasesAssignParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse assign(String caseUuid, CasesAssignParams params) { + return client.execute(assignRequest(caseUuid, params), RequestOptions.none(), ASSIGN_RESPONSE); + } + + /** + * Asynchronous {@link #assign(String, CasesAssignParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> assignAsync(String caseUuid, CasesAssignParams params) { + return client.executeAsync(assignRequest(caseUuid, params), RequestOptions.none(), ASSIGN_RESPONSE); + } + + /** + * {@link #resolve(String, CasesResolveParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse resolve(String caseUuid, CasesResolveParams params, RequestOptions options) { + return client.execute(resolveRequest(caseUuid, params), options, RESOLVE_RESPONSE); + } + + /** + * Asynchronous {@link #resolve(String, CasesResolveParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> resolveAsync(String caseUuid, CasesResolveParams params, RequestOptions options) { + return client.executeAsync(resolveRequest(caseUuid, params), options, RESOLVE_RESPONSE); + } + + /** + * {@link #resolve(String, CasesResolveParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse resolve(String caseUuid, CasesResolveParams params) { + return client.execute(resolveRequest(caseUuid, params), RequestOptions.none(), RESOLVE_RESPONSE); + } + + /** + * Asynchronous {@link #resolve(String, CasesResolveParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> resolveAsync(String caseUuid, CasesResolveParams params) { + return client.executeAsync(resolveRequest(caseUuid, params), RequestOptions.none(), RESOLVE_RESPONSE); + } + + /** + * {@link #reopen(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse reopen(String caseUuid, RequestOptions options) { + return client.execute(reopenRequest(caseUuid), options, REOPEN_RESPONSE); + } + + /** + * Asynchronous {@link #reopen(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> reopenAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(reopenRequest(caseUuid), options, REOPEN_RESPONSE); + } + + /** + * {@link #reopen(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse reopen(String caseUuid) { + return client.execute(reopenRequest(caseUuid), RequestOptions.none(), REOPEN_RESPONSE); + } + + /** + * Asynchronous {@link #reopen(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> reopenAsync(String caseUuid) { + return client.executeAsync(reopenRequest(caseUuid), RequestOptions.none(), REOPEN_RESPONSE); + } + + /** + * {@link #requestInfo(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse requestInfo(String caseUuid, RequestOptions options) { + return client.execute(requestInfoRequest(caseUuid), options, REQUEST_INFO_RESPONSE); + } + + /** + * Asynchronous {@link #requestInfo(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> requestInfoAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(requestInfoRequest(caseUuid), options, REQUEST_INFO_RESPONSE); + } + + /** + * {@link #requestInfo(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse requestInfo(String caseUuid) { + return client.execute(requestInfoRequest(caseUuid), RequestOptions.none(), REQUEST_INFO_RESPONSE); + } + + /** + * Asynchronous {@link #requestInfo(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> requestInfoAsync(String caseUuid) { + return client.executeAsync(requestInfoRequest(caseUuid), RequestOptions.none(), REQUEST_INFO_RESPONSE); + } + + /** + * {@link #escalate(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse escalate(String caseUuid, RequestOptions options) { + return client.execute(escalateRequest(caseUuid), options, ESCALATE_RESPONSE); + } + + /** + * Asynchronous {@link #escalate(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> escalateAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(escalateRequest(caseUuid), options, ESCALATE_RESPONSE); + } + + /** + * {@link #escalate(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse escalate(String caseUuid) { + return client.execute(escalateRequest(caseUuid), RequestOptions.none(), ESCALATE_RESPONSE); + } + + /** + * Asynchronous {@link #escalate(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> escalateAsync(String caseUuid) { + return client.executeAsync(escalateRequest(caseUuid), RequestOptions.none(), ESCALATE_RESPONSE); + } + + /** + * {@link #transfer(String, CasesTransferParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse transfer(String caseUuid, CasesTransferParams params, RequestOptions options) { + return client.execute(transferRequest(caseUuid, params), options, TRANSFER_RESPONSE); + } + + /** + * Asynchronous {@link #transfer(String, CasesTransferParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> transferAsync(String caseUuid, CasesTransferParams params, RequestOptions options) { + return client.executeAsync(transferRequest(caseUuid, params), options, TRANSFER_RESPONSE); + } + + /** + * {@link #transfer(String, CasesTransferParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse transfer(String caseUuid, CasesTransferParams params) { + return client.execute(transferRequest(caseUuid, params), RequestOptions.none(), TRANSFER_RESPONSE); + } + + /** + * Asynchronous {@link #transfer(String, CasesTransferParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> transferAsync(String caseUuid, CasesTransferParams params) { + return client.executeAsync(transferRequest(caseUuid, params), RequestOptions.none(), TRANSFER_RESPONSE); + } + + /** + * {@link #approveResolution(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse approveResolution(String caseUuid, RequestOptions options) { + return client.execute(approveResolutionRequest(caseUuid), options, APPROVE_RESOLUTION_RESPONSE); + } + + /** + * Asynchronous {@link #approveResolution(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> approveResolutionAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(approveResolutionRequest(caseUuid), options, APPROVE_RESOLUTION_RESPONSE); + } + + /** + * {@link #approveResolution(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse approveResolution(String caseUuid) { + return client.execute(approveResolutionRequest(caseUuid), RequestOptions.none(), APPROVE_RESOLUTION_RESPONSE); + } + + /** + * Asynchronous {@link #approveResolution(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> approveResolutionAsync(String caseUuid) { + return client.executeAsync(approveResolutionRequest(caseUuid), RequestOptions.none(), APPROVE_RESOLUTION_RESPONSE); + } + + /** + * {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse rejectResolution(String caseUuid, CasesRejectResolutionParams params, RequestOptions options) { + return client.execute(rejectResolutionRequest(caseUuid, params), options, REJECT_RESOLUTION_RESPONSE); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> rejectResolutionAsync(String caseUuid, CasesRejectResolutionParams params, RequestOptions options) { + return client.executeAsync(rejectResolutionRequest(caseUuid, params), options, REJECT_RESOLUTION_RESPONSE); + } + + /** + * {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse rejectResolution(String caseUuid, CasesRejectResolutionParams params) { + return client.execute(rejectResolutionRequest(caseUuid, params), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> rejectResolutionAsync(String caseUuid, CasesRejectResolutionParams params) { + return client.executeAsync(rejectResolutionRequest(caseUuid, params), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE); + } + + /** + * {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse rejectResolution(String caseUuid, RequestOptions options) { + return client.execute(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), options, REJECT_RESOLUTION_RESPONSE); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> rejectResolutionAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), options, REJECT_RESOLUTION_RESPONSE); + } + + /** + * {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse rejectResolution(String caseUuid) { + return client.execute(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE); + } + + /** + * Asynchronous {@link #rejectResolution(String, CasesRejectResolutionParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> rejectResolutionAsync(String caseUuid) { + return client.executeAsync(rejectResolutionRequest(caseUuid, CasesRejectResolutionParams.builder().build()), RequestOptions.none(), REJECT_RESOLUTION_RESPONSE); + } + + /** + * {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse applyEntityAction(String caseUuid, CaseActionCaseEntityActionRequest params, RequestOptions options) { + return client.execute(applyEntityActionRequest(caseUuid, params), options, APPLY_ENTITY_ACTION_RESPONSE); + } + + /** + * Asynchronous {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> applyEntityActionAsync(String caseUuid, CaseActionCaseEntityActionRequest params, RequestOptions options) { + return client.executeAsync(applyEntityActionRequest(caseUuid, params), options, APPLY_ENTITY_ACTION_RESPONSE); + } + + /** + * {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse applyEntityAction(String caseUuid, CaseActionCaseEntityActionRequest params) { + return client.execute(applyEntityActionRequest(caseUuid, params), RequestOptions.none(), APPLY_ENTITY_ACTION_RESPONSE); + } + + /** + * Asynchronous {@link #applyEntityAction(String, CaseActionCaseEntityActionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> applyEntityActionAsync(String caseUuid, CaseActionCaseEntityActionRequest params) { + return client.executeAsync(applyEntityActionRequest(caseUuid, params), RequestOptions.none(), APPLY_ENTITY_ACTION_RESPONSE); + } + + /** + * {@link #print(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse print(String caseUuid, RequestOptions options) { + return client.execute(printRequest(caseUuid), options, PRINT_RESPONSE); + } + + /** + * Asynchronous {@link #print(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> printAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(printRequest(caseUuid), options, PRINT_RESPONSE); + } + + /** + * {@link #print(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse print(String caseUuid) { + return client.execute(printRequest(caseUuid), RequestOptions.none(), PRINT_RESPONSE); + } + + /** + * Asynchronous {@link #print(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> printAsync(String caseUuid) { + return client.executeAsync(printRequest(caseUuid), RequestOptions.none(), PRINT_RESPONSE); + } + + /** + * {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> listEvents(String caseUuid, CasesListEventsParams params, RequestOptions options) { + return client.execute(listEventsRequest(caseUuid, params), options, LIST_EVENTS_RESPONSE); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listEventsAsync(String caseUuid, CasesListEventsParams params, RequestOptions options) { + return client.executeAsync(listEventsRequest(caseUuid, params), options, LIST_EVENTS_RESPONSE); + } + + /** + * {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> listEvents(String caseUuid, CasesListEventsParams params) { + return client.execute(listEventsRequest(caseUuid, params), RequestOptions.none(), LIST_EVENTS_RESPONSE); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listEventsAsync(String caseUuid, CasesListEventsParams params) { + return client.executeAsync(listEventsRequest(caseUuid, params), RequestOptions.none(), LIST_EVENTS_RESPONSE); + } + + /** + * {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> listEvents(String caseUuid, RequestOptions options) { + return client.execute(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), options, LIST_EVENTS_RESPONSE); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listEventsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), options, LIST_EVENTS_RESPONSE); + } + + /** + * {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse> listEvents(String caseUuid) { + return client.execute(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), RequestOptions.none(), LIST_EVENTS_RESPONSE); + } + + /** + * Asynchronous {@link #listEvents(String, CasesListEventsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listEventsAsync(String caseUuid) { + return client.executeAsync(listEventsRequest(caseUuid, CasesListEventsParams.builder().build()), RequestOptions.none(), LIST_EVENTS_RESPONSE); + } + + /** + * {@link #listAmlHits(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse>> listAmlHits(String caseUuid, RequestOptions options) { + return client.execute(listAmlHitsRequest(caseUuid), options, LIST_AML_HITS_RESPONSE); + } + + /** + * Asynchronous {@link #listAmlHits(String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>>> listAmlHitsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listAmlHitsRequest(caseUuid), options, LIST_AML_HITS_RESPONSE); + } + + /** + * {@link #listAmlHits(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse>> listAmlHits(String caseUuid) { + return client.execute(listAmlHitsRequest(caseUuid), RequestOptions.none(), LIST_AML_HITS_RESPONSE); + } + + /** + * Asynchronous {@link #listAmlHits(String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture>>> listAmlHitsAsync(String caseUuid) { + return client.executeAsync(listAmlHitsRequest(caseUuid), RequestOptions.none(), LIST_AML_HITS_RESPONSE); + } + + /** + * {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse retrieveStatistics(CasesRetrieveStatisticsParams params, RequestOptions options) { + return client.execute(retrieveStatisticsRequest(params), options, RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveStatisticsAsync(CasesRetrieveStatisticsParams params, RequestOptions options) { + return client.executeAsync(retrieveStatisticsRequest(params), options, RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse retrieveStatistics(CasesRetrieveStatisticsParams params) { + return client.execute(retrieveStatisticsRequest(params), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> retrieveStatisticsAsync(CasesRetrieveStatisticsParams params) { + return client.executeAsync(retrieveStatisticsRequest(params), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse retrieveStatistics(RequestOptions options) { + return client.execute(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), options, RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveStatisticsAsync(RequestOptions options) { + return client.executeAsync(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), options, RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse retrieveStatistics() { + return client.execute(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveStatistics(CasesRetrieveStatisticsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> retrieveStatisticsAsync() { + return client.executeAsync(retrieveStatisticsRequest(CasesRetrieveStatisticsParams.builder().build()), RequestOptions.none(), RETRIEVE_STATISTICS_RESPONSE); + } + + /** + * {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse bulkUpdateStatus(CasesBulkUpdateStatusParams params, RequestOptions options) { + return client.execute(bulkUpdateStatusRequest(params), options, BULK_UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> bulkUpdateStatusAsync(CasesBulkUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(bulkUpdateStatusRequest(params), options, BULK_UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse bulkUpdateStatus(CasesBulkUpdateStatusParams params) { + return client.execute(bulkUpdateStatusRequest(params), RequestOptions.none(), BULK_UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #bulkUpdateStatus(CasesBulkUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> bulkUpdateStatusAsync(CasesBulkUpdateStatusParams params) { + return client.executeAsync(bulkUpdateStatusRequest(params), RequestOptions.none(), BULK_UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse bulkAssign(CasesBulkAssignParams params, RequestOptions options) { + return client.execute(bulkAssignRequest(params), options, BULK_ASSIGN_RESPONSE); + } + + /** + * Asynchronous {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> bulkAssignAsync(CasesBulkAssignParams params, RequestOptions options) { + return client.executeAsync(bulkAssignRequest(params), options, BULK_ASSIGN_RESPONSE); + } + + /** + * {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse bulkAssign(CasesBulkAssignParams params) { + return client.execute(bulkAssignRequest(params), RequestOptions.none(), BULK_ASSIGN_RESPONSE); + } + + /** + * Asynchronous {@link #bulkAssign(CasesBulkAssignParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> bulkAssignAsync(CasesBulkAssignParams params) { + return client.executeAsync(bulkAssignRequest(params), RequestOptions.none(), BULK_ASSIGN_RESPONSE); + } + + /** + * {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse listActionReceipts(String caseUuid, CasesListActionReceiptsParams params, RequestOptions options) { + return client.execute(listActionReceiptsRequest(caseUuid, params), options, LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listActionReceiptsAsync(String caseUuid, CasesListActionReceiptsParams params, RequestOptions options) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, params), options, LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse listActionReceipts(String caseUuid, CasesListActionReceiptsParams params) { + return client.execute(listActionReceiptsRequest(caseUuid, params), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listActionReceiptsAsync(String caseUuid, CasesListActionReceiptsParams params) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, params), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listActionReceipts(String caseUuid, RequestOptions options) { + return client.execute(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), options, LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response, without parameters. + * + * @param caseUuid the {@code case_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listActionReceiptsAsync(String caseUuid, RequestOptions options) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), options, LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return the result + */ + public RawResponse listActionReceipts(String caseUuid) { + return client.execute(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * Asynchronous {@link #listActionReceipts(String, CasesListActionReceiptsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listActionReceiptsAsync(String caseUuid) { + return client.executeAsync(listActionReceiptsRequest(caseUuid, CasesListActionReceiptsParams.builder().build()), RequestOptions.none(), LIST_ACTION_RECEIPTS_RESPONSE); + } + + /** + * {@link #retryActionReceipt(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retryActionReceipt(String caseUuid, String receiptUuid, RequestOptions options) { + return client.execute(retryActionReceiptRequest(caseUuid, receiptUuid), options, RETRY_ACTION_RECEIPT_RESPONSE); + } + + /** + * Asynchronous {@link #retryActionReceipt(String, String, RequestOptions)} with the raw response. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retryActionReceiptAsync(String caseUuid, String receiptUuid, RequestOptions options) { + return client.executeAsync(retryActionReceiptRequest(caseUuid, receiptUuid), options, RETRY_ACTION_RECEIPT_RESPONSE); + } + + /** + * {@link #retryActionReceipt(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @return the result + */ + public RawResponse retryActionReceipt(String caseUuid, String receiptUuid) { + return client.execute(retryActionReceiptRequest(caseUuid, receiptUuid), RequestOptions.none(), RETRY_ACTION_RECEIPT_RESPONSE); + } + + /** + * Asynchronous {@link #retryActionReceipt(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param caseUuid the {@code case_uuid} + * @param receiptUuid the {@code receipt_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retryActionReceiptAsync(String caseUuid, String receiptUuid) { + return client.executeAsync(retryActionReceiptRequest(caseUuid, receiptUuid), RequestOptions.none(), RETRY_ACTION_RECEIPT_RESPONSE); + } + + /** + * {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse findDuplicates(CaseDuplicateCaseDuplicateQueryRequest params, RequestOptions options) { + return client.execute(findDuplicatesRequest(params), options, FIND_DUPLICATES_RESPONSE); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> findDuplicatesAsync(CaseDuplicateCaseDuplicateQueryRequest params, RequestOptions options) { + return client.executeAsync(findDuplicatesRequest(params), options, FIND_DUPLICATES_RESPONSE); + } + + /** + * {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse findDuplicates(CaseDuplicateCaseDuplicateQueryRequest params) { + return client.execute(findDuplicatesRequest(params), RequestOptions.none(), FIND_DUPLICATES_RESPONSE); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> findDuplicatesAsync(CaseDuplicateCaseDuplicateQueryRequest params) { + return client.executeAsync(findDuplicatesRequest(params), RequestOptions.none(), FIND_DUPLICATES_RESPONSE); + } + + /** + * {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse findDuplicates(RequestOptions options) { + return client.execute(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), options, FIND_DUPLICATES_RESPONSE); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> findDuplicatesAsync(RequestOptions options) { + return client.executeAsync(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), options, FIND_DUPLICATES_RESPONSE); + } + + /** + * {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse findDuplicates() { + return client.execute(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), RequestOptions.none(), FIND_DUPLICATES_RESPONSE); + } + + /** + * Asynchronous {@link #findDuplicates(CaseDuplicateCaseDuplicateQueryRequest, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> findDuplicatesAsync() { + return client.executeAsync(findDuplicatesRequest(CaseDuplicateCaseDuplicateQueryRequest.builder().build()), RequestOptions.none(), FIND_DUPLICATES_RESPONSE); + } + + /** + * {@link #listReviewers(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse listReviewers(RequestOptions options) { + return client.execute(listReviewersRequest(), options, LIST_REVIEWERS_RESPONSE); + } + + /** + * Asynchronous {@link #listReviewers(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listReviewersAsync(RequestOptions options) { + return client.executeAsync(listReviewersRequest(), options, LIST_REVIEWERS_RESPONSE); + } + + /** + * {@link #listReviewers(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse listReviewers() { + return client.execute(listReviewersRequest(), RequestOptions.none(), LIST_REVIEWERS_RESPONSE); + } + + /** + * Asynchronous {@link #listReviewers(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listReviewersAsync() { + return client.executeAsync(listReviewersRequest(), RequestOptions.none(), LIST_REVIEWERS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesRoutingRulesResource.java b/src/main/java/me/didit/resources/CasesRoutingRulesResource.java new file mode 100644 index 0000000..bdec62e --- /dev/null +++ b/src/main/java/me/didit/resources/CasesRoutingRulesResource.java @@ -0,0 +1,1228 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseRoutingPreview; +import me.didit.types.CaseRoutingPreviewRequest; +import me.didit.types.CaseRoutingRule; +import me.didit.types.CaseRoutingRuleCreate; +import me.didit.types.CaseRoutingRuleUpdate; +import me.didit.types.CasesRoutingRulesListHistoryParams; +import me.didit.types.CasesRoutingRulesListParams; +import me.didit.types.RoutingPublicationCaseRoutingRule; +import me.didit.types.RoutingPublicationPolicyDraft; +import me.didit.types.RoutingPublicationPolicyDraftPreconditionRequest; +import me.didit.types.RoutingPublicationPolicyDraftResponse; +import me.didit.types.RoutingPublicationPolicyDraftWriteRequest; +import me.didit.types.RoutingPublicationPolicyRevision; +import org.jspecify.annotations.Nullable; + +/** The {@code cases.routing_rules} resource: {@code client.cases().routingRules()}. */ +public final class CasesRoutingRulesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesRoutingRulesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/history/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page listHistory(String recordUuid, CasesRoutingRulesListHistoryParams params, RequestOptions options) { + return client.execute(listHistoryRequest(recordUuid, params), options, LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String recordUuid, CasesRoutingRulesListHistoryParams params, RequestOptions options) { + return client.executeAsync(listHistoryRequest(recordUuid, params), options, LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public Page listHistory(String recordUuid, CasesRoutingRulesListHistoryParams params) { + return client.execute(listHistoryRequest(recordUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String recordUuid, CasesRoutingRulesListHistoryParams params) { + return client.executeAsync(listHistoryRequest(recordUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}, without parameters. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return the result + */ + public Page listHistory(String recordUuid, RequestOptions options) { + return client.execute(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}, without parameters. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}, without parameters, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public Page listHistory(String recordUuid) { + return client.execute(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)}, without parameters, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listHistoryAsync(String recordUuid) { + return client.executeAsync(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Retrieve routing rule + * + *

Requires read:cases for the requested application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public CaseRoutingRule retrieve(String recordUuid, RequestOptions options) { + return client.execute(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public CaseRoutingRule retrieve(String recordUuid) { + return client.execute(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String recordUuid) { + return client.executeAsync(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update routing rule + * + *

Requires write:cases for the requested application. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseRoutingRule update(String recordUuid, CaseRoutingRuleUpdate params, RequestOptions options) { + return client.execute(updateRequest(recordUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String recordUuid, CaseRoutingRuleUpdate params, RequestOptions options) { + return client.executeAsync(updateRequest(recordUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public CaseRoutingRule update(String recordUuid, CaseRoutingRuleUpdate params) { + return client.execute(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String recordUuid, CaseRoutingRuleUpdate params) { + return client.executeAsync(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List routing rules + * + *

Requires list:cases for the requested application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(CasesRoutingRulesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesRoutingRulesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesRoutingRulesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(CasesRoutingRulesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesRoutingRulesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesRoutingRulesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(CasesRoutingRulesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesRoutingRulesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesRoutingRulesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(CasesRoutingRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(CasesRoutingRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create routing rule + * + *

Requires write:cases for the requested application. Set publish=false to create an unpublished draft; Publish creates its first live version. Discarding a never-published draft deletes it. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseRoutingRule create(CaseRoutingRuleCreate params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CaseRoutingRuleCreate, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(CaseRoutingRuleCreate params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(CaseRoutingRuleCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CaseRoutingRule create(CaseRoutingRuleCreate params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CaseRoutingRuleCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(CaseRoutingRuleCreate params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/publish/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RoutingPublicationCaseRoutingRule publish(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.execute(publishRequest(recordUuid, params), options, PUBLISH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture publishAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(publishRequest(recordUuid, params), options, PUBLISH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RoutingPublicationCaseRoutingRule publish(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.execute(publishRequest(recordUuid, params), RequestOptions.none(), PUBLISH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture publishAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(publishRequest(recordUuid, params), RequestOptions.none(), PUBLISH_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/draft/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public RoutingPublicationPolicyDraftResponse retrieveDraft(String recordUuid, RequestOptions options) { + return client.execute(retrieveDraftRequest(recordUuid), options, RETRIEVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDraftAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(retrieveDraftRequest(recordUuid), options, RETRIEVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDraft(String, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public RoutingPublicationPolicyDraftResponse retrieveDraft(String recordUuid) { + return client.execute(retrieveDraftRequest(recordUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveDraftAsync(String recordUuid) { + return client.executeAsync(retrieveDraftRequest(recordUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code PUT /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/draft/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RoutingPublicationPolicyDraft saveDraft(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.execute(saveDraftRequest(recordUuid, params), options, SAVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture saveDraftAsync(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.executeAsync(saveDraftRequest(recordUuid, params), options, SAVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RoutingPublicationPolicyDraft saveDraft(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params) { + return client.execute(saveDraftRequest(recordUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture saveDraftAsync(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params) { + return client.executeAsync(saveDraftRequest(recordUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE).thenApply(RawResponse::data); + } + + /** + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/draft/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + */ + public void discardDraft(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + client.execute(discardDraftRequest(recordUuid, params), options, DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture discardDraftAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(discardDraftRequest(recordUuid, params), options, DISCARD_DRAFT_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + */ + public void discardDraft(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + client.execute(discardDraftRequest(recordUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture discardDraftAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(discardDraftRequest(recordUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE).thenAccept(response -> {}); + } + + /** + * Test case routing + * + *

Requires read:cases for the requested application. Evaluates current rules or a supplied draft against current reviewer access, availability, skills and capacity. It does not save the draft or reserve reviewer capacity. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/preview/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseRoutingPreview preview(CaseRoutingPreviewRequest params, RequestOptions options) { + return client.execute(previewRequest(params), options, PREVIEW_RESPONSE).data(); + } + + /** + * Asynchronous {@link #preview(CaseRoutingPreviewRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture previewAsync(CaseRoutingPreviewRequest params, RequestOptions options) { + return client.executeAsync(previewRequest(params), options, PREVIEW_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #preview(CaseRoutingPreviewRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CaseRoutingPreview preview(CaseRoutingPreviewRequest params) { + return client.execute(previewRequest(params), RequestOptions.none(), PREVIEW_RESPONSE).data(); + } + + /** + * Asynchronous {@link #preview(CaseRoutingPreviewRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture previewAsync(CaseRoutingPreviewRequest params) { + return client.executeAsync(previewRequest(params), RequestOptions.none(), PREVIEW_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_HISTORY_RESPONSE = Responses.page(Conv.model(RoutingPublicationPolicyRevision::fromJson)); + + private static ApiRequest listHistoryRequest(String recordUuid, CasesRoutingRulesListHistoryParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/history/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .params(params) + .queryFields("ordering", "limit", "offset") + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(CaseRoutingRule::fromJson)); + + private static ApiRequest retrieveRequest(String recordUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(CaseRoutingRule::fromJson)); + + private static ApiRequest updateRequest(String recordUuid, CaseRoutingRuleUpdate params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(CaseRoutingRule::fromJson)); + + private static ApiRequest listRequest(CasesRoutingRulesListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/") + .applicationScoped() + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CaseRoutingRule::fromJson)); + + private static ApiRequest createRequest(CaseRoutingRuleCreate params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler PUBLISH_RESPONSE = Responses.json(Conv.model(RoutingPublicationCaseRoutingRule::fromJson)); + + private static ApiRequest publishRequest(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/publish/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_DRAFT_RESPONSE = Responses.json(Conv.model(RoutingPublicationPolicyDraftResponse::fromJson)); + + private static ApiRequest retrieveDraftRequest(String recordUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/draft/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .build(); + } + + private static final ResponseHandler SAVE_DRAFT_RESPONSE = Responses.json(Conv.model(RoutingPublicationPolicyDraft::fromJson)); + + private static ApiRequest saveDraftRequest(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params) { + return ApiRequest.builder("PUT", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/draft/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DISCARD_DRAFT_RESPONSE = Responses.none(); + + private static ApiRequest discardDraftRequest(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/{record_uuid}/draft/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler PREVIEW_RESPONSE = Responses.json(Conv.model(CaseRoutingPreview::fromJson)); + + private static ApiRequest previewRequest(CaseRoutingPreviewRequest params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/routing-rules/preview/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code cases.routing_rules} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> listHistory(String recordUuid, CasesRoutingRulesListHistoryParams params, RequestOptions options) { + return client.execute(listHistoryRequest(recordUuid, params), options, LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String recordUuid, CasesRoutingRulesListHistoryParams params, RequestOptions options) { + return client.executeAsync(listHistoryRequest(recordUuid, params), options, LIST_HISTORY_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> listHistory(String recordUuid, CasesRoutingRulesListHistoryParams params) { + return client.execute(listHistoryRequest(recordUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String recordUuid, CasesRoutingRulesListHistoryParams params) { + return client.executeAsync(listHistoryRequest(recordUuid, params), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response, without parameters. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> listHistory(String recordUuid, RequestOptions options) { + return client.execute(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response, without parameters. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), options, LIST_HISTORY_RESPONSE); + } + + /** + * {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public RawResponse> listHistory(String recordUuid) { + return client.execute(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * Asynchronous {@link #listHistory(String, CasesRoutingRulesListHistoryParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listHistoryAsync(String recordUuid) { + return client.executeAsync(listHistoryRequest(recordUuid, CasesRoutingRulesListHistoryParams.builder().build()), RequestOptions.none(), LIST_HISTORY_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String recordUuid, RequestOptions options) { + return client.execute(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public RawResponse retrieve(String recordUuid) { + return client.execute(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String recordUuid) { + return client.executeAsync(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String recordUuid, CaseRoutingRuleUpdate params, RequestOptions options) { + return client.execute(updateRequest(recordUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String recordUuid, CaseRoutingRuleUpdate params, RequestOptions options) { + return client.executeAsync(updateRequest(recordUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String recordUuid, CaseRoutingRuleUpdate params) { + return client.execute(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CaseRoutingRuleUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String recordUuid, CaseRoutingRuleUpdate params) { + return client.executeAsync(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(CasesRoutingRulesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesRoutingRulesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(CasesRoutingRulesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesRoutingRulesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(CasesRoutingRulesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesRoutingRulesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(CasesRoutingRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesRoutingRulesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(CasesRoutingRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(CaseRoutingRuleCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(CaseRoutingRuleCreate params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CaseRoutingRuleCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CaseRoutingRuleCreate params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(CaseRoutingRuleCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(CaseRoutingRuleCreate params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CaseRoutingRuleCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CaseRoutingRuleCreate params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse publish(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.execute(publishRequest(recordUuid, params), options, PUBLISH_RESPONSE); + } + + /** + * Asynchronous {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> publishAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(publishRequest(recordUuid, params), options, PUBLISH_RESPONSE); + } + + /** + * {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse publish(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.execute(publishRequest(recordUuid, params), RequestOptions.none(), PUBLISH_RESPONSE); + } + + /** + * Asynchronous {@link #publish(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> publishAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(publishRequest(recordUuid, params), RequestOptions.none(), PUBLISH_RESPONSE); + } + + /** + * {@link #retrieveDraft(String, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDraft(String recordUuid, RequestOptions options) { + return client.execute(retrieveDraftRequest(recordUuid), options, RETRIEVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDraftAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(retrieveDraftRequest(recordUuid), options, RETRIEVE_DRAFT_RESPONSE); + } + + /** + * {@link #retrieveDraft(String, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public RawResponse retrieveDraft(String recordUuid) { + return client.execute(retrieveDraftRequest(recordUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDraft(String, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveDraftAsync(String recordUuid) { + return client.executeAsync(retrieveDraftRequest(recordUuid), RequestOptions.none(), RETRIEVE_DRAFT_RESPONSE); + } + + /** + * {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse saveDraft(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.execute(saveDraftRequest(recordUuid, params), options, SAVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> saveDraftAsync(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params, RequestOptions options) { + return client.executeAsync(saveDraftRequest(recordUuid, params), options, SAVE_DRAFT_RESPONSE); + } + + /** + * {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse saveDraft(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params) { + return client.execute(saveDraftRequest(recordUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #saveDraft(String, RoutingPublicationPolicyDraftWriteRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> saveDraftAsync(String recordUuid, RoutingPublicationPolicyDraftWriteRequest params) { + return client.executeAsync(saveDraftRequest(recordUuid, params), RequestOptions.none(), SAVE_DRAFT_RESPONSE); + } + + /** + * {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> discardDraft(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.execute(discardDraftRequest(recordUuid, params), options, DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> discardDraftAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params, RequestOptions options) { + return client.executeAsync(discardDraftRequest(recordUuid, params), options, DISCARD_DRAFT_RESPONSE); + } + + /** + * {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse<@Nullable Void> discardDraft(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.execute(discardDraftRequest(recordUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE); + } + + /** + * Asynchronous {@link #discardDraft(String, RoutingPublicationPolicyDraftPreconditionRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> discardDraftAsync(String recordUuid, RoutingPublicationPolicyDraftPreconditionRequest params) { + return client.executeAsync(discardDraftRequest(recordUuid, params), RequestOptions.none(), DISCARD_DRAFT_RESPONSE); + } + + /** + * {@link #preview(CaseRoutingPreviewRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse preview(CaseRoutingPreviewRequest params, RequestOptions options) { + return client.execute(previewRequest(params), options, PREVIEW_RESPONSE); + } + + /** + * Asynchronous {@link #preview(CaseRoutingPreviewRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> previewAsync(CaseRoutingPreviewRequest params, RequestOptions options) { + return client.executeAsync(previewRequest(params), options, PREVIEW_RESPONSE); + } + + /** + * {@link #preview(CaseRoutingPreviewRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse preview(CaseRoutingPreviewRequest params) { + return client.execute(previewRequest(params), RequestOptions.none(), PREVIEW_RESPONSE); + } + + /** + * Asynchronous {@link #preview(CaseRoutingPreviewRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> previewAsync(CaseRoutingPreviewRequest params) { + return client.executeAsync(previewRequest(params), RequestOptions.none(), PREVIEW_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CasesTeamsResource.java b/src/main/java/me/didit/resources/CasesTeamsResource.java new file mode 100644 index 0000000..be87169 --- /dev/null +++ b/src/main/java/me/didit/resources/CasesTeamsResource.java @@ -0,0 +1,526 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.CaseReviewTeam; +import me.didit.types.CaseReviewTeamCreate; +import me.didit.types.CaseReviewTeamUpdate; +import me.didit.types.CasesTeamsListParams; + +/** The {@code cases.teams} resource: {@code client.cases().teams()}. */ +public final class CasesTeamsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CasesTeamsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List review teams + * + *

Requires list:cases for the requested application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/teams/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(CasesTeamsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesTeamsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesTeamsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(CasesTeamsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(CasesTeamsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesTeamsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(CasesTeamsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesTeamsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(CasesTeamsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(CasesTeamsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(CasesTeamsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create review team + * + *

Requires write:cases for the requested application. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/cases/teams/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseReviewTeam create(CaseReviewTeamCreate params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CaseReviewTeamCreate, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(CaseReviewTeamCreate params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(CaseReviewTeamCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public CaseReviewTeam create(CaseReviewTeamCreate params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(CaseReviewTeamCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(CaseReviewTeamCreate params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Retrieve review team + * + *

Requires read:cases for the requested application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/cases/teams/{record_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options that override the client options + * @return the response body + */ + public CaseReviewTeam retrieve(String recordUuid, RequestOptions options) { + return client.execute(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public CaseReviewTeam retrieve(String recordUuid) { + return client.execute(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String recordUuid) { + return client.executeAsync(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update review team + * + *

Requires write:cases for the requested application. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/cases/teams/{record_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public CaseReviewTeam update(String recordUuid, CaseReviewTeamUpdate params, RequestOptions options) { + return client.execute(updateRequest(recordUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CaseReviewTeamUpdate, RequestOptions)}. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String recordUuid, CaseReviewTeamUpdate params, RequestOptions options) { + return client.executeAsync(updateRequest(recordUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, CaseReviewTeamUpdate, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public CaseReviewTeam update(String recordUuid, CaseReviewTeamUpdate params) { + return client.execute(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, CaseReviewTeamUpdate, RequestOptions)}, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String recordUuid, CaseReviewTeamUpdate params) { + return client.executeAsync(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(CaseReviewTeam::fromJson)); + + private static ApiRequest listRequest(CasesTeamsListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/teams/") + .applicationScoped() + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(CaseReviewTeam::fromJson)); + + private static ApiRequest createRequest(CaseReviewTeamCreate params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/cases/teams/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(CaseReviewTeam::fromJson)); + + private static ApiRequest retrieveRequest(String recordUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/cases/teams/{record_uuid}/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(CaseReviewTeam::fromJson)); + + private static ApiRequest updateRequest(String recordUuid, CaseReviewTeamUpdate params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/cases/teams/{record_uuid}/") + .applicationScoped() + .pathParam("record_uuid", recordUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code cases.teams} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(CasesTeamsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesTeamsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(CasesTeamsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(CasesTeamsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(CasesTeamsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(CasesTeamsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(CasesTeamsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(CasesTeamsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(CasesTeamsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(CaseReviewTeamCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(CaseReviewTeamCreate params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CaseReviewTeamCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CaseReviewTeamCreate params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(CaseReviewTeamCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(CaseReviewTeamCreate params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(CaseReviewTeamCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(CaseReviewTeamCreate params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String recordUuid, RequestOptions options) { + return client.execute(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String recordUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(recordUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return the result + */ + public RawResponse retrieve(String recordUuid) { + return client.execute(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String recordUuid) { + return client.executeAsync(retrieveRequest(recordUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, CaseReviewTeamUpdate, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String recordUuid, CaseReviewTeamUpdate params, RequestOptions options) { + return client.execute(updateRequest(recordUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CaseReviewTeamUpdate, RequestOptions)} with the raw response. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String recordUuid, CaseReviewTeamUpdate params, RequestOptions options) { + return client.executeAsync(updateRequest(recordUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, CaseReviewTeamUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String recordUuid, CaseReviewTeamUpdate params) { + return client.execute(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, CaseReviewTeamUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param recordUuid the {@code record_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String recordUuid, CaseReviewTeamUpdate params) { + return client.executeAsync(updateRequest(recordUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/CustomizationResource.java b/src/main/java/me/didit/resources/CustomizationResource.java new file mode 100644 index 0000000..ab91d12 --- /dev/null +++ b/src/main/java/me/didit/resources/CustomizationResource.java @@ -0,0 +1,302 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.BrandingCustomization; +import me.didit.types.CustomizationUpdateParams; + +/** The {@code customization} resource: {@code client.customization()}. */ +public final class CustomizationResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + CustomizationResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Get branding customization + * + *

Returns the white-label branding for the application resolved from the API key: colors, fonts, border radii, logo URLs and UI/UX options. Custom domain and white-label email settings are managed only in the Business Console and are not part of this response. + * + *

{@code GET /v3/customization/} + * + * @param options per-request options that override the client options + * @return the response body + */ + public BrandingCustomization retrieve(RequestOptions options) { + return client.execute(retrieveRequest(), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(RequestOptions options) { + return client.executeAsync(retrieveRequest(), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(RequestOptions)}, with the client's options. + * + * @return the result + */ + public BrandingCustomization retrieve() { + return client.execute(retrieveRequest(), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync() { + return client.executeAsync(retrieveRequest(), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update branding customization + * + *

Partial update of the application's white-label branding. Send application/json to change colors, fonts, radii and UI options, or multipart/form-data to upload logo images. Only the fields you include are changed. Custom domain and white-label email cannot be set through this endpoint โ€” use the Business Console for those. + * + *

{@code PATCH /v3/customization/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BrandingCustomization update(CustomizationUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(CustomizationUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(CustomizationUpdateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BrandingCustomization update(CustomizationUpdateParams params) { + return client.execute(updateRequest(params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(CustomizationUpdateParams params) { + return client.executeAsync(updateRequest(params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(CustomizationUpdateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public BrandingCustomization update(RequestOptions options) { + return client.execute(updateRequest(CustomizationUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(RequestOptions options) { + return client.executeAsync(updateRequest(CustomizationUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(CustomizationUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public BrandingCustomization update() { + return client.execute(updateRequest(CustomizationUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture updateAsync() { + return client.executeAsync(updateRequest(CustomizationUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(BrandingCustomization::fromJson)); + + private static ApiRequest retrieveRequest() { + return ApiRequest.builder("GET", "/v3/customization/") + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(BrandingCustomization::fromJson)); + + private static ApiRequest updateRequest(CustomizationUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/customization/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART) + .build(); + } + + /** The {@code customization} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #retrieve(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(RequestOptions options) { + return client.execute(retrieveRequest(), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(RequestOptions options) { + return client.executeAsync(retrieveRequest(), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse retrieve() { + return client.execute(retrieveRequest(), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync() { + return client.executeAsync(retrieveRequest(), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(CustomizationUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(CustomizationUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse update(CustomizationUpdateParams params) { + return client.execute(updateRequest(params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(CustomizationUpdateParams params) { + return client.executeAsync(updateRequest(params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse update(RequestOptions options) { + return client.execute(updateRequest(CustomizationUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(RequestOptions options) { + return client.executeAsync(updateRequest(CustomizationUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse update() { + return client.execute(updateRequest(CustomizationUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(CustomizationUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> updateAsync() { + return client.executeAsync(updateRequest(CustomizationUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/DatabaseValidationResource.java b/src/main/java/me/didit/resources/DatabaseValidationResource.java new file mode 100644 index 0000000..7158b7b --- /dev/null +++ b/src/main/java/me/didit/resources/DatabaseValidationResource.java @@ -0,0 +1,155 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.DatabaseValidationValidateParams; +import me.didit.types.DatabaseValidationValidateResponse; + +/** The {@code database_validation} resource: {@code client.databaseValidation()}. */ +public final class DatabaseValidationResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + DatabaseValidationResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Database Validation (standalone) + * + *

Validate a person's identity data against official government and registry sources โ€” CPF in Brazil, RENAPER in Argentina, DNI registries in Spain and Peru, INE in Mexico, and 100+ more services across 60+ countries. + * + *

Service selection. Each country exposes one or more catalog services identified by a service_id (e.g. bra_cpf, arg_renaper, pan_cedula_sib). Pin the services you want with the services array โ€” if you omit it, exactly one default service runs (the longest-established live service for the country). Sending services also switches the response to the extended shape with services_used and match_score. Discover services, their required fields, and prices via GET /v1/organization/database-validation-countries/ (a catalog endpoint not documented in this spec) or the Business Console workflow editor. Some services are flagged requires_consent=true in the catalog and demand consent=true; others require onboarding for your organization before they can be called. + * + *

Input fields. identification_number is a universal field that maps to the right country-specific field automatically (see its description). Country format rules are enforced before any provider is called (e.g. BRA CPF must be exactly 11 digits) and format failures are never billed. Biometric services need a selfie upload (multipart only); Argentina RENAPER additionally requires gender. + * + *

Results. Each service returns a field-by-field validation map plus a vendor-neutral outcome_code (MATCH, PARTIAL_MATCH, NO_MATCH, DOCUMENT_NOT_FOUND, INVALID_DOCUMENT_FORMAT, INVALID_INPUT, MINOR_BLOCKED, DECEASED, BIOMETRIC_NO_MATCH, BIOMETRIC_IMAGE_UNUSABLE, INCONCLUSIVE, DOCUMENT_SUPERSEDED, REGISTRY_UNAVAILABLE, REGISTRY_ERROR). Note the distinctions: NO_MATCH is a definitive mismatch, INCONCLUSIVE means the registry could not confirm either way (review, not decline), and BIOMETRIC_IMAGE_UNUSABLE is a technical selfie problem (retake), unlike the definitive BIOMETRIC_NO_MATCH. The overall match_type aggregates across services (any full โ†’ full_match, else any partial โ†’ partial_match, else no_match) and no_match_action/partial_match_action translate it into the final status. validation_type is derived: two_by_two when two or more distinct services produced a full match (on the identification number, on full name + date of birth together, or on the address without contradictions), else one_by_one. + * + *

Persistence. save_api_request defaults to true: the result is stored as a session (request_id works with GET /v3/session/{sessionId}/decision/), appears in the console, and fires a status.updated webhook. It also controls the validations shape โ€” per-service objects when saved, a merged {field: match} map when not. + * + *

Billing. Per-service: each service that returns a billable result is charged its own catalog price. Failed or skipped services are not billed, and requests rejected with 400 cost nothing. The pre-flight balance check covers the sum of the selected services' prices (403 when short). + * + *

Failures. When no selected service returns a usable result, the API returns 400 with validation_errors if every unanswered attempt explicitly refused the input (provider_rejected_input, retryable: false). Correct the input before trying again. Otherwise it returns 502 with validation_errors (empty_provider_response, retryable: true), including mixed input rejection and unavailable fallback attempts; nothing is billed (a session is still recorded with status Not Finished when save_api_request=true). When only some services fail, the 200 response carries their failures in database_validation.errors. + * + *

Sandbox. Keys from sandbox applications skip the registry calls and billing and return a static full_match response โ€” the sandbox payload always includes services_used and match_score: 100 regardless of how services was sent, so don't validate the live extended-shape gating or the 0.0โ€“1.0 match_score fraction against sandbox responses. + * + *

Send the request as application/json, or as multipart/form-data when uploading a selfie. + * + *

{@code POST /v3/database-validation/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DatabaseValidationValidateResponse validate(DatabaseValidationValidateParams params, RequestOptions options) { + return client.execute(validateRequest(params), options, VALIDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #validate(DatabaseValidationValidateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture validateAsync(DatabaseValidationValidateParams params, RequestOptions options) { + return client.executeAsync(validateRequest(params), options, VALIDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #validate(DatabaseValidationValidateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DatabaseValidationValidateResponse validate(DatabaseValidationValidateParams params) { + return client.execute(validateRequest(params), RequestOptions.none(), VALIDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #validate(DatabaseValidationValidateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture validateAsync(DatabaseValidationValidateParams params) { + return client.executeAsync(validateRequest(params), RequestOptions.none(), VALIDATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler VALIDATE_RESPONSE = Responses.json(Conv.model(DatabaseValidationValidateResponse::fromJson)); + + private static ApiRequest validateRequest(DatabaseValidationValidateParams params) { + return ApiRequest.builder("POST", "/v3/database-validation/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART) + .build(); + } + + /** The {@code database_validation} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #validate(DatabaseValidationValidateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse validate(DatabaseValidationValidateParams params, RequestOptions options) { + return client.execute(validateRequest(params), options, VALIDATE_RESPONSE); + } + + /** + * Asynchronous {@link #validate(DatabaseValidationValidateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> validateAsync(DatabaseValidationValidateParams params, RequestOptions options) { + return client.executeAsync(validateRequest(params), options, VALIDATE_RESPONSE); + } + + /** + * {@link #validate(DatabaseValidationValidateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse validate(DatabaseValidationValidateParams params) { + return client.execute(validateRequest(params), RequestOptions.none(), VALIDATE_RESPONSE); + } + + /** + * Asynchronous {@link #validate(DatabaseValidationValidateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> validateAsync(DatabaseValidationValidateParams params) { + return client.executeAsync(validateRequest(params), RequestOptions.none(), VALIDATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/DiditResources.java b/src/main/java/me/didit/resources/DiditResources.java new file mode 100644 index 0000000..f317ae7 --- /dev/null +++ b/src/main/java/me/didit/resources/DiditResources.java @@ -0,0 +1,393 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import me.didit.core.ApiClient; + +/** + * The top-level resources of the Didit API. The hand-written {@code me.didit.Didit} client + * extends this class; use the client, not this class. + */ +public abstract class DiditResources { + private final AccountResource account; + private final AgeEstimationResource ageEstimation; + private final AmlResource aml; + private final AmlMonitoringResource amlMonitoring; + private final BillingResource billing; + private final BiometricTemplatesResource biometricTemplates; + private final BusinessSessionsResource businessSessions; + private final BusinessesResource businesses; + private final CasesResource cases; + private final CustomizationResource customization; + private final DatabaseValidationResource databaseValidation; + private final DocumentAiResource documentAi; + private final EmailResource email; + private final FaceMatchResource faceMatch; + private final FaceSearchResource faceSearch; + private final FraudChecksResource fraudChecks; + private final IdVerificationResource idVerification; + private final IdWalletsResource idWallets; + private final IpResource ip; + private final KybResource kyb; + private final NetworksResource networks; + private final PassiveLivenessResource passiveLiveness; + private final PhoneResource phone; + private final ProofOfAddressResource proofOfAddress; + private final QuestionnairesResource questionnaires; + private final RegulatoryReportsResource regulatoryReports; + private final ReportTemplatesResource reportTemplates; + private final SessionsResource sessions; + private final TransactionsResource transactions; + private final TravelRuleResource travelRule; + private final UsersResource users; + private final WalletScreeningResource walletScreening; + private final WebhooksResource webhooks; + private final WorkflowsResource workflows; + + /** + * Creates the resource tree. + * + * @param client the HTTP client shared by every resource + */ + protected DiditResources(ApiClient client) { + this.account = new AccountResource(client); + this.ageEstimation = new AgeEstimationResource(client); + this.aml = new AmlResource(client); + this.amlMonitoring = new AmlMonitoringResource(client); + this.billing = new BillingResource(client); + this.biometricTemplates = new BiometricTemplatesResource(client); + this.businessSessions = new BusinessSessionsResource(client); + this.businesses = new BusinessesResource(client); + this.cases = new CasesResource(client); + this.customization = new CustomizationResource(client); + this.databaseValidation = new DatabaseValidationResource(client); + this.documentAi = new DocumentAiResource(client); + this.email = new EmailResource(client); + this.faceMatch = new FaceMatchResource(client); + this.faceSearch = new FaceSearchResource(client); + this.fraudChecks = new FraudChecksResource(client); + this.idVerification = new IdVerificationResource(client); + this.idWallets = new IdWalletsResource(client); + this.ip = new IpResource(client); + this.kyb = new KybResource(client); + this.networks = new NetworksResource(client); + this.passiveLiveness = new PassiveLivenessResource(client); + this.phone = new PhoneResource(client); + this.proofOfAddress = new ProofOfAddressResource(client); + this.questionnaires = new QuestionnairesResource(client); + this.regulatoryReports = new RegulatoryReportsResource(client); + this.reportTemplates = new ReportTemplatesResource(client); + this.sessions = new SessionsResource(client); + this.transactions = new TransactionsResource(client); + this.travelRule = new TravelRuleResource(client); + this.users = new UsersResource(client); + this.walletScreening = new WalletScreeningResource(client); + this.webhooks = new WebhooksResource(client); + this.workflows = new WorkflowsResource(client); + } + + /** + * The {@code account} resource. + * + * @return the resource + */ + public final AccountResource account() { + return account; + } + + /** + * The {@code age_estimation} resource. + * + * @return the resource + */ + public final AgeEstimationResource ageEstimation() { + return ageEstimation; + } + + /** + * The {@code aml} resource. + * + * @return the resource + */ + public final AmlResource aml() { + return aml; + } + + /** + * The {@code aml_monitoring} resource. + * + * @return the resource + */ + public final AmlMonitoringResource amlMonitoring() { + return amlMonitoring; + } + + /** + * The {@code billing} resource. + * + * @return the resource + */ + public final BillingResource billing() { + return billing; + } + + /** + * The {@code biometric_templates} resource. + * + * @return the resource + */ + public final BiometricTemplatesResource biometricTemplates() { + return biometricTemplates; + } + + /** + * The {@code business_sessions} resource. + * + * @return the resource + */ + public final BusinessSessionsResource businessSessions() { + return businessSessions; + } + + /** + * The {@code businesses} resource. + * + * @return the resource + */ + public final BusinessesResource businesses() { + return businesses; + } + + /** + * The {@code cases} resource. + * + * @return the resource + */ + public final CasesResource cases() { + return cases; + } + + /** + * The {@code customization} resource. + * + * @return the resource + */ + public final CustomizationResource customization() { + return customization; + } + + /** + * The {@code database_validation} resource. + * + * @return the resource + */ + public final DatabaseValidationResource databaseValidation() { + return databaseValidation; + } + + /** + * The {@code document_ai} resource. + * + * @return the resource + */ + public final DocumentAiResource documentAi() { + return documentAi; + } + + /** + * The {@code email} resource. + * + * @return the resource + */ + public final EmailResource email() { + return email; + } + + /** + * The {@code face_match} resource. + * + * @return the resource + */ + public final FaceMatchResource faceMatch() { + return faceMatch; + } + + /** + * The {@code face_search} resource. + * + * @return the resource + */ + public final FaceSearchResource faceSearch() { + return faceSearch; + } + + /** + * The {@code fraud_checks} resource. + * + * @return the resource + */ + public final FraudChecksResource fraudChecks() { + return fraudChecks; + } + + /** + * The {@code id_verification} resource. + * + * @return the resource + */ + public final IdVerificationResource idVerification() { + return idVerification; + } + + /** + * The {@code id_wallets} resource. + * + * @return the resource + */ + public final IdWalletsResource idWallets() { + return idWallets; + } + + /** + * The {@code ip} resource. + * + * @return the resource + */ + public final IpResource ip() { + return ip; + } + + /** + * The {@code kyb} resource. + * + * @return the resource + */ + public final KybResource kyb() { + return kyb; + } + + /** + * The {@code networks} resource. + * + * @return the resource + */ + public final NetworksResource networks() { + return networks; + } + + /** + * The {@code passive_liveness} resource. + * + * @return the resource + */ + public final PassiveLivenessResource passiveLiveness() { + return passiveLiveness; + } + + /** + * The {@code phone} resource. + * + * @return the resource + */ + public final PhoneResource phone() { + return phone; + } + + /** + * The {@code proof_of_address} resource. + * + * @return the resource + */ + public final ProofOfAddressResource proofOfAddress() { + return proofOfAddress; + } + + /** + * The {@code questionnaires} resource. + * + * @return the resource + */ + public final QuestionnairesResource questionnaires() { + return questionnaires; + } + + /** + * The {@code regulatory_reports} resource. + * + * @return the resource + */ + public final RegulatoryReportsResource regulatoryReports() { + return regulatoryReports; + } + + /** + * The {@code report_templates} resource. + * + * @return the resource + */ + public final ReportTemplatesResource reportTemplates() { + return reportTemplates; + } + + /** + * The {@code sessions} resource. + * + * @return the resource + */ + public final SessionsResource sessions() { + return sessions; + } + + /** + * The {@code transactions} resource. + * + * @return the resource + */ + public final TransactionsResource transactions() { + return transactions; + } + + /** + * The {@code travel_rule} resource. + * + * @return the resource + */ + public final TravelRuleResource travelRule() { + return travelRule; + } + + /** + * The {@code users} resource. + * + * @return the resource + */ + public final UsersResource users() { + return users; + } + + /** + * The {@code wallet_screening} resource. + * + * @return the resource + */ + public final WalletScreeningResource walletScreening() { + return walletScreening; + } + + /** + * The {@code webhooks} resource. + * + * @return the resource + */ + public final WebhooksResource webhooks() { + return webhooks; + } + + /** + * The {@code workflows} resource. + * + * @return the resource + */ + public final WorkflowsResource workflows() { + return workflows; + } +} diff --git a/src/main/java/me/didit/resources/DocumentAiResource.java b/src/main/java/me/didit/resources/DocumentAiResource.java new file mode 100644 index 0000000..ae2c4bf --- /dev/null +++ b/src/main/java/me/didit/resources/DocumentAiResource.java @@ -0,0 +1,151 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.DocumentAiAnalyzeParams; +import me.didit.types.DocumentAiAnalyzeResponse; + +/** The {@code document_ai} resource: {@code client.documentAi()}. */ +public final class DocumentAiResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + DocumentAiResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Document AI (custom field extraction + tamper checks) + * + *

Extract the fields you define from any supporting document โ€” payslips, proof of funds, source-of-wealth letters, tax statements, contracts, invoices โ€” in one call. Send the file plus a fields definition (key, name, extraction instruction, type) and get back typed values (text, number, date as YYYY-MM-DD), an optional name-match score against the expected person or company, PDF/EXIF tamper signals, an Approved/Declined/In Review status, and a warnings list explaining every issue found. This is the server-to-server counterpart of the hosted Document AI workflow step (see /core-technology/document-ai/overview); it uses Didit's default extraction model and does not expose provider selection. + * + *

Latency. Extraction is LLM-based: typical calls take 5โ€“15 seconds, multi-page PDFs up to ~30 seconds. Configure a client timeout of at least 45 seconds and do not retry before the call completes. + * + *

Request format. multipart/form-data only. fields is one JSON-encoded array string (1โ€“30 items, at most 16 KB); bracket-style form arrays are rejected with 400. Each item is {key, name, instruction, type, required, is_full_name} โ€” key is the JSON key you get back (^[a-z0-9_]{1,64}$, unique), instruction tells the model what to read, type is text (default) | number | date, required raises DOCUMENT_AI_MISSING_REQUIRED_FIELDS when the value cannot be read, and at most one field may set is_full_name: true to mark the value compared against the expected name. + * + *

Name matching. Pass expected_first_name + expected_last_name (person) or expected_company_name (+ optional expected_company_country) โ€” not both. The value of the is_full_name field (or, when none is marked, the first text field whose key looks like a name) is compared fuzzily; name_match_score (0โ€“100) and name_on_document are always returned when both sides exist, and a score below document_ai_name_match_score_threshold (default 80) adds DOCUMENT_AI_NAME_MISMATCH, governed by document_ai_name_mismatch_action. + * + *

Decision logic. Each risk maps to a configurable action: DECLINE โ†’ status: "Declined", REVIEW โ†’ status: "In Review", NO_ACTION โ†’ informational only. Defaults mirror the workflow step: unreadable document REVIEW, missing required fields REVIEW, suspected manipulation DECLINE, name mismatch NO_ACTION, unsupported file REVIEW. A document that cannot be processed at all returns 400; a readable but problematic document returns 200 with Declined/In Review โ€” always inspect document_ai.status and document_ai.warnings, not just the HTTP code. + * + *

Billing. Each 200 response consumes one Document AI API credit โ€” $0.20 per document, no free tier (standalone APIs never have one). When the organization's balance cannot cover the call, the endpoint returns 403 before any processing. Sandbox API keys return a deterministic mock response and are not charged. + * + *

Persistence. With save_api_request=true (default) the call is stored as an API-type session: the document, the extracted values, the field definitions and the name-match snapshot are kept, the session shows up in the Business Console, and request_id works with GET /v3/session/{sessionId}/decision/. + * + *

{@code POST /v3/document-ai/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DocumentAiAnalyzeResponse analyze(DocumentAiAnalyzeParams params, RequestOptions options) { + return client.execute(analyzeRequest(params), options, ANALYZE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture analyzeAsync(DocumentAiAnalyzeParams params, RequestOptions options) { + return client.executeAsync(analyzeRequest(params), options, ANALYZE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DocumentAiAnalyzeResponse analyze(DocumentAiAnalyzeParams params) { + return client.execute(analyzeRequest(params), RequestOptions.none(), ANALYZE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture analyzeAsync(DocumentAiAnalyzeParams params) { + return client.executeAsync(analyzeRequest(params), RequestOptions.none(), ANALYZE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler ANALYZE_RESPONSE = Responses.json(Conv.model(DocumentAiAnalyzeResponse::fromJson)); + + private static ApiRequest analyzeRequest(DocumentAiAnalyzeParams params) { + return ApiRequest.builder("POST", "/v3/document-ai/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code document_ai} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse analyze(DocumentAiAnalyzeParams params, RequestOptions options) { + return client.execute(analyzeRequest(params), options, ANALYZE_RESPONSE); + } + + /** + * Asynchronous {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> analyzeAsync(DocumentAiAnalyzeParams params, RequestOptions options) { + return client.executeAsync(analyzeRequest(params), options, ANALYZE_RESPONSE); + } + + /** + * {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse analyze(DocumentAiAnalyzeParams params) { + return client.execute(analyzeRequest(params), RequestOptions.none(), ANALYZE_RESPONSE); + } + + /** + * Asynchronous {@link #analyze(DocumentAiAnalyzeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> analyzeAsync(DocumentAiAnalyzeParams params) { + return client.executeAsync(analyzeRequest(params), RequestOptions.none(), ANALYZE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/EmailResource.java b/src/main/java/me/didit/resources/EmailResource.java new file mode 100644 index 0000000..81c4d25 --- /dev/null +++ b/src/main/java/me/didit/resources/EmailResource.java @@ -0,0 +1,387 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.EmailCheckCodeParams; +import me.didit.types.EmailRiskRequest; +import me.didit.types.EmailRiskResponse; +import me.didit.types.EmailSendCodeParams; +import me.didit.types.EmailVerificationCheckResponse; +import me.didit.types.EmailVerificationSendResponse; + +/** The {@code email} resource: {@code client.email()}. */ +public final class EmailResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + EmailResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Risk-score an email address + * + *

Return deliverability, disposable-address, breach, cross-session match, and normalized risk-intelligence signals without sending an OTP. The endpoint creates an API session and returns its id as request_id. + * + *

Decision. The top-level status mirrors email.status. It is normally Approved; the risk evaluation can produce In Review or Declined. + * + *

Compatibility aliases. Live responses expose the normalized intelligence object as both email.email_intelligence and email.enrichment. The values are identical. New integrations can read email.enrichment. Both keys are absent when no usable intelligence data was returned. + * + *

Billing. Live calls use Email Risk API pricing. The request is billable once the lookup starts, even when some best-effort fields are unavailable. + * + *

Sandbox. Sandbox keys validate the request and return deterministic approved data without sending an email, consuming credits, creating a session, or contributing to Networks. + * + *

Authentication. Send your application's API key in x-api-key. Missing or invalid credentials return 403 - this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests per minute per API key across all POST/PATCH/DELETE endpoints. + * + *

Social footprint. Set enable_social to true to add a email_social block: the online platforms this address is registered on, with per-category counts and any profile details available. profiles_registered: 0 means the platforms were checked and the address was found on none of them - a valid, billable answer. The block is absent when the add-on was not requested or the check could not be completed, and it is not billed in that case. Billing adds one email_social unit per request on top of this endpoint's own price. + * + *

{@code POST /v3/email/risk/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public EmailRiskResponse assessRisk(EmailRiskRequest params, RequestOptions options) { + return client.execute(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assessRisk(EmailRiskRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture assessRiskAsync(EmailRiskRequest params, RequestOptions options) { + return client.executeAsync(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #assessRisk(EmailRiskRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public EmailRiskResponse assessRisk(EmailRiskRequest params) { + return client.execute(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assessRisk(EmailRiskRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture assessRiskAsync(EmailRiskRequest params) { + return client.executeAsync(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Send Email Code + * + *

Send a one-time passcode (OTP) to an email address, then verify it with [POST /v3/email/check/](/standalone-apis/email-check). + * + *

How send and check pair up. Verification state is keyed by your application plus the email address โ€” the check call does not take request_id. Each new send creates a pending verification that lives for 5 minutes: call the check with the same address and the code the user received before the window closes. Calling send again for the same address while a verification is pending generates a fresh code for that same verification (status: "Retry", same request_id); the previous code stops working. At most one retry is attached this way (two sends total); a further send starts a fresh verification with a new request_id. The 5-minute window is measured from the first send and is not extended by retries. + * + *

Deliverability pre-check. Before anything is sent, the address goes through syntax and DNS/MX validation. Addresses that cannot receive mail return 200 with status: "Undeliverable" and reason: "email_can_not_be_delivered" โ€” no email is sent, nothing is billed, and the verification is immediately finalized as Declined (a follow-up check returns Expired or Not Found). A downstream send failure reports the same way. + * + *

Code format and branding. Codes are 4โ€“8 characters (options.code_size, default 6), numeric by default; set options.alphanumeric_code: true for uppercase letters and digits (the check comparison is case-insensitive). The email template is localized via options.locale (54 supported languages) and can use your application's white-label branding via options.use_white_label_customization. + * + *

Billing. One Email Verification API credit per successful send (status: "Success"), charged at send time. Retry and Undeliverable sends are free, and checks are free. + * + *

Session persistence. Every new verification is persisted as an API-type session: request_id is a real session id you can pass to GET /v3/session/{sessionId}/decision/, the verification appears in the Business Console, and status.updated webhooks fire as it progresses. + * + *

Sandbox. Sandbox API keys skip delivery and billing: after request validation (malformed input still returns 400), the endpoint returns a static Success payload with a random request_id; no email is sent and nothing is persisted. Use code 123456 on the sandbox check. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

{@code POST /v3/email/send/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public EmailVerificationSendResponse sendCode(EmailSendCodeParams params, RequestOptions options) { + return client.execute(sendCodeRequest(params), options, SEND_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #sendCode(EmailSendCodeParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture sendCodeAsync(EmailSendCodeParams params, RequestOptions options) { + return client.executeAsync(sendCodeRequest(params), options, SEND_CODE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #sendCode(EmailSendCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public EmailVerificationSendResponse sendCode(EmailSendCodeParams params) { + return client.execute(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #sendCode(EmailSendCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture sendCodeAsync(EmailSendCodeParams params) { + return client.executeAsync(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Check Email Code + * + *

Verify the OTP delivered by [POST /v3/email/send/](/standalone-apis/email-send) and get the final verification result plus email intelligence: deliverability, breach exposure (is_breached and the breaches list from a breach-intelligence database), disposable-provider detection, and duplicate usage of the address across your sessions. + * + *

How the check finds the verification. Matching is by your application plus the email address โ€” request_id is not an input. The most recent pending verification created within the last 5 minutes is checked. If there is none (never sent, already finalized, undeliverable at send time, or older than 5 minutes) the endpoint returns 200 with status: "Expired or Not Found". + * + *

Attempt budget. Each verification allows 3 code attempts. The first two wrong codes return status: "Failed" with the attempts remaining and email: null; the third wrong code finalizes the verification as Declined with an EMAIL_CODE_ATTEMPTS_EXCEEDED warning and returns the full email report. Codes are compared case-insensitively (relevant for alphanumeric_code sends); only the most recently sent code is valid. + * + *

Outcomes. Approved โ€” correct code and no declining risk. Declined โ€” terminal: the code was correct but a declining risk matched (a DECLINE action below, a blocklisted address, or the address found undeliverable at finalization), or the attempt budget was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” nothing to check. On Approved/Declined the request_id equals the send's request_id (the session id) and email carries the full report (is_breached, breaches, is_disposable, is_undeliverable, warnings, lifecycle, matches); on Failed and Expired or Not Found the request_id is a one-off random UUID. + * + *

Risk actions. duplicated_email_action, breached_email_action, and disposable_email_action decide what happens when the corresponding risk is detected on a correct code: DECLINE flips the final status to Declined; NO_ACTION (default) records the risk in email.warnings without affecting the status. + * + *

Billing. Checks are free โ€” the credit is consumed by the successful send. + * + *

Session persistence. A finalized check updates the session created by the send (visible in the Business Console, queryable via GET /v3/session/{sessionId}/decision/) and fires a status.updated webhook. + * + *

Sandbox. Sandbox API keys skip all processing: any well-formed code (123456 included) returns a static Approved payload with a simplified email object (status, email, is_breached, is_disposable, is_undeliverable); malformed input still returns 400. Nothing is persisted. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

Social footprint. Set enable_social to true to add a email_social block: the online platforms this address is registered on, with per-category counts and any profile details available. profiles_registered: 0 means the platforms were checked and the address was found on none of them - a valid, billable answer. The block is absent when the add-on was not requested or the check could not be completed, and it is not billed in that case. Billing adds one email_social unit per request on top of this endpoint's own price. + * + *

{@code POST /v3/email/check/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public EmailVerificationCheckResponse checkCode(EmailCheckCodeParams params, RequestOptions options) { + return client.execute(checkCodeRequest(params), options, CHECK_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #checkCode(EmailCheckCodeParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture checkCodeAsync(EmailCheckCodeParams params, RequestOptions options) { + return client.executeAsync(checkCodeRequest(params), options, CHECK_CODE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #checkCode(EmailCheckCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public EmailVerificationCheckResponse checkCode(EmailCheckCodeParams params) { + return client.execute(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #checkCode(EmailCheckCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture checkCodeAsync(EmailCheckCodeParams params) { + return client.executeAsync(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler ASSESS_RISK_RESPONSE = Responses.json(Conv.model(EmailRiskResponse::fromJson)); + + private static ApiRequest assessRiskRequest(EmailRiskRequest params) { + return ApiRequest.builder("POST", "/v3/email/risk/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SEND_CODE_RESPONSE = Responses.json(Conv.model(EmailVerificationSendResponse::fromJson)); + + private static ApiRequest sendCodeRequest(EmailSendCodeParams params) { + return ApiRequest.builder("POST", "/v3/email/send/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CHECK_CODE_RESPONSE = Responses.json(Conv.model(EmailVerificationCheckResponse::fromJson)); + + private static ApiRequest checkCodeRequest(EmailCheckCodeParams params) { + return ApiRequest.builder("POST", "/v3/email/check/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code email} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #assessRisk(EmailRiskRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse assessRisk(EmailRiskRequest params, RequestOptions options) { + return client.execute(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE); + } + + /** + * Asynchronous {@link #assessRisk(EmailRiskRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> assessRiskAsync(EmailRiskRequest params, RequestOptions options) { + return client.executeAsync(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE); + } + + /** + * {@link #assessRisk(EmailRiskRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse assessRisk(EmailRiskRequest params) { + return client.execute(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE); + } + + /** + * Asynchronous {@link #assessRisk(EmailRiskRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> assessRiskAsync(EmailRiskRequest params) { + return client.executeAsync(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE); + } + + /** + * {@link #sendCode(EmailSendCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse sendCode(EmailSendCodeParams params, RequestOptions options) { + return client.execute(sendCodeRequest(params), options, SEND_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #sendCode(EmailSendCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> sendCodeAsync(EmailSendCodeParams params, RequestOptions options) { + return client.executeAsync(sendCodeRequest(params), options, SEND_CODE_RESPONSE); + } + + /** + * {@link #sendCode(EmailSendCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse sendCode(EmailSendCodeParams params) { + return client.execute(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #sendCode(EmailSendCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> sendCodeAsync(EmailSendCodeParams params) { + return client.executeAsync(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE); + } + + /** + * {@link #checkCode(EmailCheckCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse checkCode(EmailCheckCodeParams params, RequestOptions options) { + return client.execute(checkCodeRequest(params), options, CHECK_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #checkCode(EmailCheckCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> checkCodeAsync(EmailCheckCodeParams params, RequestOptions options) { + return client.executeAsync(checkCodeRequest(params), options, CHECK_CODE_RESPONSE); + } + + /** + * {@link #checkCode(EmailCheckCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse checkCode(EmailCheckCodeParams params) { + return client.execute(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #checkCode(EmailCheckCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> checkCodeAsync(EmailCheckCodeParams params) { + return client.executeAsync(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/FaceMatchResource.java b/src/main/java/me/didit/resources/FaceMatchResource.java new file mode 100644 index 0000000..7335924 --- /dev/null +++ b/src/main/java/me/didit/resources/FaceMatchResource.java @@ -0,0 +1,153 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.FaceMatchCompareParams; +import me.didit.types.FaceMatchCompareResponse; + +/** The {@code face_match} resource: {@code client.faceMatch()}. */ +public final class FaceMatchResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + FaceMatchResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Face Match + * + *

Compare two face images (1:1) and get back a similarity score (0โ€“100) plus an Approved/Declined status. + * + *

How it works. Both images are decoded and analyzed by a biometric model (set rotate_image=true if captures may be sideways or upside down), then a similarity score between the two faces is computed. A score strictly above face_match_score_decline_threshold (default 30) returns status: "Approved"; a score at or below it returns Declined with a LOW_FACE_MATCH_SIMILARITY warning. If no face pair can be scored at all, the call still returns 200 with status: "Declined" and a NO_REFERENCE_IMAGE warning โ€” score is null on the default save path, or 0 with save_api_request=false. Submit one clear, front-facing face per image for best results. + * + *

Billing. Each 200 response consumes one Face Match API credit (standalone APIs have no free tier). When the organization's balance cannot cover the call, the endpoint returns 403 with the not-enough-credits error before any image processing. + * + *

**Session persistence (save_api_request, default true).** When true, the call is persisted as an API-type session: it appears in the Business Console, the returned request_id is a real session id you can pass to GET /v3/session/{sessionId}/decision/, both images are stored as the session's face-match source/target images, and a status.updated webhook is emitted to your configured webhook endpoints. When false, nothing is stored and request_id is a one-off correlation UUID that cannot be looked up later. + * + *

Face search index. This endpoint never enrolls faces into your face search index and never runs blocklist or duplicate screening โ€” use POST /v3/passive-liveness/ or POST /v3/face-search/ for those. + * + *

Sandbox. Sandbox API keys skip all processing and billing: after request validation (malformed input still returns 400), the endpoint returns a static Approved mock payload, no session is persisted, and no credits are consumed. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

{@code POST /v3/face-match/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public FaceMatchCompareResponse compare(FaceMatchCompareParams params, RequestOptions options) { + return client.execute(compareRequest(params), options, COMPARE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #compare(FaceMatchCompareParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture compareAsync(FaceMatchCompareParams params, RequestOptions options) { + return client.executeAsync(compareRequest(params), options, COMPARE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #compare(FaceMatchCompareParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public FaceMatchCompareResponse compare(FaceMatchCompareParams params) { + return client.execute(compareRequest(params), RequestOptions.none(), COMPARE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #compare(FaceMatchCompareParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture compareAsync(FaceMatchCompareParams params) { + return client.executeAsync(compareRequest(params), RequestOptions.none(), COMPARE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler COMPARE_RESPONSE = Responses.json(Conv.model(FaceMatchCompareResponse::fromJson)); + + private static ApiRequest compareRequest(FaceMatchCompareParams params) { + return ApiRequest.builder("POST", "/v3/face-match/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code face_match} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #compare(FaceMatchCompareParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse compare(FaceMatchCompareParams params, RequestOptions options) { + return client.execute(compareRequest(params), options, COMPARE_RESPONSE); + } + + /** + * Asynchronous {@link #compare(FaceMatchCompareParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> compareAsync(FaceMatchCompareParams params, RequestOptions options) { + return client.executeAsync(compareRequest(params), options, COMPARE_RESPONSE); + } + + /** + * {@link #compare(FaceMatchCompareParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse compare(FaceMatchCompareParams params) { + return client.execute(compareRequest(params), RequestOptions.none(), COMPARE_RESPONSE); + } + + /** + * Asynchronous {@link #compare(FaceMatchCompareParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> compareAsync(FaceMatchCompareParams params) { + return client.executeAsync(compareRequest(params), RequestOptions.none(), COMPARE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/FaceSearchResource.java b/src/main/java/me/didit/resources/FaceSearchResource.java new file mode 100644 index 0000000..45928db --- /dev/null +++ b/src/main/java/me/didit/resources/FaceSearchResource.java @@ -0,0 +1,156 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.FaceSearchSearchParams; +import me.didit.types.FaceSearchSearchResponse; + +/** The {@code face_search} resource: {@code client.faceSearch()}. */ +public final class FaceSearchResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + FaceSearchResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Face Search + * + *

Search a face image (1:N) against your application's face search index โ€” faces enrolled from verification sessions, saved standalone API calls, direct user-profile face uploads, and your block/allow lists โ€” and get back ranked similarity matches plus blocklist and duplicate warnings. + * + *

How it works. The largest detected face in user_image is embedded and searched against the index, scoped to your application. Up to 5 matches above the similarity floor are returned in matches, each with similarity_percentage, the originating session (session_id, session_number, status, vendor_data), user_details extracted during that session's document verification, is_blocklisted / is_allowlisted flags, and a source discriminator (session, imported, or list_entry). + * + *

- search_type=most_similar (default) ranks every enrolled face by similarity โ€” use it for deduplication and fraud-ring investigation. + * - search_type=blocklisted_or_approved restricts candidates to blocklisted faces, allowlisted faces, faces from approved sessions, and imported user-profile faces, ranking blocklisted entries first โ€” use it when the primary goal is blocklist screening. + * + *

status is Declined only when a FACE_IN_BLOCKLIST or POSSIBLE_FACE_IN_BLOCKLIST warning fires; DUPLICATED_FACE / POSSIBLE_DUPLICATED_FACE (information) and MULTIPLE_FACES_DETECTED (warning) never decline. Unlike Passive Liveness, this endpoint does not exclude prior sessions with the same vendor_data from matching. A passive-liveness analysis also runs internally and is stored with the persisted session, but its result is not part of this response. + * + *

Billing. Each 200 response consumes one Face Search API credit (standalone APIs have no free tier). Insufficient balance returns 403 before any image processing. + * + *

**Session persistence and face enrollment (save_api_request, default true).** When true, the call is persisted as an API-type session (Business Console, GET /v3/session/{sessionId}/decision/ via the returned request_id, status.updated webhook) and the searched face is enrolled into your face search index. Faces enrolled by Face Search calls are excluded from future Face Search results, so repeated searches never match each other. When false, the call is one-shot: nothing is stored, the face is not enrolled, and match_image_url values are internal storage paths rather than downloadable URLs. + * + *

Sandbox. Sandbox API keys skip all processing and billing: after request validation (malformed input still returns 400), the endpoint returns a static Approved mock payload, no session is persisted, and no credits are consumed. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

{@code POST /v3/face-search/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public FaceSearchSearchResponse search(FaceSearchSearchParams params, RequestOptions options) { + return client.execute(searchRequest(params), options, SEARCH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #search(FaceSearchSearchParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture searchAsync(FaceSearchSearchParams params, RequestOptions options) { + return client.executeAsync(searchRequest(params), options, SEARCH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #search(FaceSearchSearchParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public FaceSearchSearchResponse search(FaceSearchSearchParams params) { + return client.execute(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #search(FaceSearchSearchParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture searchAsync(FaceSearchSearchParams params) { + return client.executeAsync(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler SEARCH_RESPONSE = Responses.json(Conv.model(FaceSearchSearchResponse::fromJson)); + + private static ApiRequest searchRequest(FaceSearchSearchParams params) { + return ApiRequest.builder("POST", "/v3/face-search/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code face_search} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #search(FaceSearchSearchParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse search(FaceSearchSearchParams params, RequestOptions options) { + return client.execute(searchRequest(params), options, SEARCH_RESPONSE); + } + + /** + * Asynchronous {@link #search(FaceSearchSearchParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> searchAsync(FaceSearchSearchParams params, RequestOptions options) { + return client.executeAsync(searchRequest(params), options, SEARCH_RESPONSE); + } + + /** + * {@link #search(FaceSearchSearchParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse search(FaceSearchSearchParams params) { + return client.execute(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE); + } + + /** + * Asynchronous {@link #search(FaceSearchSearchParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> searchAsync(FaceSearchSearchParams params) { + return client.executeAsync(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/FraudChecksResource.java b/src/main/java/me/didit/resources/FraudChecksResource.java new file mode 100644 index 0000000..ff45fe0 --- /dev/null +++ b/src/main/java/me/didit/resources/FraudChecksResource.java @@ -0,0 +1,335 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.FraudCheckPlan; +import me.didit.types.FraudCheckRequestRequest; +import me.didit.types.FraudCheckResponse; + +/** The {@code fraud_checks} resource: {@code client.fraudChecks()}. */ +public final class FraudChecksResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + FraudChecksResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Retrieve a Fraud Check + * + *

Fetch a previously created check by its check_id. + * + *

{@code GET /v3/fraud/checks/{check_id}/} + * + * @param checkId the {@code check_id} + * @param options per-request options that override the client options + * @return the response body + */ + public FraudCheckResponse retrieve(String checkId, RequestOptions options) { + return client.execute(retrieveRequest(checkId), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param checkId the {@code check_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String checkId, RequestOptions options) { + return client.executeAsync(retrieveRequest(checkId), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param checkId the {@code check_id} + * @return the result + */ + public FraudCheckResponse retrieve(String checkId) { + return client.execute(retrieveRequest(checkId), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param checkId the {@code check_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String checkId) { + return client.executeAsync(retrieveRequest(checkId), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Run a Fraud Check + * + *

Submit one or more typed identifiers and receive normalization, fresh enrichment, authoritative validation where the country and identifier type are covered, independent risk dimensions and a recommendation in one response. + * + *

These profiles support identifier checks. Selfie-based identity binding (biometric_identity) requires profile version 2026-09-14.2 and a Brazilian CPF; it runs only with the user's consent and when your organization is entitled to it. Earlier versions report it as not_available_in_profile_version. Modules that cannot run are reported as skipped with a deterministic reason; a source that could not answer is never reported as an identity mismatch. + * + *

{@code POST /v3/fraud/checks/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public FraudCheckResponse create(FraudCheckRequestRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(FraudCheckRequestRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(FraudCheckRequestRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(FraudCheckRequestRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public FraudCheckResponse create(FraudCheckRequestRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(FraudCheckRequestRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(FraudCheckRequestRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Plan a Fraud Check + * + *

Validate selected checks and estimate their price without executing, creating a session or billing. + * + *

{@code POST /v3/fraud/checks/plan/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public FraudCheckPlan plan(FraudCheckRequestRequest params, RequestOptions options) { + return client.execute(planRequest(params), options, PLAN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #plan(FraudCheckRequestRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture planAsync(FraudCheckRequestRequest params, RequestOptions options) { + return client.executeAsync(planRequest(params), options, PLAN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #plan(FraudCheckRequestRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public FraudCheckPlan plan(FraudCheckRequestRequest params) { + return client.execute(planRequest(params), RequestOptions.none(), PLAN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #plan(FraudCheckRequestRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture planAsync(FraudCheckRequestRequest params) { + return client.executeAsync(planRequest(params), RequestOptions.none(), PLAN_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(FraudCheckResponse::fromJson)); + + private static ApiRequest retrieveRequest(String checkId) { + return ApiRequest.builder("GET", "/v3/fraud/checks/{check_id}/") + .pathParam("check_id", checkId) + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(FraudCheckResponse::fromJson)); + + private static ApiRequest createRequest(FraudCheckRequestRequest params) { + return ApiRequest.builder("POST", "/v3/fraud/checks/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler PLAN_RESPONSE = Responses.json(Conv.model(FraudCheckPlan::fromJson)); + + private static ApiRequest planRequest(FraudCheckRequestRequest params) { + return ApiRequest.builder("POST", "/v3/fraud/checks/plan/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code fraud_checks} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param checkId the {@code check_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String checkId, RequestOptions options) { + return client.execute(retrieveRequest(checkId), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param checkId the {@code check_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String checkId, RequestOptions options) { + return client.executeAsync(retrieveRequest(checkId), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param checkId the {@code check_id} + * @return the result + */ + public RawResponse retrieve(String checkId) { + return client.execute(retrieveRequest(checkId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param checkId the {@code check_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String checkId) { + return client.executeAsync(retrieveRequest(checkId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #create(FraudCheckRequestRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(FraudCheckRequestRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(FraudCheckRequestRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(FraudCheckRequestRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(FraudCheckRequestRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(FraudCheckRequestRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(FraudCheckRequestRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(FraudCheckRequestRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #plan(FraudCheckRequestRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse plan(FraudCheckRequestRequest params, RequestOptions options) { + return client.execute(planRequest(params), options, PLAN_RESPONSE); + } + + /** + * Asynchronous {@link #plan(FraudCheckRequestRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> planAsync(FraudCheckRequestRequest params, RequestOptions options) { + return client.executeAsync(planRequest(params), options, PLAN_RESPONSE); + } + + /** + * {@link #plan(FraudCheckRequestRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse plan(FraudCheckRequestRequest params) { + return client.execute(planRequest(params), RequestOptions.none(), PLAN_RESPONSE); + } + + /** + * Asynchronous {@link #plan(FraudCheckRequestRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> planAsync(FraudCheckRequestRequest params) { + return client.executeAsync(planRequest(params), RequestOptions.none(), PLAN_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/IdVerificationResource.java b/src/main/java/me/didit/resources/IdVerificationResource.java new file mode 100644 index 0000000..5575bc3 --- /dev/null +++ b/src/main/java/me/didit/resources/IdVerificationResource.java @@ -0,0 +1,153 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.IdVerificationVerifyParams; +import me.didit.types.IdVerificationVerifyResponse; + +/** The {@code id_verification} resource: {@code client.idVerification()}. */ +public final class IdVerificationResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + IdVerificationResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * ID Verification (document OCR + fraud checks) + * + *

OCR an identity document and run document fraud checks in one call โ€” returns the extracted holder fields, the parsed MRZ, an Approved/Declined status, and a warnings list explaining every issue found. Supports 14,000+ document types from 220+ countries and territories. + * + *

How it works. Send the document's front_image (required) and, for two-sided documents, the back_image. Upload uncropped photos with all four corners of the document visible โ€” the service detects, aligns, and crops the document itself, so do not pre-crop. The document is classified automatically (you never declare the country or document type), the visual zone is read with OCR, and the MRZ and any barcodes are decoded. Cross-checks then validate dates, number formats, and MRZ check digits, and compare the visual zone against the MRZ. With perform_document_liveness=true, the images are additionally screened for screen replays, printed copies, and portrait manipulation. + * + *

Decision logic. status is Approved unless at least one warning resolves to a decline. Fraud and hard-failure risks always decline: DOCUMENT_EXPIRED, SCREEN_CAPTURE_DETECTED, PRINTED_COPY_DETECTED, PORTRAIT_MANIPULATION_DETECTED, PUBLIC_DOCUMENT_IMAGE_DETECTED, plus extraction failures (NAME_NOT_DETECTED, DATE_OF_BIRTH_NOT_DETECTED, DOCUMENT_NUMBER_NOT_DETECTED). (PORTRAIT_IMAGE_NOT_DETECTED, COULD_NOT_DETECT_DOCUMENT_TYPE, INVALID_DATE, and MRZ_NOT_DETECTED exist in workflow sessions but are never produced by this standalone endpoint.) Three risk groups are configurable per request via invalid_mrz_action, inconsistent_data_action, and expiration_date_not_detected_action (DECLINE or NO_ACTION). All other warnings (e.g. POSSIBLE_DUPLICATED_USER) are informational and never decline on their own. A document that cannot be processed at all returns 400 with {"error": "COULD_NOT_RECOGNIZE_DOCUMENT"}; a readable but problematic document returns 200 with status: "Declined" โ€” always inspect id_verification.status and id_verification.warnings, not just the HTTP code. + * + *

Billing. Each 200 response consumes one ID Verification API credit (standalone APIs have no free tier). When the organization's balance cannot cover the call, the endpoint returns 403 with the not-enough-credits error before any image processing. + * + *

**Session persistence (save_api_request, default true).** When true, the call is persisted as an API-type session: it appears in the Business Console, the returned request_id is a real session id you can pass to GET /v3/session/{sessionId}/decision/, the cropped document/portrait images are stored and returned as short-lived media URLs (https://<media-host>/ocr/...), and a status.updated webhook is emitted to your configured webhook endpoints. When false, nothing is stored, request_id is a one-off correlation UUID, and portrait_image/front_image/back_image are returned inline as base64-encoded JPEG strings. + * + *

Sandbox. Sandbox API keys skip all processing and billing: after request validation (malformed input still returns 400), the endpoint returns a static Approved mock payload (a fictional "Sandbox User" USA identity card), no session is persisted, and no credits are consumed. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

{@code POST /v3/id-verification/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public IdVerificationVerifyResponse verify(IdVerificationVerifyParams params, RequestOptions options) { + return client.execute(verifyRequest(params), options, VERIFY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #verify(IdVerificationVerifyParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture verifyAsync(IdVerificationVerifyParams params, RequestOptions options) { + return client.executeAsync(verifyRequest(params), options, VERIFY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #verify(IdVerificationVerifyParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public IdVerificationVerifyResponse verify(IdVerificationVerifyParams params) { + return client.execute(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #verify(IdVerificationVerifyParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture verifyAsync(IdVerificationVerifyParams params) { + return client.executeAsync(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler VERIFY_RESPONSE = Responses.json(Conv.model(IdVerificationVerifyResponse::fromJson)); + + private static ApiRequest verifyRequest(IdVerificationVerifyParams params) { + return ApiRequest.builder("POST", "/v3/id-verification/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code id_verification} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #verify(IdVerificationVerifyParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse verify(IdVerificationVerifyParams params, RequestOptions options) { + return client.execute(verifyRequest(params), options, VERIFY_RESPONSE); + } + + /** + * Asynchronous {@link #verify(IdVerificationVerifyParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> verifyAsync(IdVerificationVerifyParams params, RequestOptions options) { + return client.executeAsync(verifyRequest(params), options, VERIFY_RESPONSE); + } + + /** + * {@link #verify(IdVerificationVerifyParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse verify(IdVerificationVerifyParams params) { + return client.execute(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE); + } + + /** + * Asynchronous {@link #verify(IdVerificationVerifyParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> verifyAsync(IdVerificationVerifyParams params) { + return client.executeAsync(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/IdWalletsResource.java b/src/main/java/me/didit/resources/IdWalletsResource.java new file mode 100644 index 0000000..fa8fac2 --- /dev/null +++ b/src/main/java/me/didit/resources/IdWalletsResource.java @@ -0,0 +1,2892 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.DigitalIdWalletApiAudkenniWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBankidCzWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBankidNoWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBankidSeWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBuypassWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiConnectidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiDiiaWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiEudiWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiFranceconnectWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiFrejaidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiFtnWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiGovbrWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiGovukWalletWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiIdcardEeWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiIdinWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiItsmeWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiMitidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiMobileIdWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiMojeidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiOneidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiSmartIdWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiUaePassWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiVippsWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiWalletCatalogResponse; +import me.didit.types.DigitalIdWalletApiWalletVerificationResponse; + +/** The {@code id_wallets} resource: {@code client.idWallets()}. */ +public final class IdWalletsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + IdWalletsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List Digital ID wallets + * + *

Every Digital ID wallet with its start endpoint, countries, required fields and whether this application can start it in this environment now. Listed does not mean live. + * + *

{@code GET /v3/id-verification/wallets/} + * + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletCatalogResponse list(RequestOptions options) { + return client.execute(listRequest(), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listAsync(RequestOptions options) { + return client.executeAsync(listRequest(), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(RequestOptions)}, with the client's options. + * + * @return the result + */ + public DigitalIdWalletApiWalletCatalogResponse list() { + return client.execute(listRequest(), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture listAsync() { + return client.executeAsync(listRequest(), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get a wallet verification + * + *

Status and result of a wallet verification: the normalized identity and the wallet's own attributes once verified, the error code once declined, the next action while pending. A verification past expires_at is decided timeout. + * + *

{@code GET /v3/id-verification/wallets/verifications/{request_id}/} + * + * @param requestId The request_id the start endpoint returned. + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse retrieveVerification(String requestId, RequestOptions options) { + return client.execute(retrieveVerificationRequest(requestId), options, RETRIEVE_VERIFICATION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveVerification(String, RequestOptions)}. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveVerificationAsync(String requestId, RequestOptions options) { + return client.executeAsync(retrieveVerificationRequest(requestId), options, RETRIEVE_VERIFICATION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveVerification(String, RequestOptions)}, with the client's options. + * + * @param requestId the {@code request_id} + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse retrieveVerification(String requestId) { + return client.execute(retrieveVerificationRequest(requestId), RequestOptions.none(), RETRIEVE_VERIFICATION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveVerification(String, RequestOptions)}, with the client's options. + * + * @param requestId the {@code request_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveVerificationAsync(String requestId) { + return client.executeAsync(retrieveVerificationRequest(requestId), RequestOptions.none(), RETRIEVE_VERIFICATION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Poll a wallet verification + * + *

Smart-ID and Mobile-ID: ask the provider whether the user confirmed, refused or let the prompt lapse, and verify the signed identity when they confirmed. Redirect wallets complete through the user's browser, so for them this only reads the verification back. Answers the verification as it is afterwards. + * + *

{@code POST /v3/id-verification/wallets/verifications/{request_id}/poll/} + * + * @param requestId The request_id the start endpoint returned. + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse pollVerification(String requestId, RequestOptions options) { + return client.execute(pollVerificationRequest(requestId), options, POLL_VERIFICATION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #pollVerification(String, RequestOptions)}. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture pollVerificationAsync(String requestId, RequestOptions options) { + return client.executeAsync(pollVerificationRequest(requestId), options, POLL_VERIFICATION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #pollVerification(String, RequestOptions)}, with the client's options. + * + * @param requestId the {@code request_id} + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse pollVerification(String requestId) { + return client.execute(pollVerificationRequest(requestId), RequestOptions.none(), POLL_VERIFICATION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #pollVerification(String, RequestOptions)}, with the client's options. + * + * @param requestId the {@code request_id} + * @return a future completed with the result + */ + public CompletableFuture pollVerificationAsync(String requestId) { + return client.executeAsync(pollVerificationRequest(requestId), RequestOptions.none(), POLL_VERIFICATION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Cancel a wallet verification + * + *

Withdraw a pending verification: it is declined as cancelled and never billed. A decided one is returned unchanged. Smart-ID and Mobile-ID: a cancel that arrives while a poll is checking the sign-in waits a few seconds for that poll, then declines it, or returns it verified if the user had already confirmed. A verification the user is completing right now cannot be cancelled (409 verification_in_progress with Retry-After): retry after that many seconds to read its outcome. + * + *

{@code POST /v3/id-verification/wallets/verifications/{request_id}/cancel/} + * + * @param requestId The request_id the start endpoint returned. + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse cancelVerification(String requestId, RequestOptions options) { + return client.execute(cancelVerificationRequest(requestId), options, CANCEL_VERIFICATION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #cancelVerification(String, RequestOptions)}. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture cancelVerificationAsync(String requestId, RequestOptions options) { + return client.executeAsync(cancelVerificationRequest(requestId), options, CANCEL_VERIFICATION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #cancelVerification(String, RequestOptions)}, with the client's options. + * + * @param requestId the {@code request_id} + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse cancelVerification(String requestId) { + return client.execute(cancelVerificationRequest(requestId), RequestOptions.none(), CANCEL_VERIFICATION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #cancelVerification(String, RequestOptions)}, with the client's options. + * + * @param requestId the {@code request_id} + * @return a future completed with the result + */ + public CompletableFuture cancelVerificationAsync(String requestId) { + return client.executeAsync(cancelVerificationRequest(requestId), RequestOptions.none(), CANCEL_VERIFICATION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start MitID verification + * + *

Start a MitID sign-in (Danish Agency for Digital Government; DNK) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/mitid/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startMitidRequest(params), options, START_MITID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startMitidAsync(DigitalIdWalletApiMitidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startMitidRequest(params), options, START_MITID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest params) { + return client.execute(startMitidRequest(params), RequestOptions.none(), START_MITID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startMitidAsync(DigitalIdWalletApiMitidWalletVerificationStartRequest params) { + return client.executeAsync(startMitidRequest(params), RequestOptions.none(), START_MITID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start BankID (SWE) verification + * + *

Start a BankID (SWE) sign-in (Finansiell ID-Teknik / bank consortium; SWE) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/bankid-se/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBankidSeRequest(params), options, START_BANKID_SE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startBankidSeAsync(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBankidSeRequest(params), options, START_BANKID_SE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params) { + return client.execute(startBankidSeRequest(params), RequestOptions.none(), START_BANKID_SE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startBankidSeAsync(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params) { + return client.executeAsync(startBankidSeRequest(params), RequestOptions.none(), START_BANKID_SE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start BankID (NOR) verification + * + *

Start a BankID (NOR) sign-in (BankID BankAxept AS; NOR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/bankid-no/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBankidNoRequest(params), options, START_BANKID_NO_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startBankidNoAsync(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBankidNoRequest(params), options, START_BANKID_NO_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params) { + return client.execute(startBankidNoRequest(params), RequestOptions.none(), START_BANKID_NO_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startBankidNoAsync(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params) { + return client.executeAsync(startBankidNoRequest(params), RequestOptions.none(), START_BANKID_NO_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Vipps verification + * + *

Start a Vipps sign-in (Vipps MobilePay / BankID NO; NOR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/vipps/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startVippsRequest(params), options, START_VIPPS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startVippsAsync(DigitalIdWalletApiVippsWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startVippsRequest(params), options, START_VIPPS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest params) { + return client.execute(startVippsRequest(params), RequestOptions.none(), START_VIPPS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startVippsAsync(DigitalIdWalletApiVippsWalletVerificationStartRequest params) { + return client.executeAsync(startVippsRequest(params), RequestOptions.none(), START_VIPPS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Buypass ID verification + * + *

Start a Buypass ID sign-in (Buypass AS; NOR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/buypass/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBuypassRequest(params), options, START_BUYPASS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startBuypassAsync(DigitalIdWalletApiBuypassWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBuypassRequest(params), options, START_BUYPASS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest params) { + return client.execute(startBuypassRequest(params), RequestOptions.none(), START_BUYPASS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startBuypassAsync(DigitalIdWalletApiBuypassWalletVerificationStartRequest params) { + return client.executeAsync(startBuypassRequest(params), RequestOptions.none(), START_BUYPASS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start itsme verification + * + *

Start a itsme sign-in (Belgian Mobile ID; BEL, LUX, NLD) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/itsme/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startItsmeRequest(params), options, START_ITSME_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startItsmeAsync(DigitalIdWalletApiItsmeWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startItsmeRequest(params), options, START_ITSME_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest params) { + return client.execute(startItsmeRequest(params), RequestOptions.none(), START_ITSME_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startItsmeAsync(DigitalIdWalletApiItsmeWalletVerificationStartRequest params) { + return client.executeAsync(startItsmeRequest(params), RequestOptions.none(), START_ITSME_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start iDIN verification + * + *

Start a iDIN sign-in (Dutch banks (Currence iDIN); NLD) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/idin/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startIdinRequest(params), options, START_IDIN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startIdinAsync(DigitalIdWalletApiIdinWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startIdinRequest(params), options, START_IDIN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest params) { + return client.execute(startIdinRequest(params), RequestOptions.none(), START_IDIN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startIdinAsync(DigitalIdWalletApiIdinWalletVerificationStartRequest params) { + return client.executeAsync(startIdinRequest(params), RequestOptions.none(), START_IDIN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Finnish Trust Network verification + * + *

Start a Finnish Trust Network sign-in (Finnish banks and mobile operators (FTN); FIN) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/ftn/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startFtnRequest(params), options, START_FTN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startFtnAsync(DigitalIdWalletApiFtnWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startFtnRequest(params), options, START_FTN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest params) { + return client.execute(startFtnRequest(params), RequestOptions.none(), START_FTN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startFtnAsync(DigitalIdWalletApiFtnWalletVerificationStartRequest params) { + return client.executeAsync(startFtnRequest(params), RequestOptions.none(), START_FTN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Personalausweis verification + * + *

Start a Personalausweis sign-in (Bundesministerium des Innern (eID); DEU) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/personalausweis/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startPersonalausweisRequest(params), options, START_PERSONALAUSWEIS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startPersonalausweisAsync(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startPersonalausweisRequest(params), options, START_PERSONALAUSWEIS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params) { + return client.execute(startPersonalausweisRequest(params), RequestOptions.none(), START_PERSONALAUSWEIS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startPersonalausweisAsync(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params) { + return client.executeAsync(startPersonalausweisRequest(params), RequestOptions.none(), START_PERSONALAUSWEIS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Freja eID verification + * + *

Start a Freja eID sign-in (Freja eID Group; SWE) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/frejaid/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startFrejaidRequest(params), options, START_FREJAID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startFrejaidAsync(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startFrejaidRequest(params), options, START_FREJAID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params) { + return client.execute(startFrejaidRequest(params), RequestOptions.none(), START_FREJAID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startFrejaidAsync(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params) { + return client.executeAsync(startFrejaidRequest(params), RequestOptions.none(), START_FREJAID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start UAE PASS verification + * + *

Start a UAE PASS sign-in (UAE Digital Government Authority; ARE) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/uae-pass/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startUaePassRequest(params), options, START_UAE_PASS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startUaePassAsync(DigitalIdWalletApiUaePassWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startUaePassRequest(params), options, START_UAE_PASS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest params) { + return client.execute(startUaePassRequest(params), RequestOptions.none(), START_UAE_PASS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startUaePassAsync(DigitalIdWalletApiUaePassWalletVerificationStartRequest params) { + return client.executeAsync(startUaePassRequest(params), RequestOptions.none(), START_UAE_PASS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start gov.br verification + * + *

Start a gov.br sign-in (Governo Federal do Brasil; BRA) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/govbr/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startGovbrRequest(params), options, START_GOVBR_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startGovbrAsync(DigitalIdWalletApiGovbrWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startGovbrRequest(params), options, START_GOVBR_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest params) { + return client.execute(startGovbrRequest(params), RequestOptions.none(), START_GOVBR_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startGovbrAsync(DigitalIdWalletApiGovbrWalletVerificationStartRequest params) { + return client.executeAsync(startGovbrRequest(params), RequestOptions.none(), START_GOVBR_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start OneID verification + * + *

Start a OneID sign-in (OneID (UK bank-verified identity); GBR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/oneid/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startOneidRequest(params), options, START_ONEID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startOneidAsync(DigitalIdWalletApiOneidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startOneidRequest(params), options, START_ONEID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest params) { + return client.execute(startOneidRequest(params), RequestOptions.none(), START_ONEID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startOneidAsync(DigitalIdWalletApiOneidWalletVerificationStartRequest params) { + return client.executeAsync(startOneidRequest(params), RequestOptions.none(), START_ONEID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start GOV.UK Wallet verification + * + *

Start a GOV.UK Wallet sign-in (UK Government Digital Service; GBR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/govuk-wallet/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startGovukWalletRequest(params), options, START_GOVUK_WALLET_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startGovukWalletAsync(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startGovukWalletRequest(params), options, START_GOVUK_WALLET_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params) { + return client.execute(startGovukWalletRequest(params), RequestOptions.none(), START_GOVUK_WALLET_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startGovukWalletAsync(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params) { + return client.executeAsync(startGovukWalletRequest(params), RequestOptions.none(), START_GOVUK_WALLET_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Smart-ID verification + * + *

Start a Smart-ID sign-in (SK ID Solutions; EST, LVA, LTU, BEL) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=confirm_in_app with the comparison code to show the user; the user confirms it and enters their PIN in the app (never collect the PIN). Poll POST /v3/id-verification/wallets/verifications/{request_id}/poll/ every poll_interval_seconds, or rely on the webhook: Didit polls in the background too. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/smart-id/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startSmartIdRequest(params), options, START_SMART_ID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startSmartIdAsync(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startSmartIdRequest(params), options, START_SMART_ID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params) { + return client.execute(startSmartIdRequest(params), RequestOptions.none(), START_SMART_ID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startSmartIdAsync(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params) { + return client.executeAsync(startSmartIdRequest(params), RequestOptions.none(), START_SMART_ID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Mobile-ID verification + * + *

Start a Mobile-ID sign-in (SK ID Solutions with the national mobile operators; EST, LTU) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=confirm_in_app with the comparison code to show the user; the user confirms it and enters their PIN in the app (never collect the PIN). Poll POST /v3/id-verification/wallets/verifications/{request_id}/poll/ every poll_interval_seconds, or rely on the webhook: Didit polls in the background too. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/mobile-id/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startMobileIdRequest(params), options, START_MOBILE_ID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startMobileIdAsync(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startMobileIdRequest(params), options, START_MOBILE_ID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params) { + return client.execute(startMobileIdRequest(params), RequestOptions.none(), START_MOBILE_ID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startMobileIdAsync(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params) { + return client.executeAsync(startMobileIdRequest(params), RequestOptions.none(), START_MOBILE_ID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Estonian ID-card verification + * + *

Start a Estonian ID-card sign-in (Police and Border Guard Board (Estonia); EST) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/idcard-ee/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startIdcardEeRequest(params), options, START_IDCARD_EE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startIdcardEeAsync(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startIdcardEeRequest(params), options, START_IDCARD_EE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params) { + return client.execute(startIdcardEeRequest(params), RequestOptions.none(), START_IDCARD_EE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startIdcardEeAsync(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params) { + return client.executeAsync(startIdcardEeRequest(params), RequestOptions.none(), START_IDCARD_EE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start eParaksts mobile verification + * + *

Start a eParaksts mobile sign-in (LVRTC (Latvian State Radio and Television Centre); LVA) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/eparaksts-mobile/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startEparakstsMobileRequest(params), options, START_EPARAKSTS_MOBILE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startEparakstsMobileAsync(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startEparakstsMobileRequest(params), options, START_EPARAKSTS_MOBILE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params) { + return client.execute(startEparakstsMobileRequest(params), RequestOptions.none(), START_EPARAKSTS_MOBILE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startEparakstsMobileAsync(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params) { + return client.executeAsync(startEparakstsMobileRequest(params), RequestOptions.none(), START_EPARAKSTS_MOBILE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Bank iD verification + * + *

Start a Bank iD sign-in (Bankovnรญ identita, a.s.; CZE) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/bankid-cz/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBankidCzRequest(params), options, START_BANKID_CZ_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startBankidCzAsync(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBankidCzRequest(params), options, START_BANKID_CZ_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params) { + return client.execute(startBankidCzRequest(params), RequestOptions.none(), START_BANKID_CZ_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startBankidCzAsync(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params) { + return client.executeAsync(startBankidCzRequest(params), RequestOptions.none(), START_BANKID_CZ_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start MojeID verification + * + *

Start a MojeID sign-in (CZ.NIC; CZE) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/mojeid/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startMojeidRequest(params), options, START_MOJEID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startMojeidAsync(DigitalIdWalletApiMojeidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startMojeidRequest(params), options, START_MOJEID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest params) { + return client.execute(startMojeidRequest(params), RequestOptions.none(), START_MOJEID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startMojeidAsync(DigitalIdWalletApiMojeidWalletVerificationStartRequest params) { + return client.executeAsync(startMojeidRequest(params), RequestOptions.none(), START_MOJEID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Diia verification + * + *

Start a Diia sign-in (Ministry of Digital Transformation of Ukraine; UKR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/diia/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startDiiaRequest(params), options, START_DIIA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startDiiaAsync(DigitalIdWalletApiDiiaWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startDiiaRequest(params), options, START_DIIA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest params) { + return client.execute(startDiiaRequest(params), RequestOptions.none(), START_DIIA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startDiiaAsync(DigitalIdWalletApiDiiaWalletVerificationStartRequest params) { + return client.executeAsync(startDiiaRequest(params), RequestOptions.none(), START_DIIA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start FranceConnect verification + * + *

Start a FranceConnect sign-in (DINUM (French state); FRA) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/franceconnect/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startFranceconnectRequest(params), options, START_FRANCECONNECT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startFranceconnectAsync(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startFranceconnectRequest(params), options, START_FRANCECONNECT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params) { + return client.execute(startFranceconnectRequest(params), RequestOptions.none(), START_FRANCECONNECT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startFranceconnectAsync(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params) { + return client.executeAsync(startFranceconnectRequest(params), RequestOptions.none(), START_FRANCECONNECT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start Auรฐkenni verification + * + *

Start a Auรฐkenni sign-in (Auรฐkenni (Icelandic electronic ID); ISL) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/audkenni/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startAudkenniRequest(params), options, START_AUDKENNI_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startAudkenniAsync(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startAudkenniRequest(params), options, START_AUDKENNI_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params) { + return client.execute(startAudkenniRequest(params), RequestOptions.none(), START_AUDKENNI_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startAudkenniAsync(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params) { + return client.executeAsync(startAudkenniRequest(params), RequestOptions.none(), START_AUDKENNI_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start ConnectID verification + * + *

Start a ConnectID sign-in (Australian Payments Plus; AUS) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/connectid/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startConnectidRequest(params), options, START_CONNECTID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startConnectidAsync(DigitalIdWalletApiConnectidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startConnectidRequest(params), options, START_CONNECTID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest params) { + return client.execute(startConnectidRequest(params), RequestOptions.none(), START_CONNECTID_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startConnectidAsync(DigitalIdWalletApiConnectidWalletVerificationStartRequest params) { + return client.executeAsync(startConnectidRequest(params), RequestOptions.none(), START_CONNECTID_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Start EUDI Wallet verification + * + *

Start a EUDI Wallet sign-in (The user's own member state; the issuer differs per country; AUT, BEL, BGR, HRV, CYP, CZE, DNK, EST, FIN, FRA, DEU, GRC, HUN, IRL, ITA, LVA, LTU, LUX, MLT, NLD, POL, PRT, ROU, SVK, SVN, ESP, SWE, ISL, LIE, NOR) without any workflow. Billed once, only when the identity is verified. The response carries next_action.type=redirect with the URL to send the user's browser to; the user returns to return_url with request_id and result appended. Read the outcome with GET /v3/id-verification/wallets/verifications/{request_id}/ or from the webhook, never from the URL. Sandbox applications get a deterministic simulation (simulated: true) that never contacts the provider. + * + *

{@code POST /v3/id-verification/wallets/eudi/} + *

Accepts an {@code Idempotency-Key}: set it with {@link RequestOptions.Builder#idempotencyKey(String)}. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public DigitalIdWalletApiWalletVerificationResponse startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startEudiRequest(params), options, START_EUDI_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture startEudiAsync(DigitalIdWalletApiEudiWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startEudiRequest(params), options, START_EUDI_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public DigitalIdWalletApiWalletVerificationResponse startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest params) { + return client.execute(startEudiRequest(params), RequestOptions.none(), START_EUDI_RESPONSE).data(); + } + + /** + * Asynchronous {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture startEudiAsync(DigitalIdWalletApiEudiWalletVerificationStartRequest params) { + return client.executeAsync(startEudiRequest(params), RequestOptions.none(), START_EUDI_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler LIST_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletCatalogResponse::fromJson)); + + private static ApiRequest listRequest() { + return ApiRequest.builder("GET", "/v3/id-verification/wallets/") + .build(); + } + + private static final ResponseHandler RETRIEVE_VERIFICATION_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest retrieveVerificationRequest(String requestId) { + return ApiRequest.builder("GET", "/v3/id-verification/wallets/verifications/{request_id}/") + .pathParam("request_id", requestId) + .build(); + } + + private static final ResponseHandler POLL_VERIFICATION_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest pollVerificationRequest(String requestId) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/verifications/{request_id}/poll/") + .pathParam("request_id", requestId) + .build(); + } + + private static final ResponseHandler CANCEL_VERIFICATION_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest cancelVerificationRequest(String requestId) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/verifications/{request_id}/cancel/") + .pathParam("request_id", requestId) + .build(); + } + + private static final ResponseHandler START_MITID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startMitidRequest(DigitalIdWalletApiMitidWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/mitid/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_BANKID_SE_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startBankidSeRequest(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/bankid-se/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_BANKID_NO_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startBankidNoRequest(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/bankid-no/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_VIPPS_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startVippsRequest(DigitalIdWalletApiVippsWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/vipps/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_BUYPASS_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startBuypassRequest(DigitalIdWalletApiBuypassWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/buypass/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_ITSME_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startItsmeRequest(DigitalIdWalletApiItsmeWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/itsme/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_IDIN_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startIdinRequest(DigitalIdWalletApiIdinWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/idin/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_FTN_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startFtnRequest(DigitalIdWalletApiFtnWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/ftn/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_PERSONALAUSWEIS_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startPersonalausweisRequest(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/personalausweis/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_FREJAID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startFrejaidRequest(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/frejaid/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_UAE_PASS_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startUaePassRequest(DigitalIdWalletApiUaePassWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/uae-pass/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_GOVBR_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startGovbrRequest(DigitalIdWalletApiGovbrWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/govbr/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_ONEID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startOneidRequest(DigitalIdWalletApiOneidWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/oneid/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_GOVUK_WALLET_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startGovukWalletRequest(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/govuk-wallet/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_SMART_ID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startSmartIdRequest(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/smart-id/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_MOBILE_ID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startMobileIdRequest(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/mobile-id/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_IDCARD_EE_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startIdcardEeRequest(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/idcard-ee/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_EPARAKSTS_MOBILE_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startEparakstsMobileRequest(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/eparaksts-mobile/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_BANKID_CZ_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startBankidCzRequest(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/bankid-cz/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_MOJEID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startMojeidRequest(DigitalIdWalletApiMojeidWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/mojeid/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_DIIA_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startDiiaRequest(DigitalIdWalletApiDiiaWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/diia/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_FRANCECONNECT_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startFranceconnectRequest(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/franceconnect/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_AUDKENNI_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startAudkenniRequest(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/audkenni/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_CONNECTID_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startConnectidRequest(DigitalIdWalletApiConnectidWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/connectid/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler START_EUDI_RESPONSE = Responses.json(Conv.model(DigitalIdWalletApiWalletVerificationResponse::fromJson)); + + private static ApiRequest startEudiRequest(DigitalIdWalletApiEudiWalletVerificationStartRequest params) { + return ApiRequest.builder("POST", "/v3/id-verification/wallets/eudi/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code id_wallets} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse list(RequestOptions options) { + return client.execute(listRequest(), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(), options, LIST_RESPONSE); + } + + /** + * {@link #list(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse list() { + return client.execute(listRequest(), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #retrieveVerification(String, RequestOptions)} with the raw response. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveVerification(String requestId, RequestOptions options) { + return client.execute(retrieveVerificationRequest(requestId), options, RETRIEVE_VERIFICATION_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveVerification(String, RequestOptions)} with the raw response. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveVerificationAsync(String requestId, RequestOptions options) { + return client.executeAsync(retrieveVerificationRequest(requestId), options, RETRIEVE_VERIFICATION_RESPONSE); + } + + /** + * {@link #retrieveVerification(String, RequestOptions)} with the raw response, with the client's options. + * + * @param requestId the {@code request_id} + * @return the result + */ + public RawResponse retrieveVerification(String requestId) { + return client.execute(retrieveVerificationRequest(requestId), RequestOptions.none(), RETRIEVE_VERIFICATION_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveVerification(String, RequestOptions)} with the raw response, with the client's options. + * + * @param requestId the {@code request_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveVerificationAsync(String requestId) { + return client.executeAsync(retrieveVerificationRequest(requestId), RequestOptions.none(), RETRIEVE_VERIFICATION_RESPONSE); + } + + /** + * {@link #pollVerification(String, RequestOptions)} with the raw response. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return the result + */ + public RawResponse pollVerification(String requestId, RequestOptions options) { + return client.execute(pollVerificationRequest(requestId), options, POLL_VERIFICATION_RESPONSE); + } + + /** + * Asynchronous {@link #pollVerification(String, RequestOptions)} with the raw response. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> pollVerificationAsync(String requestId, RequestOptions options) { + return client.executeAsync(pollVerificationRequest(requestId), options, POLL_VERIFICATION_RESPONSE); + } + + /** + * {@link #pollVerification(String, RequestOptions)} with the raw response, with the client's options. + * + * @param requestId the {@code request_id} + * @return the result + */ + public RawResponse pollVerification(String requestId) { + return client.execute(pollVerificationRequest(requestId), RequestOptions.none(), POLL_VERIFICATION_RESPONSE); + } + + /** + * Asynchronous {@link #pollVerification(String, RequestOptions)} with the raw response, with the client's options. + * + * @param requestId the {@code request_id} + * @return a future completed with the result + */ + public CompletableFuture> pollVerificationAsync(String requestId) { + return client.executeAsync(pollVerificationRequest(requestId), RequestOptions.none(), POLL_VERIFICATION_RESPONSE); + } + + /** + * {@link #cancelVerification(String, RequestOptions)} with the raw response. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return the result + */ + public RawResponse cancelVerification(String requestId, RequestOptions options) { + return client.execute(cancelVerificationRequest(requestId), options, CANCEL_VERIFICATION_RESPONSE); + } + + /** + * Asynchronous {@link #cancelVerification(String, RequestOptions)} with the raw response. + * + * @param requestId the {@code request_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> cancelVerificationAsync(String requestId, RequestOptions options) { + return client.executeAsync(cancelVerificationRequest(requestId), options, CANCEL_VERIFICATION_RESPONSE); + } + + /** + * {@link #cancelVerification(String, RequestOptions)} with the raw response, with the client's options. + * + * @param requestId the {@code request_id} + * @return the result + */ + public RawResponse cancelVerification(String requestId) { + return client.execute(cancelVerificationRequest(requestId), RequestOptions.none(), CANCEL_VERIFICATION_RESPONSE); + } + + /** + * Asynchronous {@link #cancelVerification(String, RequestOptions)} with the raw response, with the client's options. + * + * @param requestId the {@code request_id} + * @return a future completed with the result + */ + public CompletableFuture> cancelVerificationAsync(String requestId) { + return client.executeAsync(cancelVerificationRequest(requestId), RequestOptions.none(), CANCEL_VERIFICATION_RESPONSE); + } + + /** + * {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startMitidRequest(params), options, START_MITID_RESPONSE); + } + + /** + * Asynchronous {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startMitidAsync(DigitalIdWalletApiMitidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startMitidRequest(params), options, START_MITID_RESPONSE); + } + + /** + * {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest params) { + return client.execute(startMitidRequest(params), RequestOptions.none(), START_MITID_RESPONSE); + } + + /** + * Asynchronous {@link #startMitid(DigitalIdWalletApiMitidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startMitidAsync(DigitalIdWalletApiMitidWalletVerificationStartRequest params) { + return client.executeAsync(startMitidRequest(params), RequestOptions.none(), START_MITID_RESPONSE); + } + + /** + * {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBankidSeRequest(params), options, START_BANKID_SE_RESPONSE); + } + + /** + * Asynchronous {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startBankidSeAsync(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBankidSeRequest(params), options, START_BANKID_SE_RESPONSE); + } + + /** + * {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params) { + return client.execute(startBankidSeRequest(params), RequestOptions.none(), START_BANKID_SE_RESPONSE); + } + + /** + * Asynchronous {@link #startBankidSe(DigitalIdWalletApiBankidSeWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startBankidSeAsync(DigitalIdWalletApiBankidSeWalletVerificationStartRequest params) { + return client.executeAsync(startBankidSeRequest(params), RequestOptions.none(), START_BANKID_SE_RESPONSE); + } + + /** + * {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBankidNoRequest(params), options, START_BANKID_NO_RESPONSE); + } + + /** + * Asynchronous {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startBankidNoAsync(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBankidNoRequest(params), options, START_BANKID_NO_RESPONSE); + } + + /** + * {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params) { + return client.execute(startBankidNoRequest(params), RequestOptions.none(), START_BANKID_NO_RESPONSE); + } + + /** + * Asynchronous {@link #startBankidNo(DigitalIdWalletApiBankidNoWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startBankidNoAsync(DigitalIdWalletApiBankidNoWalletVerificationStartRequest params) { + return client.executeAsync(startBankidNoRequest(params), RequestOptions.none(), START_BANKID_NO_RESPONSE); + } + + /** + * {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startVippsRequest(params), options, START_VIPPS_RESPONSE); + } + + /** + * Asynchronous {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startVippsAsync(DigitalIdWalletApiVippsWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startVippsRequest(params), options, START_VIPPS_RESPONSE); + } + + /** + * {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest params) { + return client.execute(startVippsRequest(params), RequestOptions.none(), START_VIPPS_RESPONSE); + } + + /** + * Asynchronous {@link #startVipps(DigitalIdWalletApiVippsWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startVippsAsync(DigitalIdWalletApiVippsWalletVerificationStartRequest params) { + return client.executeAsync(startVippsRequest(params), RequestOptions.none(), START_VIPPS_RESPONSE); + } + + /** + * {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBuypassRequest(params), options, START_BUYPASS_RESPONSE); + } + + /** + * Asynchronous {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startBuypassAsync(DigitalIdWalletApiBuypassWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBuypassRequest(params), options, START_BUYPASS_RESPONSE); + } + + /** + * {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest params) { + return client.execute(startBuypassRequest(params), RequestOptions.none(), START_BUYPASS_RESPONSE); + } + + /** + * Asynchronous {@link #startBuypass(DigitalIdWalletApiBuypassWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startBuypassAsync(DigitalIdWalletApiBuypassWalletVerificationStartRequest params) { + return client.executeAsync(startBuypassRequest(params), RequestOptions.none(), START_BUYPASS_RESPONSE); + } + + /** + * {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startItsmeRequest(params), options, START_ITSME_RESPONSE); + } + + /** + * Asynchronous {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startItsmeAsync(DigitalIdWalletApiItsmeWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startItsmeRequest(params), options, START_ITSME_RESPONSE); + } + + /** + * {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest params) { + return client.execute(startItsmeRequest(params), RequestOptions.none(), START_ITSME_RESPONSE); + } + + /** + * Asynchronous {@link #startItsme(DigitalIdWalletApiItsmeWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startItsmeAsync(DigitalIdWalletApiItsmeWalletVerificationStartRequest params) { + return client.executeAsync(startItsmeRequest(params), RequestOptions.none(), START_ITSME_RESPONSE); + } + + /** + * {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startIdinRequest(params), options, START_IDIN_RESPONSE); + } + + /** + * Asynchronous {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startIdinAsync(DigitalIdWalletApiIdinWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startIdinRequest(params), options, START_IDIN_RESPONSE); + } + + /** + * {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest params) { + return client.execute(startIdinRequest(params), RequestOptions.none(), START_IDIN_RESPONSE); + } + + /** + * Asynchronous {@link #startIdin(DigitalIdWalletApiIdinWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startIdinAsync(DigitalIdWalletApiIdinWalletVerificationStartRequest params) { + return client.executeAsync(startIdinRequest(params), RequestOptions.none(), START_IDIN_RESPONSE); + } + + /** + * {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startFtnRequest(params), options, START_FTN_RESPONSE); + } + + /** + * Asynchronous {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startFtnAsync(DigitalIdWalletApiFtnWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startFtnRequest(params), options, START_FTN_RESPONSE); + } + + /** + * {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest params) { + return client.execute(startFtnRequest(params), RequestOptions.none(), START_FTN_RESPONSE); + } + + /** + * Asynchronous {@link #startFtn(DigitalIdWalletApiFtnWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startFtnAsync(DigitalIdWalletApiFtnWalletVerificationStartRequest params) { + return client.executeAsync(startFtnRequest(params), RequestOptions.none(), START_FTN_RESPONSE); + } + + /** + * {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startPersonalausweisRequest(params), options, START_PERSONALAUSWEIS_RESPONSE); + } + + /** + * Asynchronous {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startPersonalausweisAsync(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startPersonalausweisRequest(params), options, START_PERSONALAUSWEIS_RESPONSE); + } + + /** + * {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params) { + return client.execute(startPersonalausweisRequest(params), RequestOptions.none(), START_PERSONALAUSWEIS_RESPONSE); + } + + /** + * Asynchronous {@link #startPersonalausweis(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startPersonalausweisAsync(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params) { + return client.executeAsync(startPersonalausweisRequest(params), RequestOptions.none(), START_PERSONALAUSWEIS_RESPONSE); + } + + /** + * {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startFrejaidRequest(params), options, START_FREJAID_RESPONSE); + } + + /** + * Asynchronous {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startFrejaidAsync(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startFrejaidRequest(params), options, START_FREJAID_RESPONSE); + } + + /** + * {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params) { + return client.execute(startFrejaidRequest(params), RequestOptions.none(), START_FREJAID_RESPONSE); + } + + /** + * Asynchronous {@link #startFrejaid(DigitalIdWalletApiFrejaidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startFrejaidAsync(DigitalIdWalletApiFrejaidWalletVerificationStartRequest params) { + return client.executeAsync(startFrejaidRequest(params), RequestOptions.none(), START_FREJAID_RESPONSE); + } + + /** + * {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startUaePassRequest(params), options, START_UAE_PASS_RESPONSE); + } + + /** + * Asynchronous {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startUaePassAsync(DigitalIdWalletApiUaePassWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startUaePassRequest(params), options, START_UAE_PASS_RESPONSE); + } + + /** + * {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest params) { + return client.execute(startUaePassRequest(params), RequestOptions.none(), START_UAE_PASS_RESPONSE); + } + + /** + * Asynchronous {@link #startUaePass(DigitalIdWalletApiUaePassWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startUaePassAsync(DigitalIdWalletApiUaePassWalletVerificationStartRequest params) { + return client.executeAsync(startUaePassRequest(params), RequestOptions.none(), START_UAE_PASS_RESPONSE); + } + + /** + * {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startGovbrRequest(params), options, START_GOVBR_RESPONSE); + } + + /** + * Asynchronous {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startGovbrAsync(DigitalIdWalletApiGovbrWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startGovbrRequest(params), options, START_GOVBR_RESPONSE); + } + + /** + * {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest params) { + return client.execute(startGovbrRequest(params), RequestOptions.none(), START_GOVBR_RESPONSE); + } + + /** + * Asynchronous {@link #startGovbr(DigitalIdWalletApiGovbrWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startGovbrAsync(DigitalIdWalletApiGovbrWalletVerificationStartRequest params) { + return client.executeAsync(startGovbrRequest(params), RequestOptions.none(), START_GOVBR_RESPONSE); + } + + /** + * {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startOneidRequest(params), options, START_ONEID_RESPONSE); + } + + /** + * Asynchronous {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startOneidAsync(DigitalIdWalletApiOneidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startOneidRequest(params), options, START_ONEID_RESPONSE); + } + + /** + * {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest params) { + return client.execute(startOneidRequest(params), RequestOptions.none(), START_ONEID_RESPONSE); + } + + /** + * Asynchronous {@link #startOneid(DigitalIdWalletApiOneidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startOneidAsync(DigitalIdWalletApiOneidWalletVerificationStartRequest params) { + return client.executeAsync(startOneidRequest(params), RequestOptions.none(), START_ONEID_RESPONSE); + } + + /** + * {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startGovukWalletRequest(params), options, START_GOVUK_WALLET_RESPONSE); + } + + /** + * Asynchronous {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startGovukWalletAsync(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startGovukWalletRequest(params), options, START_GOVUK_WALLET_RESPONSE); + } + + /** + * {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params) { + return client.execute(startGovukWalletRequest(params), RequestOptions.none(), START_GOVUK_WALLET_RESPONSE); + } + + /** + * Asynchronous {@link #startGovukWallet(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startGovukWalletAsync(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params) { + return client.executeAsync(startGovukWalletRequest(params), RequestOptions.none(), START_GOVUK_WALLET_RESPONSE); + } + + /** + * {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startSmartIdRequest(params), options, START_SMART_ID_RESPONSE); + } + + /** + * Asynchronous {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startSmartIdAsync(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startSmartIdRequest(params), options, START_SMART_ID_RESPONSE); + } + + /** + * {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params) { + return client.execute(startSmartIdRequest(params), RequestOptions.none(), START_SMART_ID_RESPONSE); + } + + /** + * Asynchronous {@link #startSmartId(DigitalIdWalletApiSmartIdWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startSmartIdAsync(DigitalIdWalletApiSmartIdWalletVerificationStartRequest params) { + return client.executeAsync(startSmartIdRequest(params), RequestOptions.none(), START_SMART_ID_RESPONSE); + } + + /** + * {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startMobileIdRequest(params), options, START_MOBILE_ID_RESPONSE); + } + + /** + * Asynchronous {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startMobileIdAsync(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startMobileIdRequest(params), options, START_MOBILE_ID_RESPONSE); + } + + /** + * {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params) { + return client.execute(startMobileIdRequest(params), RequestOptions.none(), START_MOBILE_ID_RESPONSE); + } + + /** + * Asynchronous {@link #startMobileId(DigitalIdWalletApiMobileIdWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startMobileIdAsync(DigitalIdWalletApiMobileIdWalletVerificationStartRequest params) { + return client.executeAsync(startMobileIdRequest(params), RequestOptions.none(), START_MOBILE_ID_RESPONSE); + } + + /** + * {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startIdcardEeRequest(params), options, START_IDCARD_EE_RESPONSE); + } + + /** + * Asynchronous {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startIdcardEeAsync(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startIdcardEeRequest(params), options, START_IDCARD_EE_RESPONSE); + } + + /** + * {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params) { + return client.execute(startIdcardEeRequest(params), RequestOptions.none(), START_IDCARD_EE_RESPONSE); + } + + /** + * Asynchronous {@link #startIdcardEe(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startIdcardEeAsync(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params) { + return client.executeAsync(startIdcardEeRequest(params), RequestOptions.none(), START_IDCARD_EE_RESPONSE); + } + + /** + * {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startEparakstsMobileRequest(params), options, START_EPARAKSTS_MOBILE_RESPONSE); + } + + /** + * Asynchronous {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startEparakstsMobileAsync(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startEparakstsMobileRequest(params), options, START_EPARAKSTS_MOBILE_RESPONSE); + } + + /** + * {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params) { + return client.execute(startEparakstsMobileRequest(params), RequestOptions.none(), START_EPARAKSTS_MOBILE_RESPONSE); + } + + /** + * Asynchronous {@link #startEparakstsMobile(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startEparakstsMobileAsync(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params) { + return client.executeAsync(startEparakstsMobileRequest(params), RequestOptions.none(), START_EPARAKSTS_MOBILE_RESPONSE); + } + + /** + * {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startBankidCzRequest(params), options, START_BANKID_CZ_RESPONSE); + } + + /** + * Asynchronous {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startBankidCzAsync(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startBankidCzRequest(params), options, START_BANKID_CZ_RESPONSE); + } + + /** + * {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params) { + return client.execute(startBankidCzRequest(params), RequestOptions.none(), START_BANKID_CZ_RESPONSE); + } + + /** + * Asynchronous {@link #startBankidCz(DigitalIdWalletApiBankidCzWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startBankidCzAsync(DigitalIdWalletApiBankidCzWalletVerificationStartRequest params) { + return client.executeAsync(startBankidCzRequest(params), RequestOptions.none(), START_BANKID_CZ_RESPONSE); + } + + /** + * {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startMojeidRequest(params), options, START_MOJEID_RESPONSE); + } + + /** + * Asynchronous {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startMojeidAsync(DigitalIdWalletApiMojeidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startMojeidRequest(params), options, START_MOJEID_RESPONSE); + } + + /** + * {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest params) { + return client.execute(startMojeidRequest(params), RequestOptions.none(), START_MOJEID_RESPONSE); + } + + /** + * Asynchronous {@link #startMojeid(DigitalIdWalletApiMojeidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startMojeidAsync(DigitalIdWalletApiMojeidWalletVerificationStartRequest params) { + return client.executeAsync(startMojeidRequest(params), RequestOptions.none(), START_MOJEID_RESPONSE); + } + + /** + * {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startDiiaRequest(params), options, START_DIIA_RESPONSE); + } + + /** + * Asynchronous {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startDiiaAsync(DigitalIdWalletApiDiiaWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startDiiaRequest(params), options, START_DIIA_RESPONSE); + } + + /** + * {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest params) { + return client.execute(startDiiaRequest(params), RequestOptions.none(), START_DIIA_RESPONSE); + } + + /** + * Asynchronous {@link #startDiia(DigitalIdWalletApiDiiaWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startDiiaAsync(DigitalIdWalletApiDiiaWalletVerificationStartRequest params) { + return client.executeAsync(startDiiaRequest(params), RequestOptions.none(), START_DIIA_RESPONSE); + } + + /** + * {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startFranceconnectRequest(params), options, START_FRANCECONNECT_RESPONSE); + } + + /** + * Asynchronous {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startFranceconnectAsync(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startFranceconnectRequest(params), options, START_FRANCECONNECT_RESPONSE); + } + + /** + * {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params) { + return client.execute(startFranceconnectRequest(params), RequestOptions.none(), START_FRANCECONNECT_RESPONSE); + } + + /** + * Asynchronous {@link #startFranceconnect(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startFranceconnectAsync(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params) { + return client.executeAsync(startFranceconnectRequest(params), RequestOptions.none(), START_FRANCECONNECT_RESPONSE); + } + + /** + * {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startAudkenniRequest(params), options, START_AUDKENNI_RESPONSE); + } + + /** + * Asynchronous {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startAudkenniAsync(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startAudkenniRequest(params), options, START_AUDKENNI_RESPONSE); + } + + /** + * {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params) { + return client.execute(startAudkenniRequest(params), RequestOptions.none(), START_AUDKENNI_RESPONSE); + } + + /** + * Asynchronous {@link #startAudkenni(DigitalIdWalletApiAudkenniWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startAudkenniAsync(DigitalIdWalletApiAudkenniWalletVerificationStartRequest params) { + return client.executeAsync(startAudkenniRequest(params), RequestOptions.none(), START_AUDKENNI_RESPONSE); + } + + /** + * {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startConnectidRequest(params), options, START_CONNECTID_RESPONSE); + } + + /** + * Asynchronous {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startConnectidAsync(DigitalIdWalletApiConnectidWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startConnectidRequest(params), options, START_CONNECTID_RESPONSE); + } + + /** + * {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest params) { + return client.execute(startConnectidRequest(params), RequestOptions.none(), START_CONNECTID_RESPONSE); + } + + /** + * Asynchronous {@link #startConnectid(DigitalIdWalletApiConnectidWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startConnectidAsync(DigitalIdWalletApiConnectidWalletVerificationStartRequest params) { + return client.executeAsync(startConnectidRequest(params), RequestOptions.none(), START_CONNECTID_RESPONSE); + } + + /** + * {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest params, RequestOptions options) { + return client.execute(startEudiRequest(params), options, START_EUDI_RESPONSE); + } + + /** + * Asynchronous {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> startEudiAsync(DigitalIdWalletApiEudiWalletVerificationStartRequest params, RequestOptions options) { + return client.executeAsync(startEudiRequest(params), options, START_EUDI_RESPONSE); + } + + /** + * {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest params) { + return client.execute(startEudiRequest(params), RequestOptions.none(), START_EUDI_RESPONSE); + } + + /** + * Asynchronous {@link #startEudi(DigitalIdWalletApiEudiWalletVerificationStartRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> startEudiAsync(DigitalIdWalletApiEudiWalletVerificationStartRequest params) { + return client.executeAsync(startEudiRequest(params), RequestOptions.none(), START_EUDI_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/IpResource.java b/src/main/java/me/didit/resources/IpResource.java new file mode 100644 index 0000000..4807c10 --- /dev/null +++ b/src/main/java/me/didit/resources/IpResource.java @@ -0,0 +1,151 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.IPRiskRequest; +import me.didit.types.IPRiskResponse; + +/** The {@code ip} resource: {@code client.ip()}. */ +public final class IpResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + IpResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Risk-score an IP address + * + *

Return geolocation, network ownership, VPN/Tor and data-center flags, threat data, and country_mismatch for a supplied IP address. The endpoint creates an API session and returns its id as request_id. + * + *

Decision. status is In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise it is Approved. + * + *

Best effort. IP enrichment is best effort. If no enrichment source returns usable data, the endpoint returns an approved response with ip.ip_address: null, ip.country_mismatch: null, and an empty ip.threat object. + * + *

Billing. Live calls use IP Risk API pricing. The request is billable once the lookup starts. + * + *

Sandbox. Sandbox keys validate the request and return deterministic approved data without consuming credits, creating a session, or contributing to Networks. + * + *

Authentication. Send your application's API key in x-api-key. Missing or invalid credentials return 403 - this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests per minute per API key across all POST/PATCH/DELETE endpoints. + * + *

{@code POST /v3/ip/risk/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public IPRiskResponse assessRisk(IPRiskRequest params, RequestOptions options) { + return client.execute(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assessRisk(IPRiskRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture assessRiskAsync(IPRiskRequest params, RequestOptions options) { + return client.executeAsync(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #assessRisk(IPRiskRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public IPRiskResponse assessRisk(IPRiskRequest params) { + return client.execute(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assessRisk(IPRiskRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture assessRiskAsync(IPRiskRequest params) { + return client.executeAsync(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler ASSESS_RISK_RESPONSE = Responses.json(Conv.model(IPRiskResponse::fromJson)); + + private static ApiRequest assessRiskRequest(IPRiskRequest params) { + return ApiRequest.builder("POST", "/v3/ip/risk/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code ip} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #assessRisk(IPRiskRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse assessRisk(IPRiskRequest params, RequestOptions options) { + return client.execute(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE); + } + + /** + * Asynchronous {@link #assessRisk(IPRiskRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> assessRiskAsync(IPRiskRequest params, RequestOptions options) { + return client.executeAsync(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE); + } + + /** + * {@link #assessRisk(IPRiskRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse assessRisk(IPRiskRequest params) { + return client.execute(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE); + } + + /** + * Asynchronous {@link #assessRisk(IPRiskRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> assessRiskAsync(IPRiskRequest params) { + return client.executeAsync(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/KybResource.java b/src/main/java/me/didit/resources/KybResource.java new file mode 100644 index 0000000..d39863a --- /dev/null +++ b/src/main/java/me/didit/resources/KybResource.java @@ -0,0 +1,470 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.KybListShareholdersParams; +import me.didit.types.KybListShareholdersResponse; +import me.didit.types.KybListUbosParams; +import me.didit.types.KybListUbosResponse; +import me.didit.types.KybSearchParams; +import me.didit.types.KybSearchResponse; +import me.didit.types.KybSelectParams; +import me.didit.types.KybSelectResponse; + +/** The {@code kyb} resource: {@code client.kyb()}. */ +public final class KybResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + KybResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * KYB registry company search (standalone) + * + *

Search official company registries for candidate companies by name and/or registration number. This is step 1 of the two-step registry flow: search returns lightweight candidates, then POST /v3/kyb/select/ retrieves the full profile of one candidate. + * + *

Search billing. Successful searches using a paid company-data source cost USD 0.50 per request, regardless of candidate count. Empty results, failures and results served only by other sources are not charged. The applicable price is reserved before searching; insufficient balance returns 403 with code insufficient_credits. Contract rates apply where agreed, and an unconfigured contract search rate returns 403. Sandbox searches are free. Repeating a successful search can incur another charge; callback delivery does not add a charge. Profile retrieval is billed separately. This search fee also applies to v2. Candidates always come back with fetch_status: "pending": the full company data is only fetched (and billed) on select. + * + *

**kyb_response_id is ephemeral.** It is a per-search handle, not a stable company id. Select promptly after searching and re-search to get a fresh handle instead of storing it. + * + *

Two modes. + * - *Synchronous (default):* the API polls the registry until the search resolves and returns the final candidate list (search_resolved: true). + * - *Asynchronous:* pass webhook_url and the API returns immediately โ€” usually with search_status: "pending" and an empty candidate list โ€” then POSTs a kyb.registry_search.resolved callback to your URL when the registry finishes. The callback body is {"event_id", "event_type": "kyb.registry_search.resolved", "request_id", "vendor_data", "metadata", "search_status", "search_resolved", "kyb_registry", "timestamp", "created_at"} โ€” note timestamp and created_at in the callback are epoch integers, unlike this endpoint's ISO created_at โ€” and is sent unsigned (header X-Didit-Unsigned-Callback: true, no X-Signature). + * + *

Country codes. ISO 3166-1 alpha-2 (GB, DE), plus XX-YY subdivision codes where registries are regional โ€” e.g. US-CA for California. + * + *

Sandbox. Keys from sandbox applications return one static candidate without contacting any registry. + * + *

{@code POST /v3/kyb/search/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public KybSearchResponse search(KybSearchParams params, RequestOptions options) { + return client.execute(searchRequest(params), options, SEARCH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #search(KybSearchParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture searchAsync(KybSearchParams params, RequestOptions options) { + return client.executeAsync(searchRequest(params), options, SEARCH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #search(KybSearchParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public KybSearchResponse search(KybSearchParams params) { + return client.execute(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #search(KybSearchParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture searchAsync(KybSearchParams params) { + return client.executeAsync(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * KYB registry company select โ€” Lite tier (standalone) + * + *

Retrieve the Lite registry profile of one candidate returned by POST /v3/kyb/search/ โ€” company details, registered address, identifiers, status, activity and the officers, plus the raw registry payload. Shareholders and ultimate beneficial owners are sold by POST /v3/kyb/shareholders/ and POST /v3/kyb/ubo/. + * + *

Pairing with search. Pass the candidate's kyb_response_id exactly as returned by a search of the same application. The handle is ephemeral and scoped to that search โ€” select promptly, and re-search for a fresh handle rather than storing it. + * + *

Billing. Each select is billed at the country's Lite price (any search fee is separate); see [KYB registry pricing](/getting-started/kyb-registry-pricing). The balance is checked before any registry call (403 when short) and the charge is recorded against the created business session. + * + *

Persistence is mandatory. Every select creates a business session (its id is the request_id) so billing and retrieval can be tracked; it appears in the console. save_api_request is accepted for symmetry but must be true (the default) โ€” sending false returns 400. + * + *

{@code POST /v3/kyb/select/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public KybSelectResponse select(KybSelectParams params, RequestOptions options) { + return client.execute(selectRequest(params), options, SELECT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #select(KybSelectParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture selectAsync(KybSelectParams params, RequestOptions options) { + return client.executeAsync(selectRequest(params), options, SELECT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #select(KybSelectParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public KybSelectResponse select(KybSelectParams params) { + return client.execute(selectRequest(params), RequestOptions.none(), SELECT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #select(KybSelectParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture selectAsync(KybSelectParams params) { + return client.executeAsync(selectRequest(params), RequestOptions.none(), SELECT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * KYB registry company with shareholders (standalone) + * + *

Retrieve the Lite profile plus the direct shareholders (natural persons and corporate entities, with their ownership bands) of one candidate returned by POST /v3/kyb/search/. + * + *

Pairing with search. Pass the candidate's kyb_response_id exactly as returned by a search of the same application. The search runs on the Lite registry chain; when the country's ownership data lives at another registry Didit re-finds the company there by registration number, at no extra cost. + * + *

Billing. Billed at the country's Shareholders price - see [KYB registry pricing](/getting-started/kyb-registry-pricing). When the registry holds no shareholder record for the company (or the country offers no ownership data at all) the Lite profile is delivered and billed instead: read registry_tier_delivered and registry_ownership_status. The balance is checked against the Shareholders price before any registry call (403 when short). + * + *

Availability. v3 only. Every call creates a business session (its id is the request_id). + * + *

Pending reports. When a report is still being prepared, or the ownership section has not been retrieved from the registry yet, the endpoint returns 202 Accepted, kyb_registry.fetch_status=pending, kyb_registry.registry_ownership_status=pending, and registry_tier_delivered=null. Keep request_id and retrieve GET /v3/session/{request_id}/decision/ until registry_checks[0].company.fetch_status is resolved. Didit completes the report automatically and charges the delivered tier once it is ready. Do not repeat the purchase while it is pending; every new POST creates a separate request. + * + *

{@code POST /v3/kyb/shareholders/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public KybListShareholdersResponse listShareholders(KybListShareholdersParams params, RequestOptions options) { + return client.execute(listShareholdersRequest(params), options, LIST_SHAREHOLDERS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listShareholders(KybListShareholdersParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listShareholdersAsync(KybListShareholdersParams params, RequestOptions options) { + return client.executeAsync(listShareholdersRequest(params), options, LIST_SHAREHOLDERS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listShareholders(KybListShareholdersParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public KybListShareholdersResponse listShareholders(KybListShareholdersParams params) { + return client.execute(listShareholdersRequest(params), RequestOptions.none(), LIST_SHAREHOLDERS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listShareholders(KybListShareholdersParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture listShareholdersAsync(KybListShareholdersParams params) { + return client.executeAsync(listShareholdersRequest(params), RequestOptions.none(), LIST_SHAREHOLDERS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * KYB registry company with ultimate beneficial owners (standalone) + * + *

Retrieve the Lite profile, the direct shareholders and the ultimate beneficial owners resolved through the ownership chain (registry_data.ubo_resolution carries the corporate parent chain) of one candidate returned by POST /v3/kyb/search/. + * + *

Pairing with search. Pass the candidate's kyb_response_id exactly as returned by a search of the same application. The search runs on the Lite registry chain; when the country's ownership data lives at another registry Didit re-finds the company there by registration number, at no extra cost. + * + *

Billing. Billed at the country's UBO price - see [KYB registry pricing](/getting-started/kyb-registry-pricing). The tier delivered is the highest the country and the registry can serve: Shareholders when the resolved report names no natural person as a beneficial owner, Lite when there is no ownership record at all; registry_tier_delivered names what was billed. The balance is checked against the UBO price before any registry call (403 when short). + * + *

Availability. v3 only. Every call creates a business session (its id is the request_id). + * + *

Pending reports. When a report is still being prepared, or the ownership section has not been retrieved from the registry yet, the endpoint returns 202 Accepted, kyb_registry.fetch_status=pending, kyb_registry.registry_ownership_status=pending, and registry_tier_delivered=null. Keep request_id and retrieve GET /v3/session/{request_id}/decision/ until registry_checks[0].company.fetch_status is resolved. Didit completes the report automatically and charges the delivered tier once it is ready. Do not repeat the purchase while it is pending; every new POST creates a separate request. + * + *

{@code POST /v3/kyb/ubo/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public KybListUbosResponse listUbos(KybListUbosParams params, RequestOptions options) { + return client.execute(listUbosRequest(params), options, LIST_UBOS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listUbos(KybListUbosParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listUbosAsync(KybListUbosParams params, RequestOptions options) { + return client.executeAsync(listUbosRequest(params), options, LIST_UBOS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listUbos(KybListUbosParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public KybListUbosResponse listUbos(KybListUbosParams params) { + return client.execute(listUbosRequest(params), RequestOptions.none(), LIST_UBOS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listUbos(KybListUbosParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture listUbosAsync(KybListUbosParams params) { + return client.executeAsync(listUbosRequest(params), RequestOptions.none(), LIST_UBOS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler SEARCH_RESPONSE = Responses.json(Conv.model(KybSearchResponse::fromJson)); + + private static ApiRequest searchRequest(KybSearchParams params) { + return ApiRequest.builder("POST", "/v3/kyb/search/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SELECT_RESPONSE = Responses.json(Conv.model(KybSelectResponse::fromJson)); + + private static ApiRequest selectRequest(KybSelectParams params) { + return ApiRequest.builder("POST", "/v3/kyb/select/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LIST_SHAREHOLDERS_RESPONSE = Responses.json(Conv.model(KybListShareholdersResponse::fromJson)); + + private static ApiRequest listShareholdersRequest(KybListShareholdersParams params) { + return ApiRequest.builder("POST", "/v3/kyb/shareholders/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LIST_UBOS_RESPONSE = Responses.json(Conv.model(KybListUbosResponse::fromJson)); + + private static ApiRequest listUbosRequest(KybListUbosParams params) { + return ApiRequest.builder("POST", "/v3/kyb/ubo/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code kyb} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #search(KybSearchParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse search(KybSearchParams params, RequestOptions options) { + return client.execute(searchRequest(params), options, SEARCH_RESPONSE); + } + + /** + * Asynchronous {@link #search(KybSearchParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> searchAsync(KybSearchParams params, RequestOptions options) { + return client.executeAsync(searchRequest(params), options, SEARCH_RESPONSE); + } + + /** + * {@link #search(KybSearchParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse search(KybSearchParams params) { + return client.execute(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE); + } + + /** + * Asynchronous {@link #search(KybSearchParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> searchAsync(KybSearchParams params) { + return client.executeAsync(searchRequest(params), RequestOptions.none(), SEARCH_RESPONSE); + } + + /** + * {@link #select(KybSelectParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse select(KybSelectParams params, RequestOptions options) { + return client.execute(selectRequest(params), options, SELECT_RESPONSE); + } + + /** + * Asynchronous {@link #select(KybSelectParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> selectAsync(KybSelectParams params, RequestOptions options) { + return client.executeAsync(selectRequest(params), options, SELECT_RESPONSE); + } + + /** + * {@link #select(KybSelectParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse select(KybSelectParams params) { + return client.execute(selectRequest(params), RequestOptions.none(), SELECT_RESPONSE); + } + + /** + * Asynchronous {@link #select(KybSelectParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> selectAsync(KybSelectParams params) { + return client.executeAsync(selectRequest(params), RequestOptions.none(), SELECT_RESPONSE); + } + + /** + * {@link #listShareholders(KybListShareholdersParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse listShareholders(KybListShareholdersParams params, RequestOptions options) { + return client.execute(listShareholdersRequest(params), options, LIST_SHAREHOLDERS_RESPONSE); + } + + /** + * Asynchronous {@link #listShareholders(KybListShareholdersParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listShareholdersAsync(KybListShareholdersParams params, RequestOptions options) { + return client.executeAsync(listShareholdersRequest(params), options, LIST_SHAREHOLDERS_RESPONSE); + } + + /** + * {@link #listShareholders(KybListShareholdersParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse listShareholders(KybListShareholdersParams params) { + return client.execute(listShareholdersRequest(params), RequestOptions.none(), LIST_SHAREHOLDERS_RESPONSE); + } + + /** + * Asynchronous {@link #listShareholders(KybListShareholdersParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listShareholdersAsync(KybListShareholdersParams params) { + return client.executeAsync(listShareholdersRequest(params), RequestOptions.none(), LIST_SHAREHOLDERS_RESPONSE); + } + + /** + * {@link #listUbos(KybListUbosParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse listUbos(KybListUbosParams params, RequestOptions options) { + return client.execute(listUbosRequest(params), options, LIST_UBOS_RESPONSE); + } + + /** + * Asynchronous {@link #listUbos(KybListUbosParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listUbosAsync(KybListUbosParams params, RequestOptions options) { + return client.executeAsync(listUbosRequest(params), options, LIST_UBOS_RESPONSE); + } + + /** + * {@link #listUbos(KybListUbosParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse listUbos(KybListUbosParams params) { + return client.execute(listUbosRequest(params), RequestOptions.none(), LIST_UBOS_RESPONSE); + } + + /** + * Asynchronous {@link #listUbos(KybListUbosParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listUbosAsync(KybListUbosParams params) { + return client.executeAsync(listUbosRequest(params), RequestOptions.none(), LIST_UBOS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/NetworksNotesResource.java b/src/main/java/me/didit/resources/NetworksNotesResource.java new file mode 100644 index 0000000..dd92fab --- /dev/null +++ b/src/main/java/me/didit/resources/NetworksNotesResource.java @@ -0,0 +1,451 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.NetworkNote; +import me.didit.types.NetworksNotesCreateParams; +import me.didit.types.NetworksNotesListParams; +import org.jspecify.annotations.Nullable; + +/** The {@code networks.notes} resource: {@code client.networks().notes()}. */ +public final class NetworksNotesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + NetworksNotesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Delete your network note + * + *

Requires write:networks and the authenticated author of the note. Deletion is irreversible. Connected account and verification data are unaffected. + * + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/notes/{note_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param noteUuid the {@code note_uuid} + * @param options per-request options that override the client options + */ + public void delete(String networkUuid, String noteUuid, RequestOptions options) { + client.execute(deleteRequest(networkUuid, noteUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String networkUuid, String noteUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(networkUuid, noteUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + */ + public void delete(String networkUuid, String noteUuid) { + client.execute(deleteRequest(networkUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String networkUuid, String noteUuid) { + return client.executeAsync(deleteRequest(networkUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * List private network notes + * + *

Console users with read:networks can read notes on a network visible to the application. Notes stay within the organization and are not contributed to shared intelligence. Newest notes appear first. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/notes/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param networkUuid Network UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(String networkUuid, NetworksNotesListParams params, RequestOptions options) { + return client.execute(listRequest(networkUuid, params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String networkUuid, NetworksNotesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(networkUuid, params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, NetworksNotesListParams, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return the result + */ + public Page list(String networkUuid, NetworksNotesListParams params) { + return client.execute(listRequest(networkUuid, params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String networkUuid, NetworksNotesListParams params) { + return client.executeAsync(listRequest(networkUuid, params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, NetworksNotesListParams, RequestOptions)}, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public Page list(String networkUuid, RequestOptions options) { + return client.execute(listRequest(networkUuid, NetworksNotesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)}, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(listRequest(networkUuid, NetworksNotesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, NetworksNotesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public Page list(String networkUuid) { + return client.execute(listRequest(networkUuid, NetworksNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String networkUuid) { + return client.executeAsync(listRequest(networkUuid, NetworksNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Add a private network note + * + *

Requires a console user with write:networks. The author is assigned from the authenticated user. Supply a new random UUID client_reference for each note; retry the same body and reference after an uncertain response to avoid duplicates. Reusing a reference for another body, author or network returns 409. Notes follow the surviving investigation when networks merge. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/notes/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public NetworkNote create(String networkUuid, NetworksNotesCreateParams params, RequestOptions options) { + return client.execute(createRequest(networkUuid, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, NetworksNotesCreateParams, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String networkUuid, NetworksNotesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(networkUuid, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, NetworksNotesCreateParams, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return the result + */ + public NetworkNote create(String networkUuid, NetworksNotesCreateParams params) { + return client.execute(createRequest(networkUuid, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, NetworksNotesCreateParams, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String networkUuid, NetworksNotesCreateParams params) { + return client.executeAsync(createRequest(networkUuid, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String networkUuid, String noteUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/notes/{note_uuid}/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .pathParam("note_uuid", noteUuid) + .build(); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(NetworkNote::fromJson)); + + private static ApiRequest listRequest(String networkUuid, NetworksNotesListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/notes/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(NetworkNote::fromJson)); + + private static ApiRequest createRequest(String networkUuid, NetworksNotesCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/notes/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code networks.notes} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #delete(String, String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String networkUuid, String noteUuid, RequestOptions options) { + return client.execute(deleteRequest(networkUuid, noteUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String networkUuid, String noteUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(networkUuid, noteUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String networkUuid, String noteUuid) { + return client.execute(deleteRequest(networkUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param noteUuid the {@code note_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String networkUuid, String noteUuid) { + return client.executeAsync(deleteRequest(networkUuid, noteUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(String networkUuid, NetworksNotesListParams params, RequestOptions options) { + return client.execute(listRequest(networkUuid, params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String networkUuid, NetworksNotesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(networkUuid, params), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> list(String networkUuid, NetworksNotesListParams params) { + return client.execute(listRequest(networkUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String networkUuid, NetworksNotesListParams params) { + return client.executeAsync(listRequest(networkUuid, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String networkUuid, RequestOptions options) { + return client.execute(listRequest(networkUuid, NetworksNotesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(listRequest(networkUuid, NetworksNotesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse> list(String networkUuid) { + return client.execute(listRequest(networkUuid, NetworksNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, NetworksNotesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String networkUuid) { + return client.executeAsync(listRequest(networkUuid, NetworksNotesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, NetworksNotesCreateParams, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String networkUuid, NetworksNotesCreateParams params, RequestOptions options) { + return client.execute(createRequest(networkUuid, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, NetworksNotesCreateParams, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String networkUuid, NetworksNotesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(networkUuid, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, NetworksNotesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String networkUuid, NetworksNotesCreateParams params) { + return client.execute(createRequest(networkUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, NetworksNotesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String networkUuid, NetworksNotesCreateParams params) { + return client.executeAsync(createRequest(networkUuid, params), RequestOptions.none(), CREATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/NetworksResource.java b/src/main/java/me/didit/resources/NetworksResource.java new file mode 100644 index 0000000..6908c42 --- /dev/null +++ b/src/main/java/me/didit/resources/NetworksResource.java @@ -0,0 +1,1020 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.BinaryResponse; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.NetworkDetail; +import me.didit.types.NetworkGraph; +import me.didit.types.NetworkListItem; +import me.didit.types.NetworkMap; +import me.didit.types.NetworksListMembersResponse; +import me.didit.types.NetworksListParams; +import me.didit.types.NetworksListSignalsResponse; +import me.didit.types.NetworksRetrieveGraphParams; +import me.didit.types.NetworksRetrieveTimelineResponse; + +/** The {@code networks} resource: {@code client.networks()}. */ +public final class NetworksResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + private final NetworksNotesResource notes; + + NetworksResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + this.notes = new NetworksNotesResource(client); + } + + /** + * The {@code networks.notes} resource. + * + * @return the resource + */ + public NetworksNotesResource notes() { + return notes; + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List networks + * + *

List fraud networks detected within this application's organization, newest activity first by default. By default dismissed networks are excluded; pass status to include them. Sandbox applications never have networks - clustering excludes sandbox data entirely. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(NetworksListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(NetworksListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(NetworksListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(NetworksListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(NetworksListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(NetworksListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(NetworksListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(NetworksListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(NetworksListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(NetworksListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(NetworksListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get network + * + *

Retrieve a single network's full detail, including stats, fraud tags, and risk signals. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public NetworkDetail retrieve(String networkUuid, RequestOptions options) { + return client.execute(retrieveRequest(networkUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(networkUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public NetworkDetail retrieve(String networkUuid) { + return client.execute(retrieveRequest(networkUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String networkUuid) { + return client.executeAsync(retrieveRequest(networkUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get network graph + * + *

Retrieve the network as a graph of subject nodes (vendor users, vendor businesses, transaction parties) and signal nodes (the shared device/IP/face/document/phone/email/address values linking them), with edges representing memberships. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/graph/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public NetworkGraph retrieveGraph(String networkUuid, NetworksRetrieveGraphParams params, RequestOptions options) { + return client.execute(retrieveGraphRequest(networkUuid, params), options, RETRIEVE_GRAPH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveGraphAsync(String networkUuid, NetworksRetrieveGraphParams params, RequestOptions options) { + return client.executeAsync(retrieveGraphRequest(networkUuid, params), options, RETRIEVE_GRAPH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return the result + */ + public NetworkGraph retrieveGraph(String networkUuid, NetworksRetrieveGraphParams params) { + return client.execute(retrieveGraphRequest(networkUuid, params), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture retrieveGraphAsync(String networkUuid, NetworksRetrieveGraphParams params) { + return client.executeAsync(retrieveGraphRequest(networkUuid, params), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public NetworkGraph retrieveGraph(String networkUuid, RequestOptions options) { + return client.execute(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), options, RETRIEVE_GRAPH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveGraphAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), options, RETRIEVE_GRAPH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public NetworkGraph retrieveGraph(String networkUuid) { + return client.execute(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)}, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveGraphAsync(String networkUuid) { + return client.executeAsync(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List network members + * + *

List the subjects (vendor users, vendor businesses, or transaction parties) that belong to this network. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/members/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public NetworksListMembersResponse listMembers(String networkUuid, RequestOptions options) { + return client.execute(listMembersRequest(networkUuid), options, LIST_MEMBERS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listMembers(String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listMembersAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(listMembersRequest(networkUuid), options, LIST_MEMBERS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listMembers(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public NetworksListMembersResponse listMembers(String networkUuid) { + return client.execute(listMembersRequest(networkUuid), RequestOptions.none(), LIST_MEMBERS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listMembers(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture listMembersAsync(String networkUuid) { + return client.executeAsync(listMembersRequest(networkUuid), RequestOptions.none(), LIST_MEMBERS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List network signals + * + *

List the signals (shared device, IP, face, document number, phone, email, or address values) that link this network's members. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/signals/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public NetworksListSignalsResponse listSignals(String networkUuid, RequestOptions options) { + return client.execute(listSignalsRequest(networkUuid), options, LIST_SIGNALS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listSignals(String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listSignalsAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(listSignalsRequest(networkUuid), options, LIST_SIGNALS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listSignals(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public NetworksListSignalsResponse listSignals(String networkUuid) { + return client.execute(listSignalsRequest(networkUuid), RequestOptions.none(), LIST_SIGNALS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listSignals(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture listSignalsAsync(String networkUuid) { + return client.executeAsync(listSignalsRequest(networkUuid), RequestOptions.none(), LIST_SIGNALS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get network timeline + * + *

Chronological events for this network: detection, each signal's observation, and lifecycle status changes. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/timeline/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public NetworksRetrieveTimelineResponse retrieveTimeline(String networkUuid, RequestOptions options) { + return client.execute(retrieveTimelineRequest(networkUuid), options, RETRIEVE_TIMELINE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveTimeline(String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveTimelineAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveTimelineRequest(networkUuid), options, RETRIEVE_TIMELINE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveTimeline(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public NetworksRetrieveTimelineResponse retrieveTimeline(String networkUuid) { + return client.execute(retrieveTimelineRequest(networkUuid), RequestOptions.none(), RETRIEVE_TIMELINE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveTimeline(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveTimelineAsync(String networkUuid) { + return client.executeAsync(retrieveTimelineRequest(networkUuid), RequestOptions.none(), RETRIEVE_TIMELINE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get network map + * + *

Geographic points where this network's members' addresses/locations converge, sourced from the sessions, business sessions, and transactions backing its memberships. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/map/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param networkUuid Network UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public NetworkMap retrieveMap(String networkUuid, RequestOptions options) { + return client.execute(retrieveMapRequest(networkUuid), options, RETRIEVE_MAP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveMap(String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveMapAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveMapRequest(networkUuid), options, RETRIEVE_MAP_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveMap(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public NetworkMap retrieveMap(String networkUuid) { + return client.execute(retrieveMapRequest(networkUuid), RequestOptions.none(), RETRIEVE_MAP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveMap(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveMapAsync(String networkUuid) { + return client.executeAsync(retrieveMapRequest(networkUuid), RequestOptions.none(), RETRIEVE_MAP_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Download a network evidence report + * + *

Download a PDF of the current organization network, its observed account connections, signal references and review status. Requires read:networks. Global intelligence and private analyst notes are not included. Each account and signal list is capped at 500 entries and the report states when it is incomplete. The request does not change network status. Errors are returned as JSON. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/report/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it. + * + * @param networkUuid Network UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public BinaryResponse downloadReport(String networkUuid, RequestOptions options) { + return client.execute(downloadReportRequest(networkUuid), options, DOWNLOAD_REPORT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #downloadReport(String, RequestOptions)}. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture downloadReportAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(downloadReportRequest(networkUuid), options, DOWNLOAD_REPORT_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #downloadReport(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public BinaryResponse downloadReport(String networkUuid) { + return client.execute(downloadReportRequest(networkUuid), RequestOptions.none(), DOWNLOAD_REPORT_RESPONSE).data(); + } + + /** + * Asynchronous {@link #downloadReport(String, RequestOptions)}, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture downloadReportAsync(String networkUuid) { + return client.executeAsync(downloadReportRequest(networkUuid), RequestOptions.none(), DOWNLOAD_REPORT_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(NetworkListItem::fromJson)); + + private static ApiRequest listRequest(NetworksListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/") + .applicationScoped() + .params(params) + .queryFields("status", "signal_type", "pattern_type", "risk_band", "min_size", "max_size", "date_from", "date_to", "q", "ordering", "limit", "offset") + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(NetworkDetail::fromJson)); + + private static ApiRequest retrieveRequest(String networkUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_GRAPH_RESPONSE = Responses.json(Conv.model(NetworkGraph::fromJson)); + + private static ApiRequest retrieveGraphRequest(String networkUuid, NetworksRetrieveGraphParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/graph/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .params(params) + .queryFields("depth", "focus_kind", "focus_id") + .build(); + } + + private static final ResponseHandler LIST_MEMBERS_RESPONSE = Responses.json(Conv.model(NetworksListMembersResponse::fromJson)); + + private static ApiRequest listMembersRequest(String networkUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/members/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .build(); + } + + private static final ResponseHandler LIST_SIGNALS_RESPONSE = Responses.json(Conv.model(NetworksListSignalsResponse::fromJson)); + + private static ApiRequest listSignalsRequest(String networkUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/signals/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_TIMELINE_RESPONSE = Responses.json(Conv.model(NetworksRetrieveTimelineResponse::fromJson)); + + private static ApiRequest retrieveTimelineRequest(String networkUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/timeline/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_MAP_RESPONSE = Responses.json(Conv.model(NetworkMap::fromJson)); + + private static ApiRequest retrieveMapRequest(String networkUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/map/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .build(); + } + + private static final ResponseHandler DOWNLOAD_REPORT_RESPONSE = Responses.binary(); + + private static ApiRequest downloadReportRequest(String networkUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/networks/{network_uuid}/report/") + .applicationScoped() + .pathParam("network_uuid", networkUuid) + .accept("application/pdf") + .build(); + } + + /** The {@code networks} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(NetworksListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(NetworksListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(NetworksListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(NetworksListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(NetworksListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(NetworksListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(NetworksListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(NetworksListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(NetworksListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(NetworksListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(NetworksListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(NetworksListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(NetworksListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String networkUuid, RequestOptions options) { + return client.execute(retrieveRequest(networkUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(networkUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse retrieve(String networkUuid) { + return client.execute(retrieveRequest(networkUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String networkUuid) { + return client.executeAsync(retrieveRequest(networkUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse retrieveGraph(String networkUuid, NetworksRetrieveGraphParams params, RequestOptions options) { + return client.execute(retrieveGraphRequest(networkUuid, params), options, RETRIEVE_GRAPH_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveGraphAsync(String networkUuid, NetworksRetrieveGraphParams params, RequestOptions options) { + return client.executeAsync(retrieveGraphRequest(networkUuid, params), options, RETRIEVE_GRAPH_RESPONSE); + } + + /** + * {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse retrieveGraph(String networkUuid, NetworksRetrieveGraphParams params) { + return client.execute(retrieveGraphRequest(networkUuid, params), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> retrieveGraphAsync(String networkUuid, NetworksRetrieveGraphParams params) { + return client.executeAsync(retrieveGraphRequest(networkUuid, params), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE); + } + + /** + * {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveGraph(String networkUuid, RequestOptions options) { + return client.execute(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), options, RETRIEVE_GRAPH_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response, without parameters. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveGraphAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), options, RETRIEVE_GRAPH_RESPONSE); + } + + /** + * {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse retrieveGraph(String networkUuid) { + return client.execute(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveGraph(String, NetworksRetrieveGraphParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveGraphAsync(String networkUuid) { + return client.executeAsync(retrieveGraphRequest(networkUuid, NetworksRetrieveGraphParams.builder().build()), RequestOptions.none(), RETRIEVE_GRAPH_RESPONSE); + } + + /** + * {@link #listMembers(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listMembers(String networkUuid, RequestOptions options) { + return client.execute(listMembersRequest(networkUuid), options, LIST_MEMBERS_RESPONSE); + } + + /** + * Asynchronous {@link #listMembers(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listMembersAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(listMembersRequest(networkUuid), options, LIST_MEMBERS_RESPONSE); + } + + /** + * {@link #listMembers(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse listMembers(String networkUuid) { + return client.execute(listMembersRequest(networkUuid), RequestOptions.none(), LIST_MEMBERS_RESPONSE); + } + + /** + * Asynchronous {@link #listMembers(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listMembersAsync(String networkUuid) { + return client.executeAsync(listMembersRequest(networkUuid), RequestOptions.none(), LIST_MEMBERS_RESPONSE); + } + + /** + * {@link #listSignals(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listSignals(String networkUuid, RequestOptions options) { + return client.execute(listSignalsRequest(networkUuid), options, LIST_SIGNALS_RESPONSE); + } + + /** + * Asynchronous {@link #listSignals(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listSignalsAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(listSignalsRequest(networkUuid), options, LIST_SIGNALS_RESPONSE); + } + + /** + * {@link #listSignals(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse listSignals(String networkUuid) { + return client.execute(listSignalsRequest(networkUuid), RequestOptions.none(), LIST_SIGNALS_RESPONSE); + } + + /** + * Asynchronous {@link #listSignals(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listSignalsAsync(String networkUuid) { + return client.executeAsync(listSignalsRequest(networkUuid), RequestOptions.none(), LIST_SIGNALS_RESPONSE); + } + + /** + * {@link #retrieveTimeline(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveTimeline(String networkUuid, RequestOptions options) { + return client.execute(retrieveTimelineRequest(networkUuid), options, RETRIEVE_TIMELINE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveTimeline(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveTimelineAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveTimelineRequest(networkUuid), options, RETRIEVE_TIMELINE_RESPONSE); + } + + /** + * {@link #retrieveTimeline(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse retrieveTimeline(String networkUuid) { + return client.execute(retrieveTimelineRequest(networkUuid), RequestOptions.none(), RETRIEVE_TIMELINE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveTimeline(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveTimelineAsync(String networkUuid) { + return client.executeAsync(retrieveTimelineRequest(networkUuid), RequestOptions.none(), RETRIEVE_TIMELINE_RESPONSE); + } + + /** + * {@link #retrieveMap(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveMap(String networkUuid, RequestOptions options) { + return client.execute(retrieveMapRequest(networkUuid), options, RETRIEVE_MAP_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveMap(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveMapAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(retrieveMapRequest(networkUuid), options, RETRIEVE_MAP_RESPONSE); + } + + /** + * {@link #retrieveMap(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse retrieveMap(String networkUuid) { + return client.execute(retrieveMapRequest(networkUuid), RequestOptions.none(), RETRIEVE_MAP_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveMap(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveMapAsync(String networkUuid) { + return client.executeAsync(retrieveMapRequest(networkUuid), RequestOptions.none(), RETRIEVE_MAP_RESPONSE); + } + + /** + * {@link #downloadReport(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse downloadReport(String networkUuid, RequestOptions options) { + return client.execute(downloadReportRequest(networkUuid), options, DOWNLOAD_REPORT_RESPONSE); + } + + /** + * Asynchronous {@link #downloadReport(String, RequestOptions)} with the raw response. + * + * @param networkUuid the {@code network_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> downloadReportAsync(String networkUuid, RequestOptions options) { + return client.executeAsync(downloadReportRequest(networkUuid), options, DOWNLOAD_REPORT_RESPONSE); + } + + /** + * {@link #downloadReport(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return the result + */ + public RawResponse downloadReport(String networkUuid) { + return client.execute(downloadReportRequest(networkUuid), RequestOptions.none(), DOWNLOAD_REPORT_RESPONSE); + } + + /** + * Asynchronous {@link #downloadReport(String, RequestOptions)} with the raw response, with the client's options. + * + * @param networkUuid the {@code network_uuid} + * @return a future completed with the result + */ + public CompletableFuture> downloadReportAsync(String networkUuid) { + return client.executeAsync(downloadReportRequest(networkUuid), RequestOptions.none(), DOWNLOAD_REPORT_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/PassiveLivenessResource.java b/src/main/java/me/didit/resources/PassiveLivenessResource.java new file mode 100644 index 0000000..9ddd938 --- /dev/null +++ b/src/main/java/me/didit/resources/PassiveLivenessResource.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.PassiveLivenessCheckParams; +import me.didit.types.PassiveLivenessCheckResponse; + +/** The {@code passive_liveness} resource: {@code client.passiveLiveness()}. */ +public final class PassiveLivenessResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + PassiveLivenessResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Passive Liveness + * + *

Detect presentation attacks โ€” printed photos, screen replays, masks, deepfakes โ€” from a single face image. No video, motion, or user interaction required. + * + *

How it works. The image is analyzed by a biometric model; the largest detected face is evaluated and a liveness score (0โ€“100) is computed. status is Declined when any error-severity warning fires: + * - NO_FACE_DETECTED โ€” the liveness model found no face, + * - LOW_LIVENESS_SCORE โ€” score at or below face_liveness_score_decline_threshold (default 30), + * - LIVENESS_FACE_ATTACK โ€” the model detected a presentation attack, + * - FACE_IN_BLOCKLIST / POSSIBLE_FACE_IN_BLOCKLIST โ€” the face matches an entry on your face blocklist. + * + *

MULTIPLE_FACES_DETECTED is a warning-severity signal (does not decline), and DUPLICATED_FACE / POSSIBLE_DUPLICATED_FACE are information-severity signals that the same face already appeared in another approved session (they never decline). face_quality and face_luminance (0โ€“100, nullable) describe capture quality. + * + *

Blocklist and duplicate screening. Runs on every call โ€” with or without save_api_request โ€” by matching the detected face against your application's face search index. Prior faces with the same vendor_data are excluded from the entire index search โ€” so re-running liveness for the same user does not trigger DUPLICATED_FACE, and a blocklisted face originating from a session with the caller's own vendor_data is also NOT flagged (FACE_IN_BLOCKLIST screening is bypassed for same-vendor_data faces). + * + *

Billing. Each 200 response consumes one Passive Liveness API credit (standalone APIs have no free tier). Insufficient balance returns 403 before any image processing. + * + *

**Session persistence and face enrollment (save_api_request, default true).** When true, the call is persisted as an API-type session (Business Console, GET /v3/session/{sessionId}/decision/ via the returned request_id, status.updated webhook), the reference image and face crop are stored, and the detected face is enrolled into your face search index so later Face Search calls and duplicate checks can match it. When false, the call is one-shot: nothing is stored and the face is not enrolled (blocklist/duplicate screening still runs). + * + *

Sandbox. Sandbox API keys skip all processing and billing: after request validation (malformed input still returns 400), the endpoint returns a static Approved mock payload, no session is persisted, and no credits are consumed. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

{@code POST /v3/passive-liveness/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public PassiveLivenessCheckResponse check(PassiveLivenessCheckParams params, RequestOptions options) { + return client.execute(checkRequest(params), options, CHECK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #check(PassiveLivenessCheckParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture checkAsync(PassiveLivenessCheckParams params, RequestOptions options) { + return client.executeAsync(checkRequest(params), options, CHECK_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #check(PassiveLivenessCheckParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public PassiveLivenessCheckResponse check(PassiveLivenessCheckParams params) { + return client.execute(checkRequest(params), RequestOptions.none(), CHECK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #check(PassiveLivenessCheckParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture checkAsync(PassiveLivenessCheckParams params) { + return client.executeAsync(checkRequest(params), RequestOptions.none(), CHECK_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler CHECK_RESPONSE = Responses.json(Conv.model(PassiveLivenessCheckResponse::fromJson)); + + private static ApiRequest checkRequest(PassiveLivenessCheckParams params) { + return ApiRequest.builder("POST", "/v3/passive-liveness/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code passive_liveness} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #check(PassiveLivenessCheckParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse check(PassiveLivenessCheckParams params, RequestOptions options) { + return client.execute(checkRequest(params), options, CHECK_RESPONSE); + } + + /** + * Asynchronous {@link #check(PassiveLivenessCheckParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> checkAsync(PassiveLivenessCheckParams params, RequestOptions options) { + return client.executeAsync(checkRequest(params), options, CHECK_RESPONSE); + } + + /** + * {@link #check(PassiveLivenessCheckParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse check(PassiveLivenessCheckParams params) { + return client.execute(checkRequest(params), RequestOptions.none(), CHECK_RESPONSE); + } + + /** + * Asynchronous {@link #check(PassiveLivenessCheckParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> checkAsync(PassiveLivenessCheckParams params) { + return client.executeAsync(checkRequest(params), RequestOptions.none(), CHECK_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/PhoneResource.java b/src/main/java/me/didit/resources/PhoneResource.java new file mode 100644 index 0000000..290433b --- /dev/null +++ b/src/main/java/me/didit/resources/PhoneResource.java @@ -0,0 +1,389 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.PhoneCheckCodeParams; +import me.didit.types.PhoneRiskRequest; +import me.didit.types.PhoneRiskResponse; +import me.didit.types.PhoneSendCodeParams; +import me.didit.types.PhoneVerificationCheckResponse; +import me.didit.types.PhoneVerificationSendResponse; + +/** The {@code phone} resource: {@code client.phone()}. */ +public final class PhoneResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + PhoneResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Risk-score a phone number + * + *

Resolve a phone number and return carrier, line-type, porting, disposable-number, cross-session match, and normalized risk-intelligence signals without sending an OTP. The endpoint creates an API session and returns its id as request_id. + * + *

Decision. The top-level status mirrors phone.status. It is normally Approved; the risk evaluation can produce In Review or Declined. + * + *

Compatibility aliases. Live responses expose the normalized intelligence object as both phone.phone_intelligence and phone.enrichment. The values are identical. New integrations can read phone.enrichment. Both keys are absent when no usable intelligence data was returned. + * + *

Billing. Live calls use Phone Risk API pricing. The request is billable once the lookup starts, even when some best-effort fields are unavailable. + * + *

Sandbox. Sandbox keys validate the request and return deterministic approved data without sending an OTP, consuming credits, creating a session, or contributing to Networks. + * + *

Authentication. Send your application's API key in x-api-key. Missing or invalid credentials return 403 - this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests per minute per API key across all POST/PATCH/DELETE endpoints. + * + *

Social footprint. Set enable_social to true to add a phone_social block: the online platforms this number is registered on, with per-category counts and any profile details available. profiles_registered: 0 means the platforms were checked and the number was found on none of them - a valid, billable answer. The block is absent when the add-on was not requested or the check could not be completed, and it is not billed in that case. Billing adds one phone_social unit per request on top of this endpoint's own price. + * + *

{@code POST /v3/phone/risk/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public PhoneRiskResponse assessRisk(PhoneRiskRequest params, RequestOptions options) { + return client.execute(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assessRisk(PhoneRiskRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture assessRiskAsync(PhoneRiskRequest params, RequestOptions options) { + return client.executeAsync(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #assessRisk(PhoneRiskRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public PhoneRiskResponse assessRisk(PhoneRiskRequest params) { + return client.execute(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE).data(); + } + + /** + * Asynchronous {@link #assessRisk(PhoneRiskRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture assessRiskAsync(PhoneRiskRequest params) { + return client.executeAsync(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Send Phone Code + * + *

Send a one-time passcode (OTP) to a phone number over WhatsApp, SMS, or another supported channel, then verify it with [POST /v3/phone/check/](/standalone-apis/phone-check). + * + *

How send and check pair up. Verification state is keyed by your application plus the E.164 phone_number โ€” the check call does not take request_id. Each new send creates a pending verification that lives for 5 minutes: call the check with the same number and the code the user received before the window closes. Calling send again for the same number while a verification is pending re-sends a code for that same verification (status: "Retry", same request_id). At most one retry is attached this way (two sends total); a further send starts a fresh verification with a new request_id. The 5-minute window is measured from the first send and is not extended by retries. + * + *

Delivery channels. options.preferred_channel selects the channel (whatsapp by default; sms, telegram, voice, rcs, viber, and zalo are also supported). When the preferred channel is unavailable for the destination country or number, delivery automatically falls back to SMS โ€” the send still reports Success, and the channel actually used is reported by the check response (phone.verification_method and the lifecycle events). + * + *

Branding. SMS codes carry your application's SMS sender name, set in the Business Console, at no extra cost. Pass options.sms_sender_name to sign one code with another name, or options.use_white_label_customization: true to fall back to your white-label public name when no sender name is set. WhatsApp codes use a fixed message and are not branded. + * + *

Send statuses. Success โ€” OTP sent for a new verification; Retry โ€” OTP re-sent for the pending verification; Blocked โ€” the anti-fraud layer refused to send (see reason, e.g. repeated_attempts, suspicious, spam). A Blocked send immediately finalizes the verification as Declined with a high-risk warning, so a follow-up check returns Expired or Not Found. + * + *

Billing. The price depends on the destination country and the channel that actually delivers the message โ€” see [Phone Verification Pricing](/getting-started/phone-verification-pricing). Only Blocked sends are guaranteed free: any other unbilled send attempt is charged at verification finalization or expiration, even if delivery was never confirmed or the delivery provider reported the message undeliverable. Checks are always free. As an anti-abuse measure, phone verification is disabled until your organization's first top-up (403). + * + *

Session persistence. Every new verification is persisted as an API-type session: request_id is a real session id you can pass to GET /v3/session/{sessionId}/decision/, the verification appears in the Business Console, and status.updated webhooks fire as it progresses. + * + *

Sandbox. Sandbox API keys skip delivery and billing: after request validation (malformed input still returns 400), the endpoint returns a static Success payload with a random request_id; no message is sent and nothing is persisted. Use code 123456 on the sandbox check. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limits. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints, plus an anti-abuse cap of 4 send attempts per phone number per hour; exceeding either returns 429. + * + *

{@code POST /v3/phone/send/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public PhoneVerificationSendResponse sendCode(PhoneSendCodeParams params, RequestOptions options) { + return client.execute(sendCodeRequest(params), options, SEND_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #sendCode(PhoneSendCodeParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture sendCodeAsync(PhoneSendCodeParams params, RequestOptions options) { + return client.executeAsync(sendCodeRequest(params), options, SEND_CODE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #sendCode(PhoneSendCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public PhoneVerificationSendResponse sendCode(PhoneSendCodeParams params) { + return client.execute(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #sendCode(PhoneSendCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture sendCodeAsync(PhoneSendCodeParams params) { + return client.executeAsync(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Check Phone Code + * + *

Verify the OTP delivered by [POST /v3/phone/send/](/standalone-apis/phone-send) and get the final verification result plus phone intelligence: carrier name and line type, virtual (VoIP) and disposable flags, and duplicate usage of the number across your sessions. + * + *

How the check finds the verification. Matching is by your application plus the E.164 phone_number โ€” request_id is not an input. The most recent pending verification created within the last 5 minutes is checked. If there is none (never sent, already finalized, or older than 5 minutes) the endpoint returns 200 with status: "Expired or Not Found". + * + *

Attempt budget. Each verification allows 3 code attempts. The first two wrong codes return status: "Failed" with the attempts remaining and phone: null; the third wrong code finalizes the verification as Declined with a VERIFICATION_CODE_ATTEMPTS_EXCEEDED warning and returns the full phone report. + * + *

Outcomes. Approved โ€” correct code and no declining risk. Declined โ€” terminal: the code was correct but a declining risk matched (a DECLINE action below, a blocklisted or high-risk number), or the attempt budget was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” nothing to check. On Approved/Declined the request_id equals the send's request_id (the session id) and phone carries the full report (carrier, is_virtual, is_disposable, warnings, lifecycle, matches); on Failed and Expired or Not Found the request_id is a one-off random UUID. + * + *

Risk actions. duplicated_phone_number_action, disposable_number_action, and voip_number_action decide what happens when the corresponding risk is detected on a correct code: DECLINE flips the final status to Declined; NO_ACTION (default) records the risk in phone.warnings without affecting the status. + * + *

Billing. Checks are free โ€” delivery is billed on the send side (see [Phone Verification Pricing](/getting-started/phone-verification-pricing)). + * + *

Session persistence. A finalized check updates the session created by the send (visible in the Business Console, queryable via GET /v3/session/{sessionId}/decision/) and fires a status.updated webhook. + * + *

Sandbox. Sandbox API keys skip all processing: any well-formed code (4โ€“8 digits, 123456 included) returns a static Approved payload with a simplified flat phone object (status, phone_number, country_code, carrier_name, line_type, flags); malformed input still returns 400. Nothing is persisted. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limits. Shared write budget of 300 requests/min per API key, plus the upstream anti-abuse cap of 4 attempts per number per hour; exceeding either returns 429. + * + *

Social footprint. Set enable_social to true to add a phone_social block: the online platforms this number is registered on, with per-category counts and any profile details available. profiles_registered: 0 means the platforms were checked and the number was found on none of them - a valid, billable answer. The block is absent when the add-on was not requested or the check could not be completed, and it is not billed in that case. Billing adds one phone_social unit per request on top of this endpoint's own price. + * + *

{@code POST /v3/phone/check/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public PhoneVerificationCheckResponse checkCode(PhoneCheckCodeParams params, RequestOptions options) { + return client.execute(checkCodeRequest(params), options, CHECK_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #checkCode(PhoneCheckCodeParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture checkCodeAsync(PhoneCheckCodeParams params, RequestOptions options) { + return client.executeAsync(checkCodeRequest(params), options, CHECK_CODE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #checkCode(PhoneCheckCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public PhoneVerificationCheckResponse checkCode(PhoneCheckCodeParams params) { + return client.execute(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #checkCode(PhoneCheckCodeParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture checkCodeAsync(PhoneCheckCodeParams params) { + return client.executeAsync(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler ASSESS_RISK_RESPONSE = Responses.json(Conv.model(PhoneRiskResponse::fromJson)); + + private static ApiRequest assessRiskRequest(PhoneRiskRequest params) { + return ApiRequest.builder("POST", "/v3/phone/risk/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SEND_CODE_RESPONSE = Responses.json(Conv.model(PhoneVerificationSendResponse::fromJson)); + + private static ApiRequest sendCodeRequest(PhoneSendCodeParams params) { + return ApiRequest.builder("POST", "/v3/phone/send/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CHECK_CODE_RESPONSE = Responses.json(Conv.model(PhoneVerificationCheckResponse::fromJson)); + + private static ApiRequest checkCodeRequest(PhoneCheckCodeParams params) { + return ApiRequest.builder("POST", "/v3/phone/check/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code phone} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #assessRisk(PhoneRiskRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse assessRisk(PhoneRiskRequest params, RequestOptions options) { + return client.execute(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE); + } + + /** + * Asynchronous {@link #assessRisk(PhoneRiskRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> assessRiskAsync(PhoneRiskRequest params, RequestOptions options) { + return client.executeAsync(assessRiskRequest(params), options, ASSESS_RISK_RESPONSE); + } + + /** + * {@link #assessRisk(PhoneRiskRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse assessRisk(PhoneRiskRequest params) { + return client.execute(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE); + } + + /** + * Asynchronous {@link #assessRisk(PhoneRiskRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> assessRiskAsync(PhoneRiskRequest params) { + return client.executeAsync(assessRiskRequest(params), RequestOptions.none(), ASSESS_RISK_RESPONSE); + } + + /** + * {@link #sendCode(PhoneSendCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse sendCode(PhoneSendCodeParams params, RequestOptions options) { + return client.execute(sendCodeRequest(params), options, SEND_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #sendCode(PhoneSendCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> sendCodeAsync(PhoneSendCodeParams params, RequestOptions options) { + return client.executeAsync(sendCodeRequest(params), options, SEND_CODE_RESPONSE); + } + + /** + * {@link #sendCode(PhoneSendCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse sendCode(PhoneSendCodeParams params) { + return client.execute(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #sendCode(PhoneSendCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> sendCodeAsync(PhoneSendCodeParams params) { + return client.executeAsync(sendCodeRequest(params), RequestOptions.none(), SEND_CODE_RESPONSE); + } + + /** + * {@link #checkCode(PhoneCheckCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse checkCode(PhoneCheckCodeParams params, RequestOptions options) { + return client.execute(checkCodeRequest(params), options, CHECK_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #checkCode(PhoneCheckCodeParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> checkCodeAsync(PhoneCheckCodeParams params, RequestOptions options) { + return client.executeAsync(checkCodeRequest(params), options, CHECK_CODE_RESPONSE); + } + + /** + * {@link #checkCode(PhoneCheckCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse checkCode(PhoneCheckCodeParams params) { + return client.execute(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE); + } + + /** + * Asynchronous {@link #checkCode(PhoneCheckCodeParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> checkCodeAsync(PhoneCheckCodeParams params) { + return client.executeAsync(checkCodeRequest(params), RequestOptions.none(), CHECK_CODE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/ProofOfAddressResource.java b/src/main/java/me/didit/resources/ProofOfAddressResource.java new file mode 100644 index 0000000..7157e3d --- /dev/null +++ b/src/main/java/me/didit/resources/ProofOfAddressResource.java @@ -0,0 +1,157 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.ProofOfAddressVerifyParams; +import me.didit.types.ProofOfAddressVerifyResponse; + +/** The {@code proof_of_address} resource: {@code client.proofOfAddress()}. */ +public final class ProofOfAddressResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + ProofOfAddressResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Proof of Address (document OCR + address checks) + * + *

Extract and validate a Proof of Address document โ€” utility bills, bank statements, and government-issued documents โ€” in one call. Returns the issuer, issue/expiry dates, the holder name, the raw and parsed/geocoded address, an Approved/Declined status, and a warnings list explaining every issue found. + * + *

Latency. Extraction is LLM-based: typical calls take 5โ€“15 seconds, multi-page PDFs up to ~30 seconds. Configure a client timeout of at least 45 seconds and do not retry before the call completes. + * + *

How it works. The document (image or PDF, up to 15 MB; encrypted PDFs require document_password) is classified into a document type and subtype (e.g. UTILITY_BILL / WATER_BILL), and the issuer, dates, holder name, and address are extracted with LLM-based extraction. The address is parsed and geocoded into poa_parsed_address. PDF/EXIF forensics screen for tampering โ€” modification after digital signing, known PDF editors, overlay-text manipulation, suspicious re-exports โ€” surfacing SUSPECTED_DOCUMENT_MANIPULATION or DOCUMENT_METADATA_MISMATCH. Document age is validated against poa_document_age_months, and the language against poa_languages_allowed. If you pass expected_address, expected_country, or expected_first_name/expected_last_name, the extracted values are cross-checked and mismatches are flagged. + * + *

Decision logic. status is Approved unless at least one warning resolves to a decline. Hard failures always decline: MISSING_ADDRESS_INFORMATION, POA_DOCUMENT_EXPIRED, INVALID_DOCUMENT_TYPE, UNABLE_TO_VALIDATE_DOCUMENT_AGE, plus UNABLE_TO_EXTRACT_ISSUE_DATE and POA_NAME_NOT_DETECTED (not configurable on this endpoint). Five risk groups are configurable per request via the poa_*_action options (DECLINE or NO_ACTION, all defaulting to DECLINE). POA_DOCUMENT_NOT_SUPPORTED_FOR_APPLICATION and UNPARSABLE_OR_INVALID_ADDRESS are informational on this endpoint and never decline. A document that cannot be processed at all returns 400; a readable but problematic document returns 200 with status: "Declined" โ€” always inspect poa.status and poa.warnings, not just the HTTP code. + * + *

Billing. Each 200 response consumes one Proof of Address API credit (standalone APIs have no free tier). When the organization's balance cannot cover the call, the endpoint returns 403 with the not-enough-credits error before any document processing. + * + *

**Session persistence (save_api_request, default true).** When true, the call is persisted as an API-type session: it appears in the Business Console, the uploaded document is stored, the returned request_id is a real session id you can pass to GET /v3/session/{sessionId}/decision/ (the decision additionally exposes document_file and the document_metadata forensics, which this response omits), and a status.updated webhook is emitted. When false, nothing is stored and request_id is a one-off correlation UUID that cannot be looked up later. + * + *

Sandbox. Sandbox API keys skip all processing and billing: after request validation (malformed input still returns 400), the endpoint returns a static Approved mock payload (a fictional "Sandbox Power Co." electricity bill), no session is persisted, and no credits are consumed. + * + *

Authentication. Send your application's API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}) โ€” this API never returns 401. + * + *

Rate limit. Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

Note: FUTURE_ISSUE_DATE and POOR_DOCUMENT_QUALITY exist in workflow sessions but are never produced by this standalone endpoint โ€” a future-dated document is not auto-declined here. + * + *

{@code POST /v3/poa/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public ProofOfAddressVerifyResponse verify(ProofOfAddressVerifyParams params, RequestOptions options) { + return client.execute(verifyRequest(params), options, VERIFY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #verify(ProofOfAddressVerifyParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture verifyAsync(ProofOfAddressVerifyParams params, RequestOptions options) { + return client.executeAsync(verifyRequest(params), options, VERIFY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #verify(ProofOfAddressVerifyParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public ProofOfAddressVerifyResponse verify(ProofOfAddressVerifyParams params) { + return client.execute(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #verify(ProofOfAddressVerifyParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture verifyAsync(ProofOfAddressVerifyParams params) { + return client.executeAsync(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler VERIFY_RESPONSE = Responses.json(Conv.model(ProofOfAddressVerifyResponse::fromJson)); + + private static ApiRequest verifyRequest(ProofOfAddressVerifyParams params) { + return ApiRequest.builder("POST", "/v3/poa/") + .params(params) + .body(ApiRequest.BodyEncoding.MULTIPART) + .build(); + } + + /** The {@code proof_of_address} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #verify(ProofOfAddressVerifyParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse verify(ProofOfAddressVerifyParams params, RequestOptions options) { + return client.execute(verifyRequest(params), options, VERIFY_RESPONSE); + } + + /** + * Asynchronous {@link #verify(ProofOfAddressVerifyParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> verifyAsync(ProofOfAddressVerifyParams params, RequestOptions options) { + return client.executeAsync(verifyRequest(params), options, VERIFY_RESPONSE); + } + + /** + * {@link #verify(ProofOfAddressVerifyParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse verify(ProofOfAddressVerifyParams params) { + return client.execute(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE); + } + + /** + * Asynchronous {@link #verify(ProofOfAddressVerifyParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> verifyAsync(ProofOfAddressVerifyParams params) { + return client.executeAsync(verifyRequest(params), RequestOptions.none(), VERIFY_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/QuestionnairesResource.java b/src/main/java/me/didit/resources/QuestionnairesResource.java new file mode 100644 index 0000000..18cca47 --- /dev/null +++ b/src/main/java/me/didit/resources/QuestionnairesResource.java @@ -0,0 +1,614 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.QuestionnaireDetail; +import me.didit.types.QuestionnaireListItem; +import me.didit.types.QuestionnairesListParams; +import me.didit.types.SimpleQuestionnaireRequest; +import me.didit.types.SimpleQuestionnaireUpdateRequest; +import org.jspecify.annotations.Nullable; + +/** The {@code questionnaires} resource: {@code client.questionnaires()}. */ +public final class QuestionnairesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + QuestionnairesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List questionnaires + * + *

List your questionnaires, newest first, in a limit/offset pagination envelope ({count, next, previous, results}, default page size 50). Each row is one version; questionnaire_group_id is the stable group ID resolved to the latest published version. + * + *

{@code GET /v3/questionnaires/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(QuestionnairesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(QuestionnairesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(QuestionnairesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(QuestionnairesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(QuestionnairesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(QuestionnairesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(QuestionnairesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(QuestionnairesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(QuestionnairesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(QuestionnairesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(QuestionnairesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create questionnaire + * + *

Create a simple linear questionnaire. Send form_elements in display order; branching and repeatable groups require the Console. Defaults to published v1. + * + *

{@code POST /v3/questionnaires/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public QuestionnaireDetail create(SimpleQuestionnaireRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SimpleQuestionnaireRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(SimpleQuestionnaireRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(SimpleQuestionnaireRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public QuestionnaireDetail create(SimpleQuestionnaireRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SimpleQuestionnaireRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(SimpleQuestionnaireRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get questionnaire + * + *

Fetch full questionnaire detail for one version by questionnaire_uuid: title, languages, canonical graph, derived sections, and version metadata. + * + *

{@code GET /v3/questionnaires/{questionnaire_uuid}/} + * + * @param questionnaireUuid Per-version UUID of the questionnaire (the `uuid` value returned by the list endpoint, also returned as `questionnaire_id` on detail endpoints). + * @param options per-request options that override the client options + * @return the response body + */ + public QuestionnaireDetail retrieve(String questionnaireUuid, RequestOptions options) { + return client.execute(retrieveRequest(questionnaireUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String questionnaireUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(questionnaireUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return the result + */ + public QuestionnaireDetail retrieve(String questionnaireUuid) { + return client.execute(retrieveRequest(questionnaireUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String questionnaireUuid) { + return client.executeAsync(retrieveRequest(questionnaireUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update questionnaire + * + *

Update a questionnaire. Versioning depends on the status field you send and the current state of the version: (1) no status on a published version โ†’ the published version is updated in place (same questionnaire_id, same version); (2) no status on a draft โ†’ the draft is updated and immediately published; (3) status: "published" on a published version โ†’ a NEW published version is created under the same questionnaire_group_id (new questionnaire_id, version + 1) and returned, and any existing draft in the group is deleted; (4) status: "draft" keeps a draft as a draft (autosave) but is rejected with 400 on a published version ("Cannot revert a published version to draft."). + * + *

{@code PATCH /v3/questionnaires/{questionnaire_uuid}/} + * + * @param questionnaireUuid Per-version UUID of the questionnaire to update. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public QuestionnaireDetail update(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(questionnaireUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)}. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(questionnaireUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)}, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @return the result + */ + public QuestionnaireDetail update(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params) { + return client.execute(updateRequest(questionnaireUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)}, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params) { + return client.executeAsync(updateRequest(questionnaireUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete questionnaire + * + *

Permanently delete one questionnaire version (no undo). Stored questionnaire responses linked to this version are deleted with it, and sessions referencing it lose the link; other versions in the same group are not deleted. Workflows that referenced it keep running but the questionnaire step can no longer load it. + * + *

{@code DELETE /v3/questionnaires/{questionnaire_uuid}/} + * + * @param questionnaireUuid Per-version UUID of the questionnaire to delete. + * @param options per-request options that override the client options + */ + public void delete(String questionnaireUuid, RequestOptions options) { + client.execute(deleteRequest(questionnaireUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String questionnaireUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(questionnaireUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + */ + public void delete(String questionnaireUuid) { + client.execute(deleteRequest(questionnaireUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String questionnaireUuid) { + return client.executeAsync(deleteRequest(questionnaireUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(QuestionnaireListItem::fromJson)); + + private static ApiRequest listRequest(QuestionnairesListParams params) { + return ApiRequest.builder("GET", "/v3/questionnaires/") + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(QuestionnaireDetail::fromJson)); + + private static ApiRequest createRequest(SimpleQuestionnaireRequest params) { + return ApiRequest.builder("POST", "/v3/questionnaires/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(QuestionnaireDetail::fromJson)); + + private static ApiRequest retrieveRequest(String questionnaireUuid) { + return ApiRequest.builder("GET", "/v3/questionnaires/{questionnaire_uuid}/") + .pathParam("questionnaire_uuid", questionnaireUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(QuestionnaireDetail::fromJson)); + + private static ApiRequest updateRequest(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params) { + return ApiRequest.builder("PATCH", "/v3/questionnaires/{questionnaire_uuid}/") + .pathParam("questionnaire_uuid", questionnaireUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String questionnaireUuid) { + return ApiRequest.builder("DELETE", "/v3/questionnaires/{questionnaire_uuid}/") + .pathParam("questionnaire_uuid", questionnaireUuid) + .build(); + } + + /** The {@code questionnaires} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(QuestionnairesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(QuestionnairesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(QuestionnairesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(QuestionnairesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(QuestionnairesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(QuestionnairesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(QuestionnairesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(QuestionnairesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(QuestionnairesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(SimpleQuestionnaireRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(SimpleQuestionnaireRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SimpleQuestionnaireRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SimpleQuestionnaireRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(SimpleQuestionnaireRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(SimpleQuestionnaireRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SimpleQuestionnaireRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SimpleQuestionnaireRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String questionnaireUuid, RequestOptions options) { + return client.execute(retrieveRequest(questionnaireUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String questionnaireUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(questionnaireUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return the result + */ + public RawResponse retrieve(String questionnaireUuid) { + return client.execute(retrieveRequest(questionnaireUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String questionnaireUuid) { + return client.executeAsync(retrieveRequest(questionnaireUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)} with the raw response. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(questionnaireUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)} with the raw response. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(questionnaireUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params) { + return client.execute(updateRequest(questionnaireUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, SimpleQuestionnaireUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String questionnaireUuid, SimpleQuestionnaireUpdateRequest params) { + return client.executeAsync(updateRequest(questionnaireUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String questionnaireUuid, RequestOptions options) { + return client.execute(deleteRequest(questionnaireUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String questionnaireUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(questionnaireUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String questionnaireUuid) { + return client.execute(deleteRequest(questionnaireUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param questionnaireUuid the {@code questionnaire_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String questionnaireUuid) { + return client.executeAsync(deleteRequest(questionnaireUuid), RequestOptions.none(), DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/RegulatoryReportsResource.java b/src/main/java/me/didit/resources/RegulatoryReportsResource.java new file mode 100644 index 0000000..1f39e5d --- /dev/null +++ b/src/main/java/me/didit/resources/RegulatoryReportsResource.java @@ -0,0 +1,1098 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.RegulatoryReportDetail; +import me.didit.types.RegulatoryReportsCreateParams; +import me.didit.types.RegulatoryReportsListParams; +import me.didit.types.RegulatoryReportsRetrieveDownloadUrlParams; +import me.didit.types.RegulatoryReportsRetrieveDownloadUrlResponse; +import me.didit.types.RegulatoryReportsUpdateParams; +import me.didit.types.RegulatoryReportsValidateResponse; +import org.jspecify.annotations.Nullable; + +/** The {@code regulatory_reports} resource: {@code client.regulatoryReports()}. */ +public final class RegulatoryReportsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + RegulatoryReportsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List reports + * + *

Application-wide FIU report list, optionally filtered by status, report_type, or case. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(RegulatoryReportsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RegulatoryReportsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(RegulatoryReportsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(RegulatoryReportsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RegulatoryReportsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(RegulatoryReportsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(RegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(RegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(RegulatoryReportsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(RegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(RegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create standalone report + * + *

Create a draft FIU report from the standalone Reports page: both case and template are required (unlike the case-scoped create, which can omit template). + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportDetail create(RegulatoryReportsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(RegulatoryReportsCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(RegulatoryReportsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(RegulatoryReportsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RegulatoryReportDetail create(RegulatoryReportsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(RegulatoryReportsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(RegulatoryReportsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get report + * + *

Retrieve a regulatory report. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param reportUuid Report UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportDetail retrieve(String reportUuid, RequestOptions options) { + return client.execute(retrieveRequest(reportUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(reportUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RegulatoryReportDetail retrieve(String reportUuid) { + return client.execute(retrieveRequest(reportUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String reportUuid) { + return client.executeAsync(retrieveRequest(reportUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update report + * + *

Edit a draft or validated report's fields. Finalized reports cannot be edited (409). + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param reportUuid Report UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportDetail update(String reportUuid, RegulatoryReportsUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(reportUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String reportUuid, RegulatoryReportsUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(reportUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return the result + */ + public RegulatoryReportDetail update(String reportUuid, RegulatoryReportsUpdateParams params) { + return client.execute(updateRequest(reportUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String reportUuid, RegulatoryReportsUpdateParams params) { + return client.executeAsync(updateRequest(reportUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RegulatoryReportDetail update(String reportUuid, RequestOptions options) { + return client.execute(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RegulatoryReportDetail update(String reportUuid) { + return client.execute(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String reportUuid) { + return client.executeAsync(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete report + * + *

Delete a draft or validated report. Finalized reports cannot be deleted (409). + * + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param reportUuid Report UUID. + * @param options per-request options that override the client options + */ + public void delete(String reportUuid, RequestOptions options) { + client.execute(deleteRequest(reportUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(reportUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + */ + public void delete(String reportUuid) { + client.execute(deleteRequest(reportUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String reportUuid) { + return client.executeAsync(deleteRequest(reportUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Validate report + * + *

Check the report against the obligatory goAML header fields (reporting entity ID, submission code, local currency, action taken, submission date), plus at least one attached transaction and a 2-letter jurisdiction, without generating any files. Also stores the result on the report: validation_errors and validated_at are updated, and a non-finalized report's status moves to VALIDATED (no errors) or back to DRAFT (errors). + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/validate/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param reportUuid Report UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportsValidateResponse validate(String reportUuid, RequestOptions options) { + return client.execute(validateRequest(reportUuid), options, VALIDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #validate(String, RequestOptions)}. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture validateAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(validateRequest(reportUuid), options, VALIDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #validate(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RegulatoryReportsValidateResponse validate(String reportUuid) { + return client.execute(validateRequest(reportUuid), RequestOptions.none(), VALIDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #validate(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture validateAsync(String reportUuid) { + return client.executeAsync(validateRequest(reportUuid), RequestOptions.none(), VALIDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Finalize report + * + *

Re-validate, then render the goAML XML and PDF and upload both to S3. On SAR/STR/TFR reports, this also moves the case's transaction alerts from Pending SAR to SAR filed. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param reportUuid Report UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportDetail finalize_(String reportUuid, RequestOptions options) { + return client.execute(finalize_Request(reportUuid), options, FINALIZE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #finalize_(String, RequestOptions)}. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture finalize_Async(String reportUuid, RequestOptions options) { + return client.executeAsync(finalize_Request(reportUuid), options, FINALIZE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #finalize_(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RegulatoryReportDetail finalize_(String reportUuid) { + return client.execute(finalize_Request(reportUuid), RequestOptions.none(), FINALIZE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #finalize_(String, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture finalize_Async(String reportUuid) { + return client.executeAsync(finalize_Request(reportUuid), RequestOptions.none(), FINALIZE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get report download URL + * + *

Mint a presigned URL for a finalized report's goAML XML or PDF. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/download-url/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param reportUuid Report UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public RegulatoryReportsRetrieveDownloadUrlResponse retrieveDownloadUrl(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params, RequestOptions options) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, params), options, RETRIEVE_DOWNLOAD_URL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDownloadUrlAsync(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params, RequestOptions options) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, params), options, RETRIEVE_DOWNLOAD_URL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return the result + */ + public RegulatoryReportsRetrieveDownloadUrlResponse retrieveDownloadUrl(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, params), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture retrieveDownloadUrlAsync(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, params), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RegulatoryReportsRetrieveDownloadUrlResponse retrieveDownloadUrl(String reportUuid, RequestOptions options) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), options, RETRIEVE_DOWNLOAD_URL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDownloadUrlAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), options, RETRIEVE_DOWNLOAD_URL_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RegulatoryReportsRetrieveDownloadUrlResponse retrieveDownloadUrl(String reportUuid) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)}, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveDownloadUrlAsync(String reportUuid) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest listRequest(RegulatoryReportsListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/") + .applicationScoped() + .params(params) + .queryFields("limit", "offset", "status", "report_type", "case") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest createRequest(RegulatoryReportsCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest retrieveRequest(String reportUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/") + .applicationScoped() + .pathParam("report_uuid", reportUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest updateRequest(String reportUuid, RegulatoryReportsUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/") + .applicationScoped() + .pathParam("report_uuid", reportUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String reportUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/") + .applicationScoped() + .pathParam("report_uuid", reportUuid) + .build(); + } + + private static final ResponseHandler VALIDATE_RESPONSE = Responses.json(Conv.model(RegulatoryReportsValidateResponse::fromJson)); + + private static ApiRequest validateRequest(String reportUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/validate/") + .applicationScoped() + .pathParam("report_uuid", reportUuid) + .build(); + } + + private static final ResponseHandler FINALIZE_RESPONSE = Responses.json(Conv.model(RegulatoryReportDetail::fromJson)); + + private static ApiRequest finalize_Request(String reportUuid) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/") + .applicationScoped() + .pathParam("report_uuid", reportUuid) + .build(); + } + + private static final ResponseHandler RETRIEVE_DOWNLOAD_URL_RESPONSE = Responses.json(Conv.model(RegulatoryReportsRetrieveDownloadUrlResponse::fromJson)); + + private static ApiRequest retrieveDownloadUrlRequest(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/download-url/") + .applicationScoped() + .pathParam("report_uuid", reportUuid) + .params(params) + .queryFields("file") + .build(); + } + + /** The {@code regulatory_reports} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(RegulatoryReportsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RegulatoryReportsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(RegulatoryReportsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RegulatoryReportsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(RegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(RegulatoryReportsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(RegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RegulatoryReportsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(RegulatoryReportsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(RegulatoryReportsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(RegulatoryReportsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(RegulatoryReportsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(RegulatoryReportsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(RegulatoryReportsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(RegulatoryReportsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(RegulatoryReportsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(RegulatoryReportsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String reportUuid, RequestOptions options) { + return client.execute(retrieveRequest(reportUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(reportUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RawResponse retrieve(String reportUuid) { + return client.execute(retrieveRequest(reportUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String reportUuid) { + return client.executeAsync(retrieveRequest(reportUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String reportUuid, RegulatoryReportsUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(reportUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String reportUuid, RegulatoryReportsUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(reportUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String reportUuid, RegulatoryReportsUpdateParams params) { + return client.execute(updateRequest(reportUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String reportUuid, RegulatoryReportsUpdateParams params) { + return client.executeAsync(updateRequest(reportUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse update(String reportUuid, RequestOptions options) { + return client.execute(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RawResponse update(String reportUuid) { + return client.execute(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, RegulatoryReportsUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String reportUuid) { + return client.executeAsync(updateRequest(reportUuid, RegulatoryReportsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String reportUuid, RequestOptions options) { + return client.execute(deleteRequest(reportUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(reportUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String reportUuid) { + return client.execute(deleteRequest(reportUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String reportUuid) { + return client.executeAsync(deleteRequest(reportUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #validate(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse validate(String reportUuid, RequestOptions options) { + return client.execute(validateRequest(reportUuid), options, VALIDATE_RESPONSE); + } + + /** + * Asynchronous {@link #validate(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> validateAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(validateRequest(reportUuid), options, VALIDATE_RESPONSE); + } + + /** + * {@link #validate(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RawResponse validate(String reportUuid) { + return client.execute(validateRequest(reportUuid), RequestOptions.none(), VALIDATE_RESPONSE); + } + + /** + * Asynchronous {@link #validate(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture> validateAsync(String reportUuid) { + return client.executeAsync(validateRequest(reportUuid), RequestOptions.none(), VALIDATE_RESPONSE); + } + + /** + * {@link #finalize_(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse finalize_(String reportUuid, RequestOptions options) { + return client.execute(finalize_Request(reportUuid), options, FINALIZE_RESPONSE); + } + + /** + * Asynchronous {@link #finalize_(String, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> finalize_Async(String reportUuid, RequestOptions options) { + return client.executeAsync(finalize_Request(reportUuid), options, FINALIZE_RESPONSE); + } + + /** + * {@link #finalize_(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RawResponse finalize_(String reportUuid) { + return client.execute(finalize_Request(reportUuid), RequestOptions.none(), FINALIZE_RESPONSE); + } + + /** + * Asynchronous {@link #finalize_(String, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture> finalize_Async(String reportUuid) { + return client.executeAsync(finalize_Request(reportUuid), RequestOptions.none(), FINALIZE_RESPONSE); + } + + /** + * {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDownloadUrl(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params, RequestOptions options) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, params), options, RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDownloadUrlAsync(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params, RequestOptions options) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, params), options, RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse retrieveDownloadUrl(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, params), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> retrieveDownloadUrlAsync(String reportUuid, RegulatoryReportsRetrieveDownloadUrlParams params) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, params), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDownloadUrl(String reportUuid, RequestOptions options) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), options, RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response, without parameters. + * + * @param reportUuid the {@code report_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDownloadUrlAsync(String reportUuid, RequestOptions options) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), options, RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return the result + */ + public RawResponse retrieveDownloadUrl(String reportUuid) { + return client.execute(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDownloadUrl(String, RegulatoryReportsRetrieveDownloadUrlParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param reportUuid the {@code report_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveDownloadUrlAsync(String reportUuid) { + return client.executeAsync(retrieveDownloadUrlRequest(reportUuid, RegulatoryReportsRetrieveDownloadUrlParams.builder().build()), RequestOptions.none(), RETRIEVE_DOWNLOAD_URL_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/ReportTemplatesResource.java b/src/main/java/me/didit/resources/ReportTemplatesResource.java new file mode 100644 index 0000000..9fc1924 --- /dev/null +++ b/src/main/java/me/didit/resources/ReportTemplatesResource.java @@ -0,0 +1,707 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.ReportTemplateDetail; +import me.didit.types.ReportTemplatesCreateParams; +import me.didit.types.ReportTemplatesListParams; +import me.didit.types.ReportTemplatesUpdateParams; +import org.jspecify.annotations.Nullable; + +/** The {@code report_templates} resource: {@code client.reportTemplates()}. */ +public final class ReportTemplatesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + ReportTemplatesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List report templates + * + *

List FIU report templates for the application. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/report-templates/} + *

Application scoped: the organization and application ids come from the client options. + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(ReportTemplatesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(ReportTemplatesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(ReportTemplatesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(ReportTemplatesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(ReportTemplatesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(ReportTemplatesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(ReportTemplatesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(ReportTemplatesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(ReportTemplatesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(ReportTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(ReportTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create report template + * + *

Create a reusable per-jurisdiction, per-report-type goAML header template. Rejected with 400 if any of the template-level obligatory fields (rentity_id, submission_code, currency_code_local) is missing from field_config; an invalid template cannot be saved or used to create a report. Per-filing header fields (action, submission_date, transactions) are enforced at report validate/finalize time instead. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/report-templates/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public ReportTemplateDetail create(ReportTemplatesCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(ReportTemplatesCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(ReportTemplatesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(ReportTemplatesCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public ReportTemplateDetail create(ReportTemplatesCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(ReportTemplatesCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(ReportTemplatesCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get report template + * + *

Retrieve a report template. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/report-templates/{template_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param templateUuid Report template UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public ReportTemplateDetail retrieve(String templateUuid, RequestOptions options) { + return client.execute(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public ReportTemplateDetail retrieve(String templateUuid) { + return client.execute(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String templateUuid) { + return client.executeAsync(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update report template + * + *

Partially update a report template. Re-validates obligatory goAML fields on save. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/report-templates/{template_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param templateUuid Report template UUID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public ReportTemplateDetail update(String templateUuid, ReportTemplatesUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(templateUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String templateUuid, ReportTemplatesUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(templateUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @return the result + */ + public ReportTemplateDetail update(String templateUuid, ReportTemplatesUpdateParams params) { + return client.execute(updateRequest(templateUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String templateUuid, ReportTemplatesUpdateParams params) { + return client.executeAsync(updateRequest(templateUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}, without parameters. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return the result + */ + public ReportTemplateDetail update(String templateUuid, RequestOptions options) { + return client.execute(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}, without parameters. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public ReportTemplateDetail update(String templateUuid) { + return client.execute(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String templateUuid) { + return client.executeAsync(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete report template + * + *

Delete a report template. Reports already created from it are unaffected. + * + *

{@code DELETE /v3/organization/{organization_id}/application/{application_id}/report-templates/{template_uuid}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param templateUuid Report template UUID. + * @param options per-request options that override the client options + */ + public void delete(String templateUuid, RequestOptions options) { + client.execute(deleteRequest(templateUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(templateUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + */ + public void delete(String templateUuid) { + client.execute(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String templateUuid) { + return client.executeAsync(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(ReportTemplateDetail::fromJson)); + + private static ApiRequest listRequest(ReportTemplatesListParams params) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/report-templates/") + .applicationScoped() + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(ReportTemplateDetail::fromJson)); + + private static ApiRequest createRequest(ReportTemplatesCreateParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/report-templates/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(ReportTemplateDetail::fromJson)); + + private static ApiRequest retrieveRequest(String templateUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/report-templates/{template_uuid}/") + .applicationScoped() + .pathParam("template_uuid", templateUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(ReportTemplateDetail::fromJson)); + + private static ApiRequest updateRequest(String templateUuid, ReportTemplatesUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/report-templates/{template_uuid}/") + .applicationScoped() + .pathParam("template_uuid", templateUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String templateUuid) { + return ApiRequest.builder("DELETE", "/v3/organization/{organization_id}/application/{application_id}/report-templates/{template_uuid}/") + .applicationScoped() + .pathParam("template_uuid", templateUuid) + .build(); + } + + /** The {@code report_templates} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(ReportTemplatesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(ReportTemplatesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(ReportTemplatesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(ReportTemplatesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(ReportTemplatesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(ReportTemplatesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(ReportTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(ReportTemplatesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(ReportTemplatesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(ReportTemplatesCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(ReportTemplatesCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(ReportTemplatesCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(ReportTemplatesCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(ReportTemplatesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(ReportTemplatesCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(ReportTemplatesCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(ReportTemplatesCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String templateUuid, RequestOptions options) { + return client.execute(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(templateUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public RawResponse retrieve(String templateUuid) { + return client.execute(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String templateUuid) { + return client.executeAsync(retrieveRequest(templateUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String templateUuid, ReportTemplatesUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(templateUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String templateUuid, ReportTemplatesUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(templateUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String templateUuid, ReportTemplatesUpdateParams params) { + return client.execute(updateRequest(templateUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String templateUuid, ReportTemplatesUpdateParams params) { + return client.executeAsync(updateRequest(templateUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse update(String templateUuid, RequestOptions options) { + return client.execute(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public RawResponse update(String templateUuid) { + return client.execute(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, ReportTemplatesUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String templateUuid) { + return client.executeAsync(updateRequest(templateUuid, ReportTemplatesUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String templateUuid, RequestOptions options) { + return client.execute(deleteRequest(templateUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param templateUuid the {@code template_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String templateUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(templateUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String templateUuid) { + return client.execute(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param templateUuid the {@code template_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String templateUuid) { + return client.executeAsync(deleteRequest(templateUuid), RequestOptions.none(), DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/SessionsImportsResource.java b/src/main/java/me/didit/resources/SessionsImportsResource.java new file mode 100644 index 0000000..b48f946 --- /dev/null +++ b/src/main/java/me/didit/resources/SessionsImportsResource.java @@ -0,0 +1,682 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.BinaryResponse; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.SessionImportError; +import me.didit.types.SessionImportJob; +import me.didit.types.SessionsImportsCreateParams; +import me.didit.types.SessionsImportsListErrorsParams; +import me.didit.types.SessionsImportsRetrieveTemplateParams; + +/** The {@code sessions.imports} resource: {@code client.sessions().imports()}. */ +public final class SessionsImportsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + SessionsImportsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Create a verification import job + * + *

Create an asynchronous import job for historical User Verification sessions, Business Verification sessions, transaction monitoring records, or workflow custom status rules. Use this to migrate from providers such as Sumsub, MetaMap, Veriff, Onfido, Persona, Trulioo, Jumio, Incode, iDenfy, or any other provider after transforming the export into Didit's canonical CSV/NDJSON format. Imports are disabled by default and must be enabled per organization by Didit. + * + *

{@code POST /v3/session/imports/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionImportJob create(SessionsImportsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(SessionsImportsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(SessionsImportsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public SessionImportJob create(SessionsImportsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(SessionsImportsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(SessionsImportsCreateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public SessionImportJob create(RequestOptions options) { + return client.execute(createRequest(SessionsImportsCreateParams.builder().build()), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(RequestOptions options) { + return client.executeAsync(createRequest(SessionsImportsCreateParams.builder().build()), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(SessionsImportsCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public SessionImportJob create() { + return client.execute(createRequest(SessionsImportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture createAsync() { + return client.executeAsync(createRequest(SessionsImportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Download verification import template + * + *

Download the canonical CSV header for verification imports. The column set is determined by import_type. The first column of session templates is the idempotency key external_id. + * + *

{@code GET /v3/session/imports/template/} + *

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BinaryResponse retrieveTemplate(SessionsImportsRetrieveTemplateParams params, RequestOptions options) { + return client.execute(retrieveTemplateRequest(params), options, RETRIEVE_TEMPLATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveTemplateAsync(SessionsImportsRetrieveTemplateParams params, RequestOptions options) { + return client.executeAsync(retrieveTemplateRequest(params), options, RETRIEVE_TEMPLATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BinaryResponse retrieveTemplate(SessionsImportsRetrieveTemplateParams params) { + return client.execute(retrieveTemplateRequest(params), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture retrieveTemplateAsync(SessionsImportsRetrieveTemplateParams params) { + return client.executeAsync(retrieveTemplateRequest(params), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public BinaryResponse retrieveTemplate(RequestOptions options) { + return client.execute(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), options, RETRIEVE_TEMPLATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveTemplateAsync(RequestOptions options) { + return client.executeAsync(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), options, RETRIEVE_TEMPLATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public BinaryResponse retrieveTemplate() { + return client.execute(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture retrieveTemplateAsync() { + return client.executeAsync(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Retrieve a verification import job + * + *

Retrieve import progress counters and terminal status for one job. Poll until status is COMPLETED or FAILED; failed_count > 0 means some rows were rejected โ€” list them via the errors endpoint. + * + *

{@code GET /v3/session/imports/{importId}/} + * + * @param importId the {@code importId} + * @param options per-request options that override the client options + * @return the response body + */ + public SessionImportJob retrieve(String importId, RequestOptions options) { + return client.execute(retrieveRequest(importId), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param importId the {@code importId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String importId, RequestOptions options) { + return client.executeAsync(retrieveRequest(importId), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param importId the {@code importId} + * @return the result + */ + public SessionImportJob retrieve(String importId) { + return client.execute(retrieveRequest(importId), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param importId the {@code importId} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String importId) { + return client.executeAsync(retrieveRequest(importId), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List verification import row errors + * + *

List row-level errors for a verification import job, ordered by row_number. Use this endpoint to produce a corrected retry file containing only failed rows. + * + *

{@code GET /v3/session/imports/{importId}/errors/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param importId the {@code importId} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page listErrors(String importId, SessionsImportsListErrorsParams params, RequestOptions options) { + return client.execute(listErrorsRequest(importId, params), options, LIST_ERRORS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}. + * + * @param importId the {@code importId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listErrorsAsync(String importId, SessionsImportsListErrorsParams params, RequestOptions options) { + return client.executeAsync(listErrorsRequest(importId, params), options, LIST_ERRORS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}, with the client's options. + * + * @param importId the {@code importId} + * @param params the request parameters + * @return the result + */ + public Page listErrors(String importId, SessionsImportsListErrorsParams params) { + return client.execute(listErrorsRequest(importId, params), RequestOptions.none(), LIST_ERRORS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}, with the client's options. + * + * @param importId the {@code importId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listErrorsAsync(String importId, SessionsImportsListErrorsParams params) { + return client.executeAsync(listErrorsRequest(importId, params), RequestOptions.none(), LIST_ERRORS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}, without parameters. + * + * @param importId the {@code importId} + * @param options per-request options + * @return the result + */ + public Page listErrors(String importId, RequestOptions options) { + return client.execute(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), options, LIST_ERRORS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}, without parameters. + * + * @param importId the {@code importId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listErrorsAsync(String importId, RequestOptions options) { + return client.executeAsync(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), options, LIST_ERRORS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}, without parameters, with the client's options. + * + * @param importId the {@code importId} + * @return the result + */ + public Page listErrors(String importId) { + return client.execute(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), RequestOptions.none(), LIST_ERRORS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)}, without parameters, with the client's options. + * + * @param importId the {@code importId} + * @return a future completed with the result + */ + public CompletableFuture> listErrorsAsync(String importId) { + return client.executeAsync(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), RequestOptions.none(), LIST_ERRORS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(SessionImportJob::fromJson)); + + private static ApiRequest createRequest(SessionsImportsCreateParams params) { + return ApiRequest.builder("POST", "/v3/session/imports/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART) + .build(); + } + + private static final ResponseHandler RETRIEVE_TEMPLATE_RESPONSE = Responses.binary(); + + private static ApiRequest retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams params) { + return ApiRequest.builder("GET", "/v3/session/imports/template/") + .params(params) + .queryFields("import_type") + .accept("text/csv") + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(SessionImportJob::fromJson)); + + private static ApiRequest retrieveRequest(String importId) { + return ApiRequest.builder("GET", "/v3/session/imports/{importId}/") + .pathParam("importId", importId) + .build(); + } + + private static final ResponseHandler> LIST_ERRORS_RESPONSE = Responses.page(Conv.model(SessionImportError::fromJson)); + + private static ApiRequest listErrorsRequest(String importId, SessionsImportsListErrorsParams params) { + return ApiRequest.builder("GET", "/v3/session/imports/{importId}/errors/") + .pathParam("importId", importId) + .params(params) + .queryFields("limit", "offset") + .build(); + } + + /** The {@code sessions.imports} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(SessionsImportsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SessionsImportsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(SessionsImportsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SessionsImportsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse create(RequestOptions options) { + return client.execute(createRequest(SessionsImportsCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(RequestOptions options) { + return client.executeAsync(createRequest(SessionsImportsCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse create() { + return client.execute(createRequest(SessionsImportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SessionsImportsCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> createAsync() { + return client.executeAsync(createRequest(SessionsImportsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse retrieveTemplate(SessionsImportsRetrieveTemplateParams params, RequestOptions options) { + return client.execute(retrieveTemplateRequest(params), options, RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveTemplateAsync(SessionsImportsRetrieveTemplateParams params, RequestOptions options) { + return client.executeAsync(retrieveTemplateRequest(params), options, RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse retrieveTemplate(SessionsImportsRetrieveTemplateParams params) { + return client.execute(retrieveTemplateRequest(params), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> retrieveTemplateAsync(SessionsImportsRetrieveTemplateParams params) { + return client.executeAsync(retrieveTemplateRequest(params), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse retrieveTemplate(RequestOptions options) { + return client.execute(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), options, RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveTemplateAsync(RequestOptions options) { + return client.executeAsync(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), options, RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse retrieveTemplate() { + return client.execute(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveTemplate(SessionsImportsRetrieveTemplateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> retrieveTemplateAsync() { + return client.executeAsync(retrieveTemplateRequest(SessionsImportsRetrieveTemplateParams.builder().build()), RequestOptions.none(), RETRIEVE_TEMPLATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param importId the {@code importId} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String importId, RequestOptions options) { + return client.execute(retrieveRequest(importId), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param importId the {@code importId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String importId, RequestOptions options) { + return client.executeAsync(retrieveRequest(importId), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param importId the {@code importId} + * @return the result + */ + public RawResponse retrieve(String importId) { + return client.execute(retrieveRequest(importId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param importId the {@code importId} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String importId) { + return client.executeAsync(retrieveRequest(importId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response. + * + * @param importId the {@code importId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> listErrors(String importId, SessionsImportsListErrorsParams params, RequestOptions options) { + return client.execute(listErrorsRequest(importId, params), options, LIST_ERRORS_RESPONSE); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response. + * + * @param importId the {@code importId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listErrorsAsync(String importId, SessionsImportsListErrorsParams params, RequestOptions options) { + return client.executeAsync(listErrorsRequest(importId, params), options, LIST_ERRORS_RESPONSE); + } + + /** + * {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param importId the {@code importId} + * @param params the request parameters + * @return the result + */ + public RawResponse> listErrors(String importId, SessionsImportsListErrorsParams params) { + return client.execute(listErrorsRequest(importId, params), RequestOptions.none(), LIST_ERRORS_RESPONSE); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param importId the {@code importId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listErrorsAsync(String importId, SessionsImportsListErrorsParams params) { + return client.executeAsync(listErrorsRequest(importId, params), RequestOptions.none(), LIST_ERRORS_RESPONSE); + } + + /** + * {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response, without parameters. + * + * @param importId the {@code importId} + * @param options per-request options + * @return the result + */ + public RawResponse> listErrors(String importId, RequestOptions options) { + return client.execute(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), options, LIST_ERRORS_RESPONSE); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response, without parameters. + * + * @param importId the {@code importId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listErrorsAsync(String importId, RequestOptions options) { + return client.executeAsync(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), options, LIST_ERRORS_RESPONSE); + } + + /** + * {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param importId the {@code importId} + * @return the result + */ + public RawResponse> listErrors(String importId) { + return client.execute(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), RequestOptions.none(), LIST_ERRORS_RESPONSE); + } + + /** + * Asynchronous {@link #listErrors(String, SessionsImportsListErrorsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param importId the {@code importId} + * @return a future completed with the result + */ + public CompletableFuture>> listErrorsAsync(String importId) { + return client.executeAsync(listErrorsRequest(importId, SessionsImportsListErrorsParams.builder().build()), RequestOptions.none(), LIST_ERRORS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/SessionsResource.java b/src/main/java/me/didit/resources/SessionsResource.java new file mode 100644 index 0000000..a823176 --- /dev/null +++ b/src/main/java/me/didit/resources/SessionsResource.java @@ -0,0 +1,2838 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.BinaryResponse; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.SessionsBatchDeleteParams; +import me.didit.types.SessionsBatchDeleteResponse; +import me.didit.types.SessionsBulkUpdateAmlHitStatusParams; +import me.didit.types.SessionsCreateParams; +import me.didit.types.SessionsCreateResponse; +import me.didit.types.SessionsDeleteParams; +import me.didit.types.SessionsDeleteResponse; +import me.didit.types.SessionsImportSharedParams; +import me.didit.types.SessionsListNetworksResponse; +import me.didit.types.SessionsListParams; +import me.didit.types.SessionsListResponse; +import me.didit.types.SessionsPreviewResubmissionParams; +import me.didit.types.SessionsPreviewResubmissionResponse; +import me.didit.types.SessionsRetrieveDecisionParams; +import me.didit.types.SessionsRetrieveDecisionResponse; +import me.didit.types.SessionsRetrieveDeletionJobResponse; +import me.didit.types.SessionsShareParams; +import me.didit.types.SessionsShareResponse; +import me.didit.types.SessionsUpdateAmlHitStatusParams; +import me.didit.types.SessionsUpdateDataParams; +import me.didit.types.SessionsUpdateDataResponse; +import me.didit.types.SessionsUpdateFeatureStatusParams; +import me.didit.types.SessionsUpdateFeatureStatusResponse; +import me.didit.types.SessionsUpdateKybCompanyDataParams; +import me.didit.types.SessionsUpdateKybCompanyDataResponse; +import me.didit.types.SessionsUpdateKybPartyParams; +import me.didit.types.SessionsUpdateKybPartyResponse; +import me.didit.types.SessionsUpdatePoaDataParams; +import me.didit.types.SessionsUpdatePoaDataResponse; +import me.didit.types.SessionsUpdateStatusParams; +import me.didit.types.SessionsUpdateStatusResponse; + +/** The {@code sessions} resource: {@code client.sessions()}. */ +public final class SessionsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + private final SessionsImportsResource imports; + private final SessionsReviewsResource reviews; + + SessionsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + this.imports = new SessionsImportsResource(client); + this.reviews = new SessionsReviewsResource(client); + } + + /** + * The {@code sessions.imports} resource. + * + * @return the resource + */ + public SessionsImportsResource imports() { + return imports; + } + + /** + * The {@code sessions.reviews} resource. + * + * @return the resource + */ + public SessionsReviewsResource reviews() { + return reviews; + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Create a verification session + * + *

Create a User Verification (KYC) or Business Verification (KYB) session and receive a hosted verification url plus a session_token to redirect or embed for your end user. The workflow_id selects which verification steps run and whether the session is KYC or KYB. + * + *

Call this from your backend (never the browser โ€” the API key is a secret) whenever a user or business needs to be verified: at signup, before a sensitive action, or when re-verification is required. Prerequisites: a published workflow (created in the Console Workflows page) and an application API key with available credits. Sandbox applications bypass the credit check. + * + *

Idempotency: when vendor_data is provided and an unfinished session (Not Started, In Progress, Resubmitted, or Awaiting User) with the same vendor_data already exists on the workflow's current latest published version (and that session already has a hosted verification URL), the existing session is returned (still 201) instead of creating a duplicate โ€” with its callback and metadata updated to the newly provided values. An unfinished session created on an older version of the workflow (one that has since been republished) is not reused; a new session pinned to the latest published version is created instead. Sessions in Approved, Declined, In Review, Expired, Abandoned, or Kyc Expired are never reused. + * + *

Side effects: the hosted verification URL is generated and stored; if contact_details.send_notification_emails is true and an email is provided, a verification invite email is sent. The session expires after the workflow's configured session expiration time. For KYB workflows, contact_details.phone and expected_details are ignored. + * + *

{@code POST /v3/session/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsCreateResponse create(SessionsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SessionsCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(SessionsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(SessionsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public SessionsCreateResponse create(SessionsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SessionsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(SessionsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Retrieve the full decision for a verification session + * + *

Retrieve the complete decision report for a verification session โ€” the rolled-up session status plus one report per verification feature the workflow executed. This is the canonical read endpoint for both User Verification (KYC) and Business Verification (KYB) sessions: the same path serves both, and the top-level session_kind discriminator tells you which shape you received ("user" or "business"). + * + *

Every feature report is a plural array. V3 workflows are graphs that can run the same feature more than once, so each block (id_verifications, nfc_verifications, liveness_checks, face_matches, poa_verifications, document_ai_documents, phone_verifications, email_verifications, aml_screenings, ip_analyses, database_validations, questionnaire_responses) is a JSON array whose items each carry a node_id identifying the workflow graph node that produced them. Read NFC as response.nfc_verifications[0] โ€” never as a singular nfc field. A block is null until the workflow has run that feature at least once; features the workflow does not include never appear with data. + * + *

When to call. The recommended pattern is event-driven: wait for the status.updated webhook that fires when the session reaches a decision (Approved, Declined, In Review), then call this endpoint once to fetch the full report. Polling also works โ€” the endpoint can be called at any point in the session lifecycle and returns the data produced so far โ€” but webhook-then-fetch is cheaper and faster. Media URLs in the response (document images, videos, PDFs) are short-lived presigned links: fetch them promptly or re-request the decision to get fresh ones, and do not persist them as long-term references. + * + *

Statuses. The top-level status is the session lifecycle status (Not Started, In Progress, Awaiting User, In Review, Approved, Declined, Resubmitted, Expired, Kyc Expired, Abandoned). Each feature item additionally carries its own feature-level status (Not Finished, Approved, Declined, In Review, ...). A session can be Approved overall while an individual feature is In Review, depending on the workflow's decision rules. + * + *

Authentication and visibility. Authenticate with the application API key in the x-api-key header (a console user Bearer token with the read:sessions permission also works). Only sessions owned by the authenticated application are visible. If your workflow restricts response attributes, non-allowed fields inside feature items are returned as null while status, warnings, and node_id are always preserved. + * + *

Rate limits. GET requests are limited to 600 per minute per API key. Exceeding the limit returns 429 with Retry-After and X-RateLimit-* headers. + * + *

{@code GET /v3/session/{sessionId}/decision/} + * + * @param sessionId UUID of the verification session whose decision you want to retrieve. This is the `session_id` returned by `POST /v3/session/`. The same path works for both User Verification (KYC) and Business Verification (KYB) sessions โ€” the server resolves the id against both session types. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsRetrieveDecisionResponse retrieveDecision(String sessionId, SessionsRetrieveDecisionParams params, RequestOptions options) { + return client.execute(retrieveDecisionRequest(sessionId, params), options, RETRIEVE_DECISION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDecisionAsync(String sessionId, SessionsRetrieveDecisionParams params, RequestOptions options) { + return client.executeAsync(retrieveDecisionRequest(sessionId, params), options, RETRIEVE_DECISION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsRetrieveDecisionResponse retrieveDecision(String sessionId, SessionsRetrieveDecisionParams params) { + return client.execute(retrieveDecisionRequest(sessionId, params), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture retrieveDecisionAsync(String sessionId, SessionsRetrieveDecisionParams params) { + return client.executeAsync(retrieveDecisionRequest(sessionId, params), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public SessionsRetrieveDecisionResponse retrieveDecision(String sessionId, RequestOptions options) { + return client.execute(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), options, RETRIEVE_DECISION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDecisionAsync(String sessionId, RequestOptions options) { + return client.executeAsync(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), options, RETRIEVE_DECISION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public SessionsRetrieveDecisionResponse retrieveDecision(String sessionId) { + return client.execute(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture retrieveDecisionAsync(String sessionId) { + return client.executeAsync(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete a verification session (KYC or KYB) + * + *

Delete a single verification session, User Verification (KYC) or Business Verification (KYB), by its session_id. The id is resolved against KYC sessions first, then KYB sessions, so both kinds are deleted through this one URL. + * + *

What is deleted: + * - The session and every verification attempt it holds, including results that a resubmission replaced: the decision, extracted data, all related feature records (ID verification, face, liveness, face match, AML, registry checks, IP analysis, and so on), its reviews and its activity log. + * - All stored files owned by the session: document front/back photos (full, cropped, and privacy-blurred variants), document-capture videos, portrait crops, NFC chip portrait and signature images, face reference images, liveness videos, face-match source/target images, Proof of Address documents, and any extra uploaded files (KYC); uploaded company documents and extra files (KYB). Previously issued media URLs (https://<media-host>/...) stop resolving. + * - The session's face data. Its face embedding is deleted too, unless you choose to keep an image-free template (see Face biometric data). + * - Webhook deliveries still queued for the session, and their retries. Webhooks already delivered are not affected. + * - For a Business Verification (KYB) session: the verifications it created for its key people (KYC) and its corporate owners (KYB), recursively, reported as deleted_child_verifications. A verification it only links to, such as an existing approved KYC it reused, is not deleted. + * + *

The session disappears from every read endpoint immediately: GET /v3/session/{sessionId}/decision/ returns 404 and GET /v3/sessions/ stops listing it. Ongoing AML monitoring and KYB registry monitoring started by the deleted verifications stop. + * + *

What is not affected: blocklist entries created from this session (face or document) are not removed; manage those with the blocklist endpoints. Share tokens issued for the session are not revoked, but there is nothing left for them to import: an import with one returns 400 with {"share_token": ["Original session does not exist."]}. Credits already consumed are not refunded. The parent User or Business entity is not deleted; use POST /v3/users/delete/ or POST /v3/businesses/delete/ for those. If the User's profile portrait came from this session, the portrait is removed with it. + * + *

Face biometric data: by default the session's face embedding is deleted with the session (face_retention_outcome: deleted). An application that opted in to biometric-template retention (face_retention_policy: retain_until_user_deleted on PATCH /v3/webhook/), or a request with retain_face_embeddings: true, keeps one separately managed, image-free face biometric template anchored to the session's User (retained_with_user) so that duplicate detection, Face Search, and biometric authentication keep working. The template never contains the face image, media, identity fields, the decision, or the deleted session's id; it is biometric data deleted at biometric_template_expires_at, or earlier on User deletion, privacy erasure, or an explicit purge through /v3/biometric-templates/. A session without a linked User cannot retain a template (ineligible_no_vendor_user). Send deletion_instruction: privacy_erasure for data-subject requests: it purges every retained template for that User and never retains a new one. + * + *

Irreversible: deletion is permanent and there is no restore endpoint. Export anything you need (for example a decision PDF) before you call it. + * + *

Side effects: no webhook is emitted for deletions. + * + *

Response: 200 OK once the deletion has completed, with a JSON body reporting the face_retention_outcome, the retained template's expiry and, for a KYB session, deleted_child_verifications. Earlier versions of this endpoint returned 204 No Content; update clients that assert on 204. Keep your instruction_id in your own erasure log. + * + *

Idempotency: not idempotent at the HTTP level: the first call returns 200; repeating it returns 404 because the session no longer resolves. After a 503 the session is still in place; repeat the same request to finish deleting it. + * + *

Authentication: send your application's API key in the x-api-key header; the session must belong to that application. Console user access tokens (Authorization: Bearer ...) may also call this endpoint when they carry the delete:sessions permission. Authentication and permission failures both return 403; this API never returns 401. + * + *

Rate limit: shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

To bulk-delete KYC sessions by their numeric session_number, use POST /v3/sessions/delete/ instead. + * + *

{@code DELETE /v3/session/{sessionId}/delete/} + * + * @param sessionId UUID (`session_id`) of the User Verification (KYC) or Business Verification (KYB) session to delete, as returned when the session was created. Must be a canonical hyphenated UUID โ€” a non-UUID value does not match the route and returns `404`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsDeleteResponse delete(String sessionId, SessionsDeleteParams params, RequestOptions options) { + return client.execute(deleteRequest(sessionId, params), options, DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String sessionId, SessionsDeleteParams params, RequestOptions options) { + return client.executeAsync(deleteRequest(sessionId, params), options, DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #delete(String, SessionsDeleteParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsDeleteResponse delete(String sessionId, SessionsDeleteParams params) { + return client.execute(deleteRequest(sessionId, params), RequestOptions.none(), DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String sessionId, SessionsDeleteParams params) { + return client.executeAsync(deleteRequest(sessionId, params), RequestOptions.none(), DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #delete(String, SessionsDeleteParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public SessionsDeleteResponse delete(String sessionId, RequestOptions options) { + return client.execute(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), options, DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String sessionId, RequestOptions options) { + return client.executeAsync(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), options, DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #delete(String, SessionsDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public SessionsDeleteResponse delete(String sessionId) { + return client.execute(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), RequestOptions.none(), DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String sessionId) { + return client.executeAsync(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), RequestOptions.none(), DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Download a PDF report for a verification session + * + *

Render and download a compliance-ready PDF report for a finished verification session. The same path serves both User Verification (KYC) and Business Verification (KYB) sessions โ€” the server resolves the sessionId against both session types and picks the matching report template. + * + *

Eligible statuses. The session must already carry a final or reviewable status: + * + *

- KYC sessions: Approved, Declined, In Review, or Kyc Expired. + * - KYB sessions: Approved, Declined, or In Review. + * + *

Any other status (Not Started, In Progress, Expired, Abandoned, โ€ฆ) returns 403 with an explanatory detail string โ€” see the 403 response below. + * + *

What the report contains. The PDF mirrors the console session view at the moment of the request: + * + *

- KYC โ€” rolled-up session status, the warnings list, and one section per executed feature: ID Verification (document images plus extracted fields), NFC, Liveness, Face Match, Email Verification, Phone Verification, Proof of Address, Questionnaire answers, Database Validation, AML Screening, and IP Analysis โ€” followed by session tags, console review activity (comments and status changes), and the session event timeline. + * - KYB โ€” registry checks (company data), AML screenings, business document verifications, key-people checks, questionnaire responses, phone/email verifications, IP analyses, and the session event timeline, followed by tags and review activity. + * + *

Branding. If your application has white-label customization, the report is rendered with your logo and links to your privacy-policy URL; otherwise it carries Didit branding. Reports are rendered in English โ€” there is no language parameter. + * + *

No caching. Every call re-renders the PDF from the current session data, so a report generated after a manual review reflects the reviewerโ€™s decision. Two calls for the same session can produce byte-different files โ€” archive the downloaded file if you need an immutable copy. + * + *

Latency. Rendering downloads every stored image (document sides, selfies, extra files) before composing the PDF, so media-heavy sessions can take several seconds. Use a generous client read timeout (60 s recommended) and stream the body to disk. + * + *

Trailing slash. The canonical route ends with a trailing slash (โ€ฆ/generate-pdf/). A request without it is served directly with the same response โ€” there is no 301 redirect, so no client has to follow redirects and curl does not need -L. Use the slashed URL as in the samples. + * + *

If you need the underlying data as JSON instead of a rendered report, use GET /v3/session/{sessionId}/decision/. For every reportable session of one user in a single document, use GET /v3/users/{vendor_data}/generate-pdf/. + * + *

{@code GET /v3/session/{sessionId}/generate-pdf/} + *

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it. + * + * @param sessionId UUID of the User Verification (KYC) or Business Verification (KYB) session to render โ€” the `session_id` returned by `POST /v3/session/`. The same path works for both session kinds; use the `Content-Disposition` filename on the response to tell which report type you received. + * @param options per-request options that override the client options + * @return the response body + */ + public BinaryResponse generatePdf(String sessionId, RequestOptions options) { + return client.execute(generatePdfRequest(sessionId), options, GENERATE_PDF_RESPONSE).data(); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture generatePdfAsync(String sessionId, RequestOptions options) { + return client.executeAsync(generatePdfRequest(sessionId), options, GENERATE_PDF_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #generatePdf(String, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public BinaryResponse generatePdf(String sessionId) { + return client.execute(generatePdfRequest(sessionId), RequestOptions.none(), GENERATE_PDF_RESPONSE).data(); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture generatePdfAsync(String sessionId) { + return client.executeAsync(generatePdfRequest(sessionId), RequestOptions.none(), GENERATE_PDF_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Approve, decline, or request resubmission for a verification session + * + *

Manually override the final decision of a KYC or KYB verification session. Set new_status to Approved or Declined to record a manual decision, or to Resubmitted to clear specific verification steps and let the user redo them through the same verification URL. The endpoint accepts both user (KYC) and business (KYB) session IDs. + * + *

Call it once a session has reached a reviewable state: the current status must be Approved, Declined, In Review, Kyc Expired, Abandoned, or Resubmitted. Sessions that are still Not Started, In Progress, or Awaiting User, or that ended as Expired, return 400. The new status must differ from the current one, and your API key's organization needs the write:sessions permission. The eligible-state check runs before body validation, so an ineligible session returns the Wrong Current Status error even when the payload is also invalid. + * + *

For Resubmitted, pass nodes_to_resubmit to choose which workflow steps the user must redo, or omit it to auto-select existing feature attempts in a resubmittable state (Declined, In Review, Not Finished, Expired). Never-attempted features are not auto-selected โ€” list them explicitly in nodes_to_resubmit, or the request returns 400 when no recorded attempt needs resubmission. Captured data for the selected steps is deleted, the steps are reordered to match the workflow graph, the session's expiration window restarts, and the original verification URL becomes usable again. Backend-only steps (AML, DATABASE_VALIDATION, IP_ANALYSIS) at the head of the list run immediately without user interaction; if every resubmitted step is backend-only, the session re-finalizes within the same request. KYB_REGISTRY and KYB_KEY_PEOPLE cannot be resubmitted directly โ€” resubmit the relevant child KYC sessions instead and the parent business session recomputes automatically. + * + *

Every successful call fires the status.updated [webhook](/integration/webhooks) once the change commits and appends an activity entry โ€” with actor attribution and your comment โ€” to the session's reviews, visible in [Get Decision](#get-/v3/session/-sessionId-/decision/) and in the console activity timeline. The user-profile aggregates linked to the session's vendor_data update as well. Declining disables ongoing AML monitoring for the session; re-approving re-enables it (from Resubmitted, Declined, or Kyc Expired) when the workflow has monitoring turned on. Approving or declining a child KYC that belongs to a KYB key-people check recomputes the parent business session's status. Set send_email: true (with email_address) to notify the user: a status notice for Approved/Declined, or a resubmission email containing the verification link and per-step reasons for Resubmitted. + * + *

The operation is intentionally not repeatable with the same value: re-sending the current status returns 400 (The new status is the same as the current status.), so accidental double-submissions are harmless. Authentication and permission failures both return 403 โ€” this API never responds 401. + * + *

{@code PATCH /v3/session/{sessionId}/update-status/} + * + * @param sessionId UUID of the verification session to update. Accepts both user (KYC) and business (KYB) session IDs โ€” the service resolves the ID across both session types. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsUpdateStatusResponse updateStatus(String sessionId, SessionsUpdateStatusParams params, RequestOptions options) { + return client.execute(updateStatusRequest(sessionId, params), options, UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateStatusAsync(String sessionId, SessionsUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(updateStatusRequest(sessionId, params), options, UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsUpdateStatusResponse updateStatus(String sessionId, SessionsUpdateStatusParams params) { + return client.execute(updateStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateStatusAsync(String sessionId, SessionsUpdateStatusParams params) { + return client.executeAsync(updateStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List verification sessions (KYC and/or KYB) with filters and pagination + * + *

Returns a paginated list of verification sessions for the application identified by your API key, newest first (descending session_number). + * + *

Canonical URL: the route is /v3/sessions/ (trailing slash). Requests to /v3/sessions without the slash receive a 301 redirect to the slashed URL with the query string preserved; most HTTP clients follow it transparently on GET. + * + *

When to use this endpoint vs webhooks. Use this endpoint for dashboards, back-office search, reconciliation, and batch exports. Do not poll it to track the progress of individual verifications - configure [webhooks](/integration/webhooks) instead, which push status.updated events the moment a session changes. For one session's full result, call GET /v3/session/{sessionId}/decision/. + * + *

KYC and KYB sessions. session_kind selects which kinds are listed: + * - user (default) - User Verification (KYC) sessions only. Backward-compatible behavior. + * - business - Business Verification (KYB) sessions only. Rows have a different, smaller shape (see the response schema). + * - all - both kinds in one response: the KYC page and the KYB page for the same limit/offset are concatenated in results (KYC rows first), so a page can contain up to 2 x limit rows. count is the sum of both kinds and next/previous reflect the KYC-side pagination. For strict pagination of mixed data, call user and business separately. + * + *

Every row carries a session_kind discriminator ("user" or "business"). + * + *

Pagination. Standard limit/offset: limit (default 50) and offset (default 0), with next/previous ready-made page URLs. For KYC rows count is exact. For KYB rows count is computed with a bounded scan and is capped at 100 - when there are more than 100 matches it stays at 100, so iterate using next (or by checking whether a full page came back) rather than computing total pages from count. + * + *

Filter semantics. All filters combine with AND and apply to KYC rows. When session_kind is business or all, the KYB side honors the shared parameters vendor_data, status, workflow_id, country (registry-company country code), date_from, date_to, search (company name, registration number โ€” type registration numbers without separators, e.g. DPC001 not DPC-001 โ€” vendor_data, session number, or session UUID), warning, and organization_name; the remaining KYC-only filters are ignored for KYB rows. Comma-separated parameters (status, country, document_type, region, workflow_id, document_name, warning, organization_name, session_type) match any of the listed values (OR within the parameter). vendor_data is an exact match - use search for partial matching. Unknown values in list filters simply return no rows (no error); malformed typed values (date_from, date_to, didit_internal_id, api_service, session_kind) return 400 with a per-field error object. + * + *

Search. search adapts to the input: a full UUID looks up session_id; digits (with optional + - . space) match session-number prefix, document/personal numbers, phone-number prefix, or vendor_data; values containing @ match email prefixes; any other text matches names (accent-insensitive) and vendor_data. + * + *

No fixed per-endpoint rate limit is enforced, but keep list polling infrequent and rely on webhooks for real-time updates. + * + *

{@code GET /v3/sessions/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(SessionsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(SessionsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(SessionsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(SessionsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(SessionsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(SessionsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(SessionsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(SessionsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(SessionsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(SessionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(SessionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Mint a share token for a finished verification session + * + *

Mint a short-lived JWT that lets a specific Didit application import this finished session. Pair with POST /v3/session/import-shared/. + * + *

{@code POST /v3/session/{sessionId}/share/} + * + * @param sessionId UUID of the source verification session to mint a token for. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsShareResponse share(String sessionId, SessionsShareParams params, RequestOptions options) { + return client.execute(shareRequest(sessionId, params), options, SHARE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #share(String, SessionsShareParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture shareAsync(String sessionId, SessionsShareParams params, RequestOptions options) { + return client.executeAsync(shareRequest(sessionId, params), options, SHARE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #share(String, SessionsShareParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsShareResponse share(String sessionId, SessionsShareParams params) { + return client.execute(shareRequest(sessionId, params), RequestOptions.none(), SHARE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #share(String, SessionsShareParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture shareAsync(String sessionId, SessionsShareParams params) { + return client.executeAsync(shareRequest(sessionId, params), RequestOptions.none(), SHARE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Redeem a share token to clone a verification session into your application + * + *

Redeem a share token to clone a KYC or KYB session into the calling application with a fresh session_id. Not idempotent โ€” a token redeems once per receiver. + * + *

{@code POST /v3/session/import-shared/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public JsonNode importShared(SessionsImportSharedParams params, RequestOptions options) { + return client.execute(importSharedRequest(params), options, IMPORT_SHARED_RESPONSE).data(); + } + + /** + * Asynchronous {@link #importShared(SessionsImportSharedParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture importSharedAsync(SessionsImportSharedParams params, RequestOptions options) { + return client.executeAsync(importSharedRequest(params), options, IMPORT_SHARED_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #importShared(SessionsImportSharedParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public JsonNode importShared(SessionsImportSharedParams params) { + return client.execute(importSharedRequest(params), RequestOptions.none(), IMPORT_SHARED_RESPONSE).data(); + } + + /** + * Asynchronous {@link #importShared(SessionsImportSharedParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture importSharedAsync(SessionsImportSharedParams params) { + return client.executeAsync(importSharedRequest(params), RequestOptions.none(), IMPORT_SHARED_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Bulk delete KYC sessions by session_number + * + *

Bulk delete User Verification (KYC) sessions by their numeric session_number, or every KYC session in your application with delete_all: true. + * + *

session_number is the human-friendly incrementing counter shown in the Console session list and returned as session_number by the create-session and decision endpoints; it is not the session_id UUID. To delete a session by UUID, or to delete a Business Verification (KYB) session, which this endpoint never touches, use DELETE /v3/session/{sessionId}/delete/ instead. + * + *

Up to 20 sessions are deleted in the request, more run as a job. The number of matching sessions decides, whether they are selected by session_numbers or with delete_all: + * - Up to 20 matching sessions: they are deleted before the response, which is 200 with one entry per session in results[]. + * - More than 20: the response is 202 with a deletion job, and the sessions are deleted in the background. Poll GET /v3/sessions/delete/{job_id}/ until status is COMPLETED or FAILED. A job reports counts per outcome, never which sessions it deleted. A delete_all job deletes only the sessions created before the request; sessions started while it runs are not deleted. + * + *

Each deleted session gets exactly the same treatment as the single-session delete endpoint: the session, every verification attempt it holds, its decision and extracted data, its related feature records (ID verification, face, liveness, face match, and so on) and all of its stored files are deleted, it disappears from every read endpoint, and previously issued media URLs stop resolving. Webhook deliveries still queued for a deleted session, and their retries, are dropped; webhooks already delivered are not affected. Blocklist entries are not removed, credits already consumed are not refunded, and the parent User entities are not deleted (use POST /v3/users/delete/ for those); no webhook is emitted for the deletion. Deletion is permanent and irreversible. + * + *

Selection semantics: + * - Entries in session_numbers that do not match a live KYC session in your application (unknown numbers, already-deleted sessions, or sessions owned by another application) are silently skipped: they do not appear in results and are not counted in a job's total. + * - Validation failures (a non-numeric entry, an empty list, neither session_numbers nor delete_all provided, or a template retention the application cannot honour) reject the whole request with 400 and delete nothing. + * - Sessions are deleted in groups. If a group cannot be deleted (for example because a storage service is unavailable), every session in that group is reported as face_retention_outcome: failed_retryable and stays in place; the other groups are unaffected. Repeat the request for those sessions. A job retries such a group by itself. + * - There is no documented cap on the list length; the shared write rate limit (below) is the practical bound. + * + *

Face biometric data: the optional retain_face_embeddings, face_retention_days, face_retention_deadline, deletion_instruction, and instruction_id fields have the same meaning as on DELETE /v3/session/{sessionId}/delete/ and apply to every matched session. Each result reports its own face_retention_outcome. + * + *

Response: 200 OK with results[] for up to 20 matching sessions, or 202 Accepted with a deletion job for more. Every result confirms deletion except face_retention_outcome: failed_retryable, which reports a session that was NOT deleted and should be retried. Earlier versions of this endpoint returned 204 No Content; update clients that assert on 204. + * + *

Idempotency: repeating the same request deletes nothing more: numbers that no longer match a session are skipped. + * + *

**delete_all: true (destructive): deletes every** remaining KYC session in the application; session_numbers is ignored when set. There is no confirmation step and no undo. + * + *

Authentication: API key in the x-api-key header. Missing or invalid credentials return 403 ({"detail": "You do not have permission to perform this action."}); this API never returns 401. + * + *

Rate limit: shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints; exceeding it returns 429. + * + *

This endpoint accepts API keys only. Business Console user Bearer tokens are rejected with 403 (unlike the single-session delete, which accepts both). + * + *

{@code POST /v3/sessions/delete/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsBatchDeleteResponse batchDelete(SessionsBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(SessionsBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public SessionsBatchDeleteResponse batchDelete(SessionsBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(SessionsBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public SessionsBatchDeleteResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public SessionsBatchDeleteResponse batchDelete() { + return client.execute(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get a bulk session deletion job + * + *

Progress of a bulk session deletion that POST /v3/sessions/delete/ answered with 202 (more than 20 matching sessions, selected by session_numbers or with delete_all). Poll every few seconds while status is PENDING or PROCESSING; stop when it is COMPLETED or FAILED. + * + *

The job reports how many sessions ended in each outcome and how many it has processed, never which sessions it deleted. A FAILED job carries the reason in error; the sessions it had not reached are still in place, so repeat the deletion request to delete them. + * + *

Authentication: API key in the x-api-key header. A job is only visible to the application that created it; any other job_id returns 404. Missing or invalid credentials return 403; this API never returns 401. + * + *

{@code GET /v3/sessions/delete/{job_id}/} + * + * @param jobId The `job_id` returned with the `202` from `POST /v3/sessions/delete/`. + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsRetrieveDeletionJobResponse retrieveDeletionJob(String jobId, RequestOptions options) { + return client.execute(retrieveDeletionJobRequest(jobId), options, RETRIEVE_DELETION_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDeletionJob(String, RequestOptions)}. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveDeletionJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveDeletionJobRequest(jobId), options, RETRIEVE_DELETION_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveDeletionJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public SessionsRetrieveDeletionJobResponse retrieveDeletionJob(String jobId) { + return client.execute(retrieveDeletionJobRequest(jobId), RequestOptions.none(), RETRIEVE_DELETION_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveDeletionJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveDeletionJobAsync(String jobId) { + return client.executeAsync(retrieveDeletionJobRequest(jobId), RequestOptions.none(), RETRIEVE_DELETION_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update KYC data extracted from the ID document on a verification session + * + *

Correct the identity fields that were extracted (OCR / NFC) from the user's ID document โ€” misread names, dates, document numbers, and so on โ€” after the verification has finished. Typical callers are a compliance analyst working from your own back office, or an automated reconciliation job. Every field in the body is optional: only the keys you send are written, everything else is left untouched (PATCH semantics). + * + *

The session must belong to your application and be in Approved, Declined, In Review, or Kyc Expired status. Sessions in any other state (e.g. still In Progress) return 404 with "No Session matches the given query." โ€” distinct from the "Not found." returned for an unknown or deleted sessionId. The session must also carry an ID-verification (KYC) record: sessions whose workflow never ran an ID-verification step return 404 ("The session does not have a KYC."). For graph workflows with multiple ID-verification steps, target a specific step with node_id (query parameter or body field); when omitted, the most recent KYC record is patched. + * + *

Two derived fields are recomputed on every call: full_name (from first_name + last_name) and issuing_state_name (from issuing_state). If the free-text address changes, the server may also re-geocode it and refresh parsed_address (skipped for sandbox sessions). extra_fields and parsed_address are merged key-by-key rather than replaced โ€” see the per-field descriptions for the null-to-delete semantics. + * + *

Submitting at least one valid field fires the data.updated [webhook](/integration/webhooks) (trigger manual_review) โ€” even when the submitted values equal the stored ones. When values actually change, a KYC_DATA_UPDATED activity entry recording the changed fields with previous and new values is appended to the session's reviews, visible in [Get Decision](#get-/v3/session/-sessionId-/decision/) and the console activity timeline. The session's status and decision are not re-evaluated โ€” use [Update Status](#patch-/v3/session/-sessionId-/update-status/) to change the outcome. An empty JSON body ({}) is accepted and simply returns the current KYC data without firing the webhook. + * + *

Accepts an API key or a console user token; either way the credential needs the write:sessions permission. Authentication and permission failures both return 403 โ€” this API never responds 401. Note that the session lookup runs before credential checks, so an unknown sessionId returns 404 even with missing credentials. This endpoint has a dedicated rate limit of 10 requests per minute per API key (invalid requests count too); the shared write budget of 300 requests per minute also applies. + * + *

{@code PATCH /v3/session/{sessionId}/update-data/} + * + * @param sessionId UUID of the User Verification (KYC) session whose extracted document data you are correcting. Business (KYB) session IDs are not valid here โ€” for company data use [Update KYB Company Data](#patch-/v3/session/-sessionId-/kyb/-companyUuid-/update-data/). + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsUpdateDataResponse updateData(String sessionId, SessionsUpdateDataParams params, RequestOptions options) { + return client.execute(updateDataRequest(sessionId, params), options, UPDATE_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateDataAsync(String sessionId, SessionsUpdateDataParams params, RequestOptions options) { + return client.executeAsync(updateDataRequest(sessionId, params), options, UPDATE_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsUpdateDataResponse updateData(String sessionId, SessionsUpdateDataParams params) { + return client.execute(updateDataRequest(sessionId, params), RequestOptions.none(), UPDATE_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateDataAsync(String sessionId, SessionsUpdateDataParams params) { + return client.executeAsync(updateDataRequest(sessionId, params), RequestOptions.none(), UPDATE_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public SessionsUpdateDataResponse updateData(String sessionId, RequestOptions options) { + return client.execute(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), options, UPDATE_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateDataAsync(String sessionId, RequestOptions options) { + return client.executeAsync(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), options, UPDATE_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public SessionsUpdateDataResponse updateData(String sessionId) { + return client.execute(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), RequestOptions.none(), UPDATE_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture updateDataAsync(String sessionId) { + return client.executeAsync(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), RequestOptions.none(), UPDATE_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update an individual feature (step) status + * + *

Set the status of a single verification feature (step) within a session without changing the overall session decision. Target the feature by its workflow graph nodeId (use default for non-graph workflows where the step has no node). + * + *

Works for both User Verification (KYC) and Business Verification (KYB) sessions and every step type โ€” ID/OCR, Liveness, Face Match, NFC, AML, Proof of Address, Phone, Email, Database Validation, Questionnaire, and the KYB registry / documents / key-people checks. + * + *

new_status must be one of Approved, Declined, or In Review, and must differ from the feature's current status. A successful call fires a data.updated webhook and appends an activity entry (with actor attribution) to the session's review trail. This endpoint is not available for standalone API sessions (session_type = API). + * + *

Authenticate with your API key (x-api-key) or a user authorization header โ€” either must carry the write:sessions privilege. + * + *

{@code PATCH /v3/session/{sessionId}/features/{nodeId}/update-status/} + * + * @param sessionId UUID of the verification session. Accepts both user (KYC) and business (KYB) session IDs โ€” the service resolves the ID across both session types. + * @param nodeId Workflow graph node ID of the feature to update (for example `feature_ocr_1`). Use the literal value `default` for non-graph (single-step) workflows where the feature has no node ID. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsUpdateFeatureStatusResponse updateFeatureStatus(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params, RequestOptions options) { + return client.execute(updateFeatureStatusRequest(sessionId, nodeId, params), options, UPDATE_FEATURE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateFeatureStatusAsync(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params, RequestOptions options) { + return client.executeAsync(updateFeatureStatusRequest(sessionId, nodeId, params), options, UPDATE_FEATURE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @return the result + */ + public SessionsUpdateFeatureStatusResponse updateFeatureStatus(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params) { + return client.execute(updateFeatureStatusRequest(sessionId, nodeId, params), RequestOptions.none(), UPDATE_FEATURE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateFeatureStatusAsync(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params) { + return client.executeAsync(updateFeatureStatusRequest(sessionId, nodeId, params), RequestOptions.none(), UPDATE_FEATURE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update an AML hit review status + * + *

Set the review status of a single AML hit (a potential sanction / PEP / watchlist / adverse-media match) returned by AML screening, without changing the overall session decision. Identify the hit by its hit_id (the id of an entry in the AML check's hits array โ€” see the session decision). + * + *

review_status is one of Unreviewed, Confirmed Match, False Positive, or Inconclusive. Reviewer decisions are preserved across ongoing-monitoring updates, so a hit you mark False Positive stays that way when the provider re-screens. + * + *

A successful call fires a data.updated webhook and appends an activity entry (with actor attribution) to the session's review trail. For graph workflows with multiple AML checks, pass node_id to target a specific check. + * + *

Authenticate with your API key (x-api-key) or a user authorization header โ€” either must carry the write:sessions privilege. + * + *

{@code PATCH /v3/session/{sessionId}/update-aml-hit-status/} + * + * @param sessionId UUID of the verification session. Accepts both user (KYC) and business (KYB) session IDs โ€” the service resolves the ID across both session types. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public JsonNode updateAmlHitStatus(String sessionId, SessionsUpdateAmlHitStatusParams params, RequestOptions options) { + return client.execute(updateAmlHitStatusRequest(sessionId, params), options, UPDATE_AML_HIT_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAmlHitStatusAsync(String sessionId, SessionsUpdateAmlHitStatusParams params, RequestOptions options) { + return client.executeAsync(updateAmlHitStatusRequest(sessionId, params), options, UPDATE_AML_HIT_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public JsonNode updateAmlHitStatus(String sessionId, SessionsUpdateAmlHitStatusParams params) { + return client.execute(updateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_AML_HIT_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAmlHitStatusAsync(String sessionId, SessionsUpdateAmlHitStatusParams params) { + return client.executeAsync(updateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_AML_HIT_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Bulk update AML hit review statuses + * + *

Update the review status of multiple AML hits in one call. Provide hit_updates, a list of { hit_id, review_status } pairs. review_status is one of Unreviewed, Confirmed Match, False Positive, or Inconclusive. + * + *

The update is all-or-nothing: if any hit_id is not found in the AML check, the request returns 404 and no hit is changed. A successful call fires a single data.updated webhook and records one activity entry covering all changes. For graph workflows with multiple AML checks, pass node_id to target a specific check. + * + *

Authenticate with your API key (x-api-key) or a user authorization header โ€” either must carry the write:sessions privilege. + * + *

{@code PATCH /v3/session/{sessionId}/bulk-update-aml-hit-status/} + * + * @param sessionId UUID of the verification session. Accepts both user (KYC) and business (KYB) session IDs โ€” the service resolves the ID across both session types. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public JsonNode bulkUpdateAmlHitStatus(String sessionId, SessionsBulkUpdateAmlHitStatusParams params, RequestOptions options) { + return client.execute(bulkUpdateAmlHitStatusRequest(sessionId, params), options, BULK_UPDATE_AML_HIT_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture bulkUpdateAmlHitStatusAsync(String sessionId, SessionsBulkUpdateAmlHitStatusParams params, RequestOptions options) { + return client.executeAsync(bulkUpdateAmlHitStatusRequest(sessionId, params), options, BULK_UPDATE_AML_HIT_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public JsonNode bulkUpdateAmlHitStatus(String sessionId, SessionsBulkUpdateAmlHitStatusParams params) { + return client.execute(bulkUpdateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), BULK_UPDATE_AML_HIT_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture bulkUpdateAmlHitStatusAsync(String sessionId, SessionsBulkUpdateAmlHitStatusParams params) { + return client.executeAsync(bulkUpdateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), BULK_UPDATE_AML_HIT_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update Proof of Address data extracted from the POA document on a verification session + * + *

Correct the fields extracted from the user's Proof of Address document โ€” utility bill, bank statement, or other address evidence โ€” after the verification has finished: issuer, dates, the printed name, the address itself, and banking details. Every field in the body is optional: only the keys you send are written, everything else is left untouched (PATCH semantics). + * + *

The session must belong to your application and be in Approved, Declined, In Review, or Kyc Expired status. Sessions in any other state (e.g. still In Progress) return 404 with "No Session matches the given query." โ€” distinct from the "Not found." returned for an unknown or deleted sessionId. The session must also carry a POA record: sessions whose workflow never ran a Proof of Address step return 404 ("The session does not have a POA."). For graph workflows with multiple POA steps, target a specific step with node_id (query parameter or body field); when omitted, the most recent POA record is patched. + * + *

extra_fields is merged key-by-key: nine known keys (bank_iban, additional_names, โ€ฆ) write through to dedicated POA columns, any other key is kept as a custom extra, and null / "" deletes a key. poa_parsed_address accepts only the seven documented keys and recomputes formatted_address / poa_formatted_address after every edit. If the free-text poa_address changes, the server may also re-geocode it and refresh the structured address (skipped for sandbox sessions). + * + *

Unlike the KYC variant of this endpoint, the data.updated [webhook](/integration/webhooks) (trigger manual_review) fires only when at least one stored value actually changed โ€” re-sending identical values is a silent no-op. When values change, a POA_DATA_UPDATED activity entry recording the changed fields with previous and new values is appended to the session's reviews, visible in [Get Decision](#get-/v3/session/-sessionId-/decision/) and the console activity timeline. The session's status and decision are not re-evaluated โ€” use [Update Status](#patch-/v3/session/-sessionId-/update-status/) to change the outcome. + * + *

Accepts an API key or a console user token; either way the credential needs the write:sessions permission. Authentication and permission failures both return 403 โ€” this API never responds 401. Note that the session lookup runs before credential checks, so an unknown sessionId returns 404 even with missing credentials. This endpoint has a dedicated rate limit of 10 requests per minute per API key (invalid requests count too); the shared write budget of 300 requests per minute also applies. + * + *

An empty JSON body {} is a no-op: it returns 200 echoing the current POA record without firing the webhook (has_changes stays false). + * + *

{@code PATCH /v3/session/{sessionId}/update-poa-data/} + * + * @param sessionId UUID of the User Verification (KYC) session whose attached POA record you are correcting. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsUpdatePoaDataResponse updatePoaData(String sessionId, SessionsUpdatePoaDataParams params, RequestOptions options) { + return client.execute(updatePoaDataRequest(sessionId, params), options, UPDATE_POA_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updatePoaDataAsync(String sessionId, SessionsUpdatePoaDataParams params, RequestOptions options) { + return client.executeAsync(updatePoaDataRequest(sessionId, params), options, UPDATE_POA_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsUpdatePoaDataResponse updatePoaData(String sessionId, SessionsUpdatePoaDataParams params) { + return client.execute(updatePoaDataRequest(sessionId, params), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updatePoaDataAsync(String sessionId, SessionsUpdatePoaDataParams params) { + return client.executeAsync(updatePoaDataRequest(sessionId, params), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public SessionsUpdatePoaDataResponse updatePoaData(String sessionId, RequestOptions options) { + return client.execute(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), options, UPDATE_POA_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updatePoaDataAsync(String sessionId, RequestOptions options) { + return client.executeAsync(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), options, UPDATE_POA_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public SessionsUpdatePoaDataResponse updatePoaData(String sessionId) { + return client.execute(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture updatePoaDataAsync(String sessionId) { + return client.executeAsync(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update registry-extracted company data on a Business Verification (KYB) session + * + *

Correct the registry-extracted company data on a Business Verification (KYB) session โ€” company name, registration number, addresses, status, contact details โ€” identified by companyUuid. Typical callers are a compliance analyst fixing a registry misread, or your back office syncing corrected company data. Every field in the body is optional (PATCH semantics); an empty JSON body ({}) is a no-op that simply echoes the current company record. + * + *

Edits are written in two places at once: fields with a canonical company column (name, registration number, country, incorporation date, tax number, type, statuses, capital fields (registered_capital, registered_capital_amount, registered_capital_currency), alternative names, nature of business, website, email, phone, LEI, location, and legal_address โ†’ registered_address) update that column, and every submitted key is also merged into the registry_data snapshot (dates as ISO strings) so the "extracted from registry" view reflects the correction. Fields without a column โ€” region, registration_date, dissolution_date, control_scheme โ€” land in registry_data only. user_provided_data (what the end user confirmed in the hosted flow) is never touched, and last_console_edit_at is stamped on every non-empty PATCH. + * + *

Unlike the KYC/POA update endpoints, there is no session-status gate: the company can be edited at any point in the business session's lifecycle. The company must belong to the session in the path (404 with "KYB company does not belong to the given session." otherwise) and to your application. Every non-empty PATCH fires the data.updated [webhook](/integration/webhooks) on the business session (trigger console_registry_edit) โ€” even when the submitted values equal the stored ones. The session's status and decision are not re-evaluated, and no review/audit entry is recorded. + * + *

Accepts an API key or a console user token; either way the credential needs the write:businesses permission. Authentication and permission failures both return 403 โ€” this API never responds 401. Note that the session lookup runs before credential checks, so an unknown sessionId returns 404 even with missing credentials. The shared write budget of 300 requests per minute per API key applies. + * + *

For User Verification sessions, the KYC counterpart is PATCH /v3/session/{sessionId}/update-data/; to change the session decision itself use PATCH /v3/session/{sessionId}/update-status/. + * + *

{@code PATCH /v3/session/{sessionId}/kyb/{companyUuid}/update-data/} + * + * @param sessionId UUID of the parent Business Verification (KYB) session. + * @param companyUuid UUID of the company record to update (`registry_checks[].company.uuid` on the business session decision). Must belong to the session referenced by `sessionId`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsUpdateKybCompanyDataResponse updateKybCompanyData(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params, RequestOptions options) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, params), options, UPDATE_KYB_COMPANY_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateKybCompanyDataAsync(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params, RequestOptions options) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, params), options, UPDATE_KYB_COMPANY_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @return the result + */ + public SessionsUpdateKybCompanyDataResponse updateKybCompanyData(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, params), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateKybCompanyDataAsync(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, params), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param options per-request options + * @return the result + */ + public SessionsUpdateKybCompanyDataResponse updateKybCompanyData(String sessionId, String companyUuid, RequestOptions options) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), options, UPDATE_KYB_COMPANY_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateKybCompanyDataAsync(String sessionId, String companyUuid, RequestOptions options) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), options, UPDATE_KYB_COMPANY_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @return the result + */ + public SessionsUpdateKybCompanyDataResponse updateKybCompanyData(String sessionId, String companyUuid) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @return a future completed with the result + */ + public CompletableFuture updateKybCompanyDataAsync(String sessionId, String companyUuid) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Skip (or re-require) a Key People party on a Business Verification (KYB) session + * + *

Exempt a Key People party from verification, or put it back in scope. This is the operator escape hatch for a party that can never finish its own check - most often because the individual KYC session handed to a UBO or director was deleted, which freezes that child's status and leaves the KYB parked in Awaiting User with nothing left that could move it. + * + *

Setting is_skipped: true drops the party out of the Key People aggregation and immediately recomputes the KYBKeyPeopleCheck and the parent session status, so the business session can settle and then be approved or declined. Sending is_skipped: false puts the party back in scope and the check goes back to waiting on it. + * + *

Unlike the applicant-facing skip in the hosted Key People screen, this endpoint is not gated by the role's allow_skip setting - that flag limits what the applicant may decide, not what your analyst may override. requires_verification is deliberately left untouched, so an overridden party reads as requires_verification: true and is_skipped: true and the record still shows what the rules asked for. + * + *

The party must belong to the session in the path (404 with "Party does not belong to the given session." otherwise) and to your application. A PATCH that actually changes the flag fires the data.updated [webhook](/integration/webhooks) on the business session with trigger console_key_people_skip; a PATCH that sets the flag to its current value is a no-op that echoes the party back. + * + *

Accepts an API key or a console user token; either way the credential needs the write:businesses permission. + * + *

{@code PATCH /v3/session/{sessionId}/kyb/parties/{partyUuid}/} + * + * @param sessionId UUID of the parent Business Verification (KYB) session. + * @param partyUuid UUID of the Key People party to update (`key_people_checks[].submitted.parties[].uuid` on the business session decision). Must belong to the session referenced by `sessionId`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsUpdateKybPartyResponse updateKybParty(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params, RequestOptions options) { + return client.execute(updateKybPartyRequest(sessionId, partyUuid, params), options, UPDATE_KYB_PARTY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateKybPartyAsync(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params, RequestOptions options) { + return client.executeAsync(updateKybPartyRequest(sessionId, partyUuid, params), options, UPDATE_KYB_PARTY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @return the result + */ + public SessionsUpdateKybPartyResponse updateKybParty(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params) { + return client.execute(updateKybPartyRequest(sessionId, partyUuid, params), RequestOptions.none(), UPDATE_KYB_PARTY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateKybPartyAsync(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params) { + return client.executeAsync(updateKybPartyRequest(sessionId, partyUuid, params), RequestOptions.none(), UPDATE_KYB_PARTY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List networks for a session + * + *

List the networks the session's vendor user belongs to. Resolves through the session's vendor_data-linked user. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/sessions/{session_id}/networks/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param sessionId Session UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsListNetworksResponse listNetworks(String sessionId, RequestOptions options) { + return client.execute(listNetworksRequest(sessionId), options, LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String sessionId, RequestOptions options) { + return client.executeAsync(listNetworksRequest(sessionId), options, LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code session_id} + * @return the result + */ + public SessionsListNetworksResponse listNetworks(String sessionId) { + return client.execute(listNetworksRequest(sessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code session_id} + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String sessionId) { + return client.executeAsync(listNetworksRequest(sessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Preview a resubmission email + * + *

Render the email that would accompany a KYC or KYB resubmission without changing the session, resetting checks, extending its expiry, running checks or sending mail. Requires write:sessions and an application-scoped session in Approved, Declined, In Review, Kyc Expired or Abandoned status. The server validates the selected workflow steps and renders its fixed translated template with the applicable verified white-label sender and branding. The request cannot set a subject, message body or action URL. + * + *

The response includes the recipient, sender, subject, HTML, resolved steps and a signed preview_token. requires_user_action describes whether the selected steps include an interactive check. Email delivery remains conditional: if automatic checks finalize the verification during the subsequent resubmission, no action-request email is sent. + * + *

This preview does not reserve session state or authorize delivery. After reviewing it, call Update Session Status with new_status=Resubmitted, the same selection, recipient and language, and email_preview_token set to the returned preview_token. The receipt expires after 15 minutes. When a receipt is supplied, changed inputs, message content, sender or session state return 409 before any mutation or send. Existing integrations may omit the receipt. Regenerate the preview after a conflict. Treat the response as sensitive verification content; responses use Cache-Control: no-store. Render HTML in a sandboxed frame, never directly in your application DOM. + * + *

{@code POST /v3/session/{sessionId}/resubmission-preview/} + * + * @param sessionId UUID of the verification session to update. Accepts both user (KYC) and business (KYB) session IDs โ€” the service resolves the ID across both session types. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsPreviewResubmissionResponse previewResubmission(String sessionId, SessionsPreviewResubmissionParams params, RequestOptions options) { + return client.execute(previewResubmissionRequest(sessionId, params), options, PREVIEW_RESUBMISSION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)}. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture previewResubmissionAsync(String sessionId, SessionsPreviewResubmissionParams params, RequestOptions options) { + return client.executeAsync(previewResubmissionRequest(sessionId, params), options, PREVIEW_RESUBMISSION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public SessionsPreviewResubmissionResponse previewResubmission(String sessionId, SessionsPreviewResubmissionParams params) { + return client.execute(previewResubmissionRequest(sessionId, params), RequestOptions.none(), PREVIEW_RESUBMISSION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture previewResubmissionAsync(String sessionId, SessionsPreviewResubmissionParams params) { + return client.executeAsync(previewResubmissionRequest(sessionId, params), RequestOptions.none(), PREVIEW_RESUBMISSION_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(SessionsCreateResponse::fromJson)); + + private static ApiRequest createRequest(SessionsCreateParams params) { + return ApiRequest.builder("POST", "/v3/session/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_DECISION_RESPONSE = Responses.json(Conv.model(SessionsRetrieveDecisionResponse::fromJson)); + + private static ApiRequest retrieveDecisionRequest(String sessionId, SessionsRetrieveDecisionParams params) { + return ApiRequest.builder("GET", "/v3/session/{sessionId}/decision/") + .pathParam("sessionId", sessionId) + .params(params) + .queryFields("include") + .build(); + } + + private static final ResponseHandler DELETE_RESPONSE = Responses.json(Conv.model(SessionsDeleteResponse::fromJson)); + + private static ApiRequest deleteRequest(String sessionId, SessionsDeleteParams params) { + return ApiRequest.builder("DELETE", "/v3/session/{sessionId}/delete/") + .pathParam("sessionId", sessionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler GENERATE_PDF_RESPONSE = Responses.binary(); + + private static ApiRequest generatePdfRequest(String sessionId) { + return ApiRequest.builder("GET", "/v3/session/{sessionId}/generate-pdf/") + .pathParam("sessionId", sessionId) + .accept("application/pdf") + .build(); + } + + private static final ResponseHandler UPDATE_STATUS_RESPONSE = Responses.json(Conv.model(SessionsUpdateStatusResponse::fromJson)); + + private static ApiRequest updateStatusRequest(String sessionId, SessionsUpdateStatusParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/update-status/") + .pathParam("sessionId", sessionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.union(SessionsListResponse.Results::fromJson)); + + private static ApiRequest listRequest(SessionsListParams params) { + return ApiRequest.builder("GET", "/v3/sessions/") + .params(params) + .queryFields("session_kind", "limit", "offset", "status", "vendor_data", "search", "workflow_id", "date_from", "date_to", "country", "document_type", "document_name", "region", "didit_internal_id", "session_type", "api_service", "screened_full_name", "warning", "status_initialized_as_in_review", "is_kyc_to_be_reviewed", "euuid", "organization_name") + .build(); + } + + private static final ResponseHandler SHARE_RESPONSE = Responses.json(Conv.model(SessionsShareResponse::fromJson)); + + private static ApiRequest shareRequest(String sessionId, SessionsShareParams params) { + return ApiRequest.builder("POST", "/v3/session/{sessionId}/share/") + .pathParam("sessionId", sessionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler IMPORT_SHARED_RESPONSE = Responses.jsonNode(); + + private static ApiRequest importSharedRequest(SessionsImportSharedParams params) { + return ApiRequest.builder("POST", "/v3/session/import-shared/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler BATCH_DELETE_RESPONSE = Responses.byStatus(SessionsBatchDeleteResponse::fromResponse); + + private static ApiRequest batchDeleteRequest(SessionsBatchDeleteParams params) { + return ApiRequest.builder("POST", "/v3/sessions/delete/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_DELETION_JOB_RESPONSE = Responses.json(Conv.model(SessionsRetrieveDeletionJobResponse::fromJson)); + + private static ApiRequest retrieveDeletionJobRequest(String jobId) { + return ApiRequest.builder("GET", "/v3/sessions/delete/{job_id}/") + .pathParam("job_id", jobId) + .build(); + } + + private static final ResponseHandler UPDATE_DATA_RESPONSE = Responses.json(Conv.model(SessionsUpdateDataResponse::fromJson)); + + private static ApiRequest updateDataRequest(String sessionId, SessionsUpdateDataParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/update-data/") + .pathParam("sessionId", sessionId) + .params(params) + .queryFields("node_id") + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_FEATURE_STATUS_RESPONSE = Responses.json(Conv.model(SessionsUpdateFeatureStatusResponse::fromJson)); + + private static ApiRequest updateFeatureStatusRequest(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/features/{nodeId}/update-status/") + .pathParam("sessionId", sessionId) + .pathParam("nodeId", nodeId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_AML_HIT_STATUS_RESPONSE = Responses.jsonNode(); + + private static ApiRequest updateAmlHitStatusRequest(String sessionId, SessionsUpdateAmlHitStatusParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/update-aml-hit-status/") + .pathParam("sessionId", sessionId) + .params(params) + .queryField("node_id", "node_id_query") + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler BULK_UPDATE_AML_HIT_STATUS_RESPONSE = Responses.jsonNode(); + + private static ApiRequest bulkUpdateAmlHitStatusRequest(String sessionId, SessionsBulkUpdateAmlHitStatusParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/bulk-update-aml-hit-status/") + .pathParam("sessionId", sessionId) + .params(params) + .queryField("node_id", "node_id_query") + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_POA_DATA_RESPONSE = Responses.json(Conv.model(SessionsUpdatePoaDataResponse::fromJson)); + + private static ApiRequest updatePoaDataRequest(String sessionId, SessionsUpdatePoaDataParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/update-poa-data/") + .pathParam("sessionId", sessionId) + .params(params) + .queryFields("node_id") + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_KYB_COMPANY_DATA_RESPONSE = Responses.json(Conv.model(SessionsUpdateKybCompanyDataResponse::fromJson)); + + private static ApiRequest updateKybCompanyDataRequest(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/kyb/{companyUuid}/update-data/") + .pathParam("sessionId", sessionId) + .pathParam("companyUuid", companyUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_KYB_PARTY_RESPONSE = Responses.json(Conv.model(SessionsUpdateKybPartyResponse::fromJson)); + + private static ApiRequest updateKybPartyRequest(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params) { + return ApiRequest.builder("PATCH", "/v3/session/{sessionId}/kyb/parties/{partyUuid}/") + .pathParam("sessionId", sessionId) + .pathParam("partyUuid", partyUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LIST_NETWORKS_RESPONSE = Responses.json(Conv.model(SessionsListNetworksResponse::fromJson)); + + private static ApiRequest listNetworksRequest(String sessionId) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/sessions/{session_id}/networks/") + .applicationScoped() + .pathParam("session_id", sessionId) + .build(); + } + + private static final ResponseHandler PREVIEW_RESUBMISSION_RESPONSE = Responses.json(Conv.model(SessionsPreviewResubmissionResponse::fromJson)); + + private static ApiRequest previewResubmissionRequest(String sessionId, SessionsPreviewResubmissionParams params) { + return ApiRequest.builder("POST", "/v3/session/{sessionId}/resubmission-preview/") + .pathParam("sessionId", sessionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code sessions} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #create(SessionsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(SessionsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SessionsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SessionsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(SessionsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(SessionsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SessionsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SessionsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDecision(String sessionId, SessionsRetrieveDecisionParams params, RequestOptions options) { + return client.execute(retrieveDecisionRequest(sessionId, params), options, RETRIEVE_DECISION_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDecisionAsync(String sessionId, SessionsRetrieveDecisionParams params, RequestOptions options) { + return client.executeAsync(retrieveDecisionRequest(sessionId, params), options, RETRIEVE_DECISION_RESPONSE); + } + + /** + * {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse retrieveDecision(String sessionId, SessionsRetrieveDecisionParams params) { + return client.execute(retrieveDecisionRequest(sessionId, params), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> retrieveDecisionAsync(String sessionId, SessionsRetrieveDecisionParams params) { + return client.executeAsync(retrieveDecisionRequest(sessionId, params), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE); + } + + /** + * {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDecision(String sessionId, RequestOptions options) { + return client.execute(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), options, RETRIEVE_DECISION_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDecisionAsync(String sessionId, RequestOptions options) { + return client.executeAsync(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), options, RETRIEVE_DECISION_RESPONSE); + } + + /** + * {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public RawResponse retrieveDecision(String sessionId) { + return client.execute(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDecision(String, SessionsRetrieveDecisionParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture> retrieveDecisionAsync(String sessionId) { + return client.executeAsync(retrieveDecisionRequest(sessionId, SessionsRetrieveDecisionParams.builder().build()), RequestOptions.none(), RETRIEVE_DECISION_RESPONSE); + } + + /** + * {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse delete(String sessionId, SessionsDeleteParams params, RequestOptions options) { + return client.execute(deleteRequest(sessionId, params), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String sessionId, SessionsDeleteParams params, RequestOptions options) { + return client.executeAsync(deleteRequest(sessionId, params), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse delete(String sessionId, SessionsDeleteParams params) { + return client.execute(deleteRequest(sessionId, params), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String sessionId, SessionsDeleteParams params) { + return client.executeAsync(deleteRequest(sessionId, params), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public RawResponse delete(String sessionId, RequestOptions options) { + return client.execute(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String sessionId, RequestOptions options) { + return client.executeAsync(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public RawResponse delete(String sessionId) { + return client.execute(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, SessionsDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String sessionId) { + return client.executeAsync(deleteRequest(sessionId, SessionsDeleteParams.builder().build()), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #generatePdf(String, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public RawResponse generatePdf(String sessionId, RequestOptions options) { + return client.execute(generatePdfRequest(sessionId), options, GENERATE_PDF_RESPONSE); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> generatePdfAsync(String sessionId, RequestOptions options) { + return client.executeAsync(generatePdfRequest(sessionId), options, GENERATE_PDF_RESPONSE); + } + + /** + * {@link #generatePdf(String, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public RawResponse generatePdf(String sessionId) { + return client.execute(generatePdfRequest(sessionId), RequestOptions.none(), GENERATE_PDF_RESPONSE); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture> generatePdfAsync(String sessionId) { + return client.executeAsync(generatePdfRequest(sessionId), RequestOptions.none(), GENERATE_PDF_RESPONSE); + } + + /** + * {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateStatus(String sessionId, SessionsUpdateStatusParams params, RequestOptions options) { + return client.execute(updateStatusRequest(sessionId, params), options, UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateStatusAsync(String sessionId, SessionsUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(updateStatusRequest(sessionId, params), options, UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse updateStatus(String sessionId, SessionsUpdateStatusParams params) { + return client.execute(updateStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateStatus(String, SessionsUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateStatusAsync(String sessionId, SessionsUpdateStatusParams params) { + return client.executeAsync(updateStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #list(SessionsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(SessionsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(SessionsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(SessionsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(SessionsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(SessionsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(SessionsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(SessionsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(SessionsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(SessionsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(SessionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(SessionsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(SessionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #share(String, SessionsShareParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse share(String sessionId, SessionsShareParams params, RequestOptions options) { + return client.execute(shareRequest(sessionId, params), options, SHARE_RESPONSE); + } + + /** + * Asynchronous {@link #share(String, SessionsShareParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> shareAsync(String sessionId, SessionsShareParams params, RequestOptions options) { + return client.executeAsync(shareRequest(sessionId, params), options, SHARE_RESPONSE); + } + + /** + * {@link #share(String, SessionsShareParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse share(String sessionId, SessionsShareParams params) { + return client.execute(shareRequest(sessionId, params), RequestOptions.none(), SHARE_RESPONSE); + } + + /** + * Asynchronous {@link #share(String, SessionsShareParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> shareAsync(String sessionId, SessionsShareParams params) { + return client.executeAsync(shareRequest(sessionId, params), RequestOptions.none(), SHARE_RESPONSE); + } + + /** + * {@link #importShared(SessionsImportSharedParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse importShared(SessionsImportSharedParams params, RequestOptions options) { + return client.execute(importSharedRequest(params), options, IMPORT_SHARED_RESPONSE); + } + + /** + * Asynchronous {@link #importShared(SessionsImportSharedParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> importSharedAsync(SessionsImportSharedParams params, RequestOptions options) { + return client.executeAsync(importSharedRequest(params), options, IMPORT_SHARED_RESPONSE); + } + + /** + * {@link #importShared(SessionsImportSharedParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse importShared(SessionsImportSharedParams params) { + return client.execute(importSharedRequest(params), RequestOptions.none(), IMPORT_SHARED_RESPONSE); + } + + /** + * Asynchronous {@link #importShared(SessionsImportSharedParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> importSharedAsync(SessionsImportSharedParams params) { + return client.executeAsync(importSharedRequest(params), RequestOptions.none(), IMPORT_SHARED_RESPONSE); + } + + /** + * {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(SessionsBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(SessionsBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse batchDelete(SessionsBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(SessionsBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse batchDelete() { + return client.execute(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(SessionsBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(SessionsBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #retrieveDeletionJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveDeletionJob(String jobId, RequestOptions options) { + return client.execute(retrieveDeletionJobRequest(jobId), options, RETRIEVE_DELETION_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDeletionJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveDeletionJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveDeletionJobRequest(jobId), options, RETRIEVE_DELETION_JOB_RESPONSE); + } + + /** + * {@link #retrieveDeletionJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public RawResponse retrieveDeletionJob(String jobId) { + return client.execute(retrieveDeletionJobRequest(jobId), RequestOptions.none(), RETRIEVE_DELETION_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveDeletionJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveDeletionJobAsync(String jobId) { + return client.executeAsync(retrieveDeletionJobRequest(jobId), RequestOptions.none(), RETRIEVE_DELETION_JOB_RESPONSE); + } + + /** + * {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateData(String sessionId, SessionsUpdateDataParams params, RequestOptions options) { + return client.execute(updateDataRequest(sessionId, params), options, UPDATE_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateDataAsync(String sessionId, SessionsUpdateDataParams params, RequestOptions options) { + return client.executeAsync(updateDataRequest(sessionId, params), options, UPDATE_DATA_RESPONSE); + } + + /** + * {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse updateData(String sessionId, SessionsUpdateDataParams params) { + return client.execute(updateDataRequest(sessionId, params), RequestOptions.none(), UPDATE_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateDataAsync(String sessionId, SessionsUpdateDataParams params) { + return client.executeAsync(updateDataRequest(sessionId, params), RequestOptions.none(), UPDATE_DATA_RESPONSE); + } + + /** + * {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public RawResponse updateData(String sessionId, RequestOptions options) { + return client.execute(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), options, UPDATE_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateDataAsync(String sessionId, RequestOptions options) { + return client.executeAsync(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), options, UPDATE_DATA_RESPONSE); + } + + /** + * {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public RawResponse updateData(String sessionId) { + return client.execute(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), RequestOptions.none(), UPDATE_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateData(String, SessionsUpdateDataParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture> updateDataAsync(String sessionId) { + return client.executeAsync(updateDataRequest(sessionId, SessionsUpdateDataParams.builder().build()), RequestOptions.none(), UPDATE_DATA_RESPONSE); + } + + /** + * {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateFeatureStatus(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params, RequestOptions options) { + return client.execute(updateFeatureStatusRequest(sessionId, nodeId, params), options, UPDATE_FEATURE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateFeatureStatusAsync(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params, RequestOptions options) { + return client.executeAsync(updateFeatureStatusRequest(sessionId, nodeId, params), options, UPDATE_FEATURE_STATUS_RESPONSE); + } + + /** + * {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @return the result + */ + public RawResponse updateFeatureStatus(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params) { + return client.execute(updateFeatureStatusRequest(sessionId, nodeId, params), RequestOptions.none(), UPDATE_FEATURE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateFeatureStatus(String, String, SessionsUpdateFeatureStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param nodeId the {@code nodeId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateFeatureStatusAsync(String sessionId, String nodeId, SessionsUpdateFeatureStatusParams params) { + return client.executeAsync(updateFeatureStatusRequest(sessionId, nodeId, params), RequestOptions.none(), UPDATE_FEATURE_STATUS_RESPONSE); + } + + /** + * {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateAmlHitStatus(String sessionId, SessionsUpdateAmlHitStatusParams params, RequestOptions options) { + return client.execute(updateAmlHitStatusRequest(sessionId, params), options, UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAmlHitStatusAsync(String sessionId, SessionsUpdateAmlHitStatusParams params, RequestOptions options) { + return client.executeAsync(updateAmlHitStatusRequest(sessionId, params), options, UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse updateAmlHitStatus(String sessionId, SessionsUpdateAmlHitStatusParams params) { + return client.execute(updateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateAmlHitStatus(String, SessionsUpdateAmlHitStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAmlHitStatusAsync(String sessionId, SessionsUpdateAmlHitStatusParams params) { + return client.executeAsync(updateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse bulkUpdateAmlHitStatus(String sessionId, SessionsBulkUpdateAmlHitStatusParams params, RequestOptions options) { + return client.execute(bulkUpdateAmlHitStatusRequest(sessionId, params), options, BULK_UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> bulkUpdateAmlHitStatusAsync(String sessionId, SessionsBulkUpdateAmlHitStatusParams params, RequestOptions options) { + return client.executeAsync(bulkUpdateAmlHitStatusRequest(sessionId, params), options, BULK_UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse bulkUpdateAmlHitStatus(String sessionId, SessionsBulkUpdateAmlHitStatusParams params) { + return client.execute(bulkUpdateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), BULK_UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #bulkUpdateAmlHitStatus(String, SessionsBulkUpdateAmlHitStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> bulkUpdateAmlHitStatusAsync(String sessionId, SessionsBulkUpdateAmlHitStatusParams params) { + return client.executeAsync(bulkUpdateAmlHitStatusRequest(sessionId, params), RequestOptions.none(), BULK_UPDATE_AML_HIT_STATUS_RESPONSE); + } + + /** + * {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updatePoaData(String sessionId, SessionsUpdatePoaDataParams params, RequestOptions options) { + return client.execute(updatePoaDataRequest(sessionId, params), options, UPDATE_POA_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updatePoaDataAsync(String sessionId, SessionsUpdatePoaDataParams params, RequestOptions options) { + return client.executeAsync(updatePoaDataRequest(sessionId, params), options, UPDATE_POA_DATA_RESPONSE); + } + + /** + * {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse updatePoaData(String sessionId, SessionsUpdatePoaDataParams params) { + return client.execute(updatePoaDataRequest(sessionId, params), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updatePoaDataAsync(String sessionId, SessionsUpdatePoaDataParams params) { + return client.executeAsync(updatePoaDataRequest(sessionId, params), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE); + } + + /** + * {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return the result + */ + public RawResponse updatePoaData(String sessionId, RequestOptions options) { + return client.execute(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), options, UPDATE_POA_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updatePoaDataAsync(String sessionId, RequestOptions options) { + return client.executeAsync(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), options, UPDATE_POA_DATA_RESPONSE); + } + + /** + * {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return the result + */ + public RawResponse updatePoaData(String sessionId) { + return client.execute(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updatePoaData(String, SessionsUpdatePoaDataParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @return a future completed with the result + */ + public CompletableFuture> updatePoaDataAsync(String sessionId) { + return client.executeAsync(updatePoaDataRequest(sessionId, SessionsUpdatePoaDataParams.builder().build()), RequestOptions.none(), UPDATE_POA_DATA_RESPONSE); + } + + /** + * {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateKybCompanyData(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params, RequestOptions options) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, params), options, UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateKybCompanyDataAsync(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params, RequestOptions options) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, params), options, UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @return the result + */ + public RawResponse updateKybCompanyData(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, params), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateKybCompanyDataAsync(String sessionId, String companyUuid, SessionsUpdateKybCompanyDataParams params) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, params), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param options per-request options + * @return the result + */ + public RawResponse updateKybCompanyData(String sessionId, String companyUuid, RequestOptions options) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), options, UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateKybCompanyDataAsync(String sessionId, String companyUuid, RequestOptions options) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), options, UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @return the result + */ + public RawResponse updateKybCompanyData(String sessionId, String companyUuid) { + return client.execute(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * Asynchronous {@link #updateKybCompanyData(String, String, SessionsUpdateKybCompanyDataParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param companyUuid the {@code companyUuid} + * @return a future completed with the result + */ + public CompletableFuture> updateKybCompanyDataAsync(String sessionId, String companyUuid) { + return client.executeAsync(updateKybCompanyDataRequest(sessionId, companyUuid, SessionsUpdateKybCompanyDataParams.builder().build()), RequestOptions.none(), UPDATE_KYB_COMPANY_DATA_RESPONSE); + } + + /** + * {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateKybParty(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params, RequestOptions options) { + return client.execute(updateKybPartyRequest(sessionId, partyUuid, params), options, UPDATE_KYB_PARTY_RESPONSE); + } + + /** + * Asynchronous {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateKybPartyAsync(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params, RequestOptions options) { + return client.executeAsync(updateKybPartyRequest(sessionId, partyUuid, params), options, UPDATE_KYB_PARTY_RESPONSE); + } + + /** + * {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @return the result + */ + public RawResponse updateKybParty(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params) { + return client.execute(updateKybPartyRequest(sessionId, partyUuid, params), RequestOptions.none(), UPDATE_KYB_PARTY_RESPONSE); + } + + /** + * Asynchronous {@link #updateKybParty(String, String, SessionsUpdateKybPartyParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param partyUuid the {@code partyUuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateKybPartyAsync(String sessionId, String partyUuid, SessionsUpdateKybPartyParams params) { + return client.executeAsync(updateKybPartyRequest(sessionId, partyUuid, params), RequestOptions.none(), UPDATE_KYB_PARTY_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return the result + */ + public RawResponse listNetworks(String sessionId, RequestOptions options) { + return client.execute(listNetworksRequest(sessionId), options, LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String sessionId, RequestOptions options) { + return client.executeAsync(listNetworksRequest(sessionId), options, LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code session_id} + * @return the result + */ + public RawResponse listNetworks(String sessionId) { + return client.execute(listNetworksRequest(sessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code session_id} + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String sessionId) { + return client.executeAsync(listNetworksRequest(sessionId), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse previewResubmission(String sessionId, SessionsPreviewResubmissionParams params, RequestOptions options) { + return client.execute(previewResubmissionRequest(sessionId, params), options, PREVIEW_RESUBMISSION_RESPONSE); + } + + /** + * Asynchronous {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> previewResubmissionAsync(String sessionId, SessionsPreviewResubmissionParams params, RequestOptions options) { + return client.executeAsync(previewResubmissionRequest(sessionId, params), options, PREVIEW_RESUBMISSION_RESPONSE); + } + + /** + * {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return the result + */ + public RawResponse previewResubmission(String sessionId, SessionsPreviewResubmissionParams params) { + return client.execute(previewResubmissionRequest(sessionId, params), RequestOptions.none(), PREVIEW_RESUBMISSION_RESPONSE); + } + + /** + * Asynchronous {@link #previewResubmission(String, SessionsPreviewResubmissionParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code sessionId} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> previewResubmissionAsync(String sessionId, SessionsPreviewResubmissionParams params) { + return client.executeAsync(previewResubmissionRequest(sessionId, params), RequestOptions.none(), PREVIEW_RESUBMISSION_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/SessionsReviewsResource.java b/src/main/java/me/didit/resources/SessionsReviewsResource.java new file mode 100644 index 0000000..aca6370 --- /dev/null +++ b/src/main/java/me/didit/resources/SessionsReviewsResource.java @@ -0,0 +1,434 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.ReviewItem; +import me.didit.types.SessionsReviewsCreateParams; +import me.didit.types.SessionsReviewsCreateResponse; +import me.didit.types.SessionsReviewsListParams; + +/** The {@code sessions.reviews} resource: {@code client.sessions().reviews()}. */ +public final class SessionsReviewsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + SessionsReviewsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List session reviews and activity log + * + *

Return the audit trail / activity feed for a User Verification (KYC) session, newest first, in a paginated envelope (count / next / previous / results, 50 entries per page by default). + * + *

Feed entries are written by every actor that touches the session: manual decisions made through PATCH /v3/session/{session_id}/update-status/ (which records previous_status โ†’ new_status), Console reviewer activity (comments with @email mentions, KYC/POA data edits, file uploads/removals, tag changes, detail-page views), AML ongoing-monitoring matches, and notes appended via POST on this same path. Reading this feed is the API-side equivalent of the Activity panel in the Didit Console session view. + * + *

Only User Verification (KYC) sessions are addressable here; Business Verification (KYB) session IDs return 404. + * + *

{@code GET /v3/sessions/{session_id}/reviews/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param sessionId UUID of the User Verification (KYC) session. Must belong to the same application as the API key โ€” cross-application UUIDs, deleted sessions, and Business Verification (KYB) session IDs all return `404`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(String sessionId, SessionsReviewsListParams params, RequestOptions options) { + return client.execute(listRequest(sessionId, params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)}. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String sessionId, SessionsReviewsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(sessionId, params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, SessionsReviewsListParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return the result + */ + public Page list(String sessionId, SessionsReviewsListParams params) { + return client.execute(listRequest(sessionId, params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String sessionId, SessionsReviewsListParams params) { + return client.executeAsync(listRequest(sessionId, params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, SessionsReviewsListParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return the result + */ + public Page list(String sessionId, RequestOptions options) { + return client.execute(listRequest(sessionId, SessionsReviewsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String sessionId, RequestOptions options) { + return client.executeAsync(listRequest(sessionId, SessionsReviewsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(String, SessionsReviewsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return the result + */ + public Page list(String sessionId) { + return client.execute(listRequest(sessionId, SessionsReviewsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return a future completed with the result + */ + public CompletableFuture> listAsync(String sessionId) { + return client.executeAsync(listRequest(sessionId, SessionsReviewsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Add a review note to a session's audit trail + * + *

Append a note to a User Verification (KYC) session's review / activity feed. This endpoint only records an entry โ€” it never changes the session. The session's status is left untouched, no status-transition validation runs, and no webhook fires. To actually approve, decline, or re-open a session (which also writes a fully-attributed STATUS_UPDATED entry to this feed), use PATCH /v3/session/{session_id}/update-status/ instead. + * + *

Both body fields are optional and an empty JSON object is accepted. new_status is stored purely as a label on the entry and accepts any of the ten session status values (case-sensitive). @email mentions inside comment are stored as plain text only โ€” they trigger no notifications on this endpoint, and the entry's mentioned_emails stays empty. + * + *

Note on attribution: entries created here carry no actor information. In the feed they show actor_display: "Unknown", actor_type: "CONSOLE_USER", and activity_type: "STATUS_UPDATED" (storage defaults), and the 201 body's user field is "Unknown". + * + *

{@code POST /v3/sessions/{session_id}/reviews/} + * + * @param sessionId UUID of the User Verification (KYC) session. Must belong to the same application as the API key โ€” cross-application UUIDs, deleted sessions, and Business Verification (KYB) session IDs all return `404`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public SessionsReviewsCreateResponse create(String sessionId, SessionsReviewsCreateParams params, RequestOptions options) { + return client.execute(createRequest(sessionId, params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String sessionId, SessionsReviewsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(sessionId, params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return the result + */ + public SessionsReviewsCreateResponse create(String sessionId, SessionsReviewsCreateParams params) { + return client.execute(createRequest(sessionId, params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(String sessionId, SessionsReviewsCreateParams params) { + return client.executeAsync(createRequest(sessionId, params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return the result + */ + public SessionsReviewsCreateResponse create(String sessionId, RequestOptions options) { + return client.execute(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(String sessionId, RequestOptions options) { + return client.executeAsync(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return the result + */ + public SessionsReviewsCreateResponse create(String sessionId) { + return client.execute(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return a future completed with the result + */ + public CompletableFuture createAsync(String sessionId) { + return client.executeAsync(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(ReviewItem::fromJson)); + + private static ApiRequest listRequest(String sessionId, SessionsReviewsListParams params) { + return ApiRequest.builder("GET", "/v3/sessions/{session_id}/reviews/") + .pathParam("session_id", sessionId) + .params(params) + .queryFields("limit", "offset", "ordering") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(SessionsReviewsCreateResponse::fromJson)); + + private static ApiRequest createRequest(String sessionId, SessionsReviewsCreateParams params) { + return ApiRequest.builder("POST", "/v3/sessions/{session_id}/reviews/") + .pathParam("session_id", sessionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code sessions.reviews} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(String sessionId, SessionsReviewsListParams params, RequestOptions options) { + return client.execute(listRequest(sessionId, params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String sessionId, SessionsReviewsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(sessionId, params), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return the result + */ + public RawResponse> list(String sessionId, SessionsReviewsListParams params) { + return client.execute(listRequest(sessionId, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String sessionId, SessionsReviewsListParams params) { + return client.executeAsync(listRequest(sessionId, params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return the result + */ + public RawResponse> list(String sessionId, RequestOptions options) { + return client.execute(listRequest(sessionId, SessionsReviewsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String sessionId, RequestOptions options) { + return client.executeAsync(listRequest(sessionId, SessionsReviewsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return the result + */ + public RawResponse> list(String sessionId) { + return client.execute(listRequest(sessionId, SessionsReviewsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(String, SessionsReviewsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(String sessionId) { + return client.executeAsync(listRequest(sessionId, SessionsReviewsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(String sessionId, SessionsReviewsCreateParams params, RequestOptions options) { + return client.execute(createRequest(sessionId, params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String sessionId, SessionsReviewsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(sessionId, params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return the result + */ + public RawResponse create(String sessionId, SessionsReviewsCreateParams params) { + return client.execute(createRequest(sessionId, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param sessionId the {@code session_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String sessionId, SessionsReviewsCreateParams params) { + return client.executeAsync(createRequest(sessionId, params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return the result + */ + public RawResponse create(String sessionId, RequestOptions options) { + return client.execute(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response, without parameters. + * + * @param sessionId the {@code session_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String sessionId, RequestOptions options) { + return client.executeAsync(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), options, CREATE_RESPONSE); + } + + /** + * {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return the result + */ + public RawResponse create(String sessionId) { + return client.execute(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(String, SessionsReviewsCreateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param sessionId the {@code session_id} + * @return a future completed with the result + */ + public CompletableFuture> createAsync(String sessionId) { + return client.executeAsync(createRequest(sessionId, SessionsReviewsCreateParams.builder().build()), RequestOptions.none(), CREATE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/TransactionsResource.java b/src/main/java/me/didit/resources/TransactionsResource.java new file mode 100644 index 0000000..666acb6 --- /dev/null +++ b/src/main/java/me/didit/resources/TransactionsResource.java @@ -0,0 +1,740 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.TransactionDetail; +import me.didit.types.TransactionsCreateParams; +import me.didit.types.TransactionsCreateSdkTokenParams; +import me.didit.types.TransactionsCreateSdkTokenResponse; +import me.didit.types.TransactionsListNetworksResponse; +import me.didit.types.TransactionsListParams; +import me.didit.types.TransactionsListPartyNetworksResponse; +import me.didit.types.TransactionsListResponse; + +/** The {@code transactions} resource: {@code client.transactions()}. */ +public final class TransactionsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + private final TransactionsRulesResource rules; + private final TransactionsTravelRuleResource travelRule; + + TransactionsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + this.rules = new TransactionsRulesResource(client); + this.travelRule = new TransactionsTravelRuleResource(client); + } + + /** + * The {@code transactions.rules} resource. + * + * @return the resource + */ + public TransactionsRulesResource rules() { + return rules; + } + + /** + * The {@code transactions.travel_rule} resource. + * + * @return the resource + */ + public TransactionsTravelRuleResource travelRule() { + return travelRule; + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List transactions + * + *

Paginated list of monitored transactions, newest first (txn_date desc). count is capped at 100; use total_transactions for the true row count. This endpoint does not support filtering or search parameters. + * + *

{@code GET /v3/transactions/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(TransactionsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(TransactionsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TransactionsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(TransactionsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(TransactionsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TransactionsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(TransactionsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(TransactionsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TransactionsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(TransactionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(TransactionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create transaction + * + *

Submit a transaction for synchronous AML/risk monitoring. The transaction is created APPROVED, then your rules (and crypto screening, when applicable) run inline and may flip the returned status to IN_REVIEW or DECLINED. **transaction_id is your idempotency key** (max 128 chars, unique per app); reusing it returns 400. A transaction.created webhook is dispatched on success (sandbox applications are not billed and do not emit webhooks). + * + *

{@code POST /v3/transactions/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionDetail create(TransactionsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(TransactionsCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(TransactionsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(TransactionsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TransactionDetail create(TransactionsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(TransactionsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(TransactionsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get transaction + * + *

Retrieve the full monitoring record for one transaction: parties, score/severity, rule runs, alerts, Travel Rule outcome, remediation session. + * + *

{@code GET /v3/transactions/{transaction_id}/} + * + * @param transactionId Didit-stable transaction UUID (the `uuid` returned from create / list, **not** your `txn_id`). + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionDetail retrieve(String transactionId, RequestOptions options) { + return client.execute(retrieveRequest(transactionId), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param transactionId the {@code transaction_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String transactionId, RequestOptions options) { + return client.executeAsync(retrieveRequest(transactionId), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @return the result + */ + public TransactionDetail retrieve(String transactionId) { + return client.execute(retrieveRequest(transactionId), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String transactionId) { + return client.executeAsync(retrieveRequest(transactionId), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Mint an SDK transaction token + * + *

Mint a short-lived scoped token your app passes to the Didit SDKs so they can submit transactions directly from the end-user's device via POST /v1/transactions/. The token is bound to one vendor_data (your user id): every transaction submitted with it has its subject identity enforced server-side from that binding, so a tampered client cannot submit on behalf of another user. Mint tokens from your backend - never ship the API key itself in an app. camelCase aliases (vendorData, ttlSeconds, maxUses) are also accepted. + * + *

{@code POST /v3/transactions/sdk-token/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionsCreateSdkTokenResponse createSdkToken(TransactionsCreateSdkTokenParams params, RequestOptions options) { + return client.execute(createSdkTokenRequest(params), options, CREATE_SDK_TOKEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createSdkTokenAsync(TransactionsCreateSdkTokenParams params, RequestOptions options) { + return client.executeAsync(createSdkTokenRequest(params), options, CREATE_SDK_TOKEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TransactionsCreateSdkTokenResponse createSdkToken(TransactionsCreateSdkTokenParams params) { + return client.execute(createSdkTokenRequest(params), RequestOptions.none(), CREATE_SDK_TOKEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createSdkTokenAsync(TransactionsCreateSdkTokenParams params) { + return client.executeAsync(createSdkTokenRequest(params), RequestOptions.none(), CREATE_SDK_TOKEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List networks for a transaction + * + *

List the networks the transaction's backing KYC/KYB subject belongs to (resolved through the transaction's session or business session). + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/networks/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param transactionUuid Transaction UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionsListNetworksResponse listNetworks(String transactionUuid, RequestOptions options) { + return client.execute(listNetworksRequest(transactionUuid), options, LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}. + * + * @param transactionUuid the {@code transaction_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String transactionUuid, RequestOptions options) { + return client.executeAsync(listNetworksRequest(transactionUuid), options, LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @return the result + */ + public TransactionsListNetworksResponse listNetworks(String transactionUuid) { + return client.execute(listNetworksRequest(transactionUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String transactionUuid) { + return client.executeAsync(listNetworksRequest(transactionUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List networks for a transaction party + * + *

List the networks a transaction party (remitter, beneficiary, or counterparty) belongs to, resolved through the party itself rather than through the transaction's backing session. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/parties/{transaction_party_uuid}/networks/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param transactionUuid Transaction UUID. + * @param transactionPartyUuid Transaction party UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionsListPartyNetworksResponse listPartyNetworks(String transactionUuid, String transactionPartyUuid, RequestOptions options) { + return client.execute(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), options, LIST_PARTY_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listPartyNetworks(String, String, RequestOptions)}. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listPartyNetworksAsync(String transactionUuid, String transactionPartyUuid, RequestOptions options) { + return client.executeAsync(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), options, LIST_PARTY_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listPartyNetworks(String, String, RequestOptions)}, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @return the result + */ + public TransactionsListPartyNetworksResponse listPartyNetworks(String transactionUuid, String transactionPartyUuid) { + return client.execute(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), RequestOptions.none(), LIST_PARTY_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listPartyNetworks(String, String, RequestOptions)}, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @return a future completed with the result + */ + public CompletableFuture listPartyNetworksAsync(String transactionUuid, String transactionPartyUuid) { + return client.executeAsync(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), RequestOptions.none(), LIST_PARTY_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(TransactionsListResponse.Results::fromJson)); + + private static ApiRequest listRequest(TransactionsListParams params) { + return ApiRequest.builder("GET", "/v3/transactions/") + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(TransactionDetail::fromJson)); + + private static ApiRequest createRequest(TransactionsCreateParams params) { + return ApiRequest.builder("POST", "/v3/transactions/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(TransactionDetail::fromJson)); + + private static ApiRequest retrieveRequest(String transactionId) { + return ApiRequest.builder("GET", "/v3/transactions/{transaction_id}/") + .pathParam("transaction_id", transactionId) + .build(); + } + + private static final ResponseHandler CREATE_SDK_TOKEN_RESPONSE = Responses.json(Conv.model(TransactionsCreateSdkTokenResponse::fromJson)); + + private static ApiRequest createSdkTokenRequest(TransactionsCreateSdkTokenParams params) { + return ApiRequest.builder("POST", "/v3/transactions/sdk-token/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler LIST_NETWORKS_RESPONSE = Responses.json(Conv.model(TransactionsListNetworksResponse::fromJson)); + + private static ApiRequest listNetworksRequest(String transactionUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/networks/") + .applicationScoped() + .pathParam("transaction_uuid", transactionUuid) + .build(); + } + + private static final ResponseHandler LIST_PARTY_NETWORKS_RESPONSE = Responses.json(Conv.model(TransactionsListPartyNetworksResponse::fromJson)); + + private static ApiRequest listPartyNetworksRequest(String transactionUuid, String transactionPartyUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/parties/{transaction_party_uuid}/networks/") + .applicationScoped() + .pathParam("transaction_uuid", transactionUuid) + .pathParam("transaction_party_uuid", transactionPartyUuid) + .build(); + } + + /** The {@code transactions} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(TransactionsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(TransactionsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(TransactionsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(TransactionsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(TransactionsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(TransactionsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(TransactionsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(TransactionsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(TransactionsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(TransactionsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(TransactionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(TransactionsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(TransactionsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(TransactionsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(TransactionsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(TransactionsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(TransactionsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(TransactionsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(TransactionsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(TransactionsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param transactionId the {@code transaction_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String transactionId, RequestOptions options) { + return client.execute(retrieveRequest(transactionId), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param transactionId the {@code transaction_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String transactionId, RequestOptions options) { + return client.executeAsync(retrieveRequest(transactionId), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @return the result + */ + public RawResponse retrieve(String transactionId) { + return client.execute(retrieveRequest(transactionId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String transactionId) { + return client.executeAsync(retrieveRequest(transactionId), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse createSdkToken(TransactionsCreateSdkTokenParams params, RequestOptions options) { + return client.execute(createSdkTokenRequest(params), options, CREATE_SDK_TOKEN_RESPONSE); + } + + /** + * Asynchronous {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createSdkTokenAsync(TransactionsCreateSdkTokenParams params, RequestOptions options) { + return client.executeAsync(createSdkTokenRequest(params), options, CREATE_SDK_TOKEN_RESPONSE); + } + + /** + * {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse createSdkToken(TransactionsCreateSdkTokenParams params) { + return client.execute(createSdkTokenRequest(params), RequestOptions.none(), CREATE_SDK_TOKEN_RESPONSE); + } + + /** + * Asynchronous {@link #createSdkToken(TransactionsCreateSdkTokenParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createSdkTokenAsync(TransactionsCreateSdkTokenParams params) { + return client.executeAsync(createSdkTokenRequest(params), RequestOptions.none(), CREATE_SDK_TOKEN_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param transactionUuid the {@code transaction_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listNetworks(String transactionUuid, RequestOptions options) { + return client.execute(listNetworksRequest(transactionUuid), options, LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param transactionUuid the {@code transaction_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String transactionUuid, RequestOptions options) { + return client.executeAsync(listNetworksRequest(transactionUuid), options, LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @return the result + */ + public RawResponse listNetworks(String transactionUuid) { + return client.execute(listNetworksRequest(transactionUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String transactionUuid) { + return client.executeAsync(listNetworksRequest(transactionUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #listPartyNetworks(String, String, RequestOptions)} with the raw response. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listPartyNetworks(String transactionUuid, String transactionPartyUuid, RequestOptions options) { + return client.execute(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), options, LIST_PARTY_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listPartyNetworks(String, String, RequestOptions)} with the raw response. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listPartyNetworksAsync(String transactionUuid, String transactionPartyUuid, RequestOptions options) { + return client.executeAsync(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), options, LIST_PARTY_NETWORKS_RESPONSE); + } + + /** + * {@link #listPartyNetworks(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @return the result + */ + public RawResponse listPartyNetworks(String transactionUuid, String transactionPartyUuid) { + return client.execute(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), RequestOptions.none(), LIST_PARTY_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listPartyNetworks(String, String, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionUuid the {@code transaction_uuid} + * @param transactionPartyUuid the {@code transaction_party_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listPartyNetworksAsync(String transactionUuid, String transactionPartyUuid) { + return client.executeAsync(listPartyNetworksRequest(transactionUuid, transactionPartyUuid), RequestOptions.none(), LIST_PARTY_NETWORKS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/TransactionsRulesResource.java b/src/main/java/me/didit/resources/TransactionsRulesResource.java new file mode 100644 index 0000000..5d03bc4 --- /dev/null +++ b/src/main/java/me/didit/resources/TransactionsRulesResource.java @@ -0,0 +1,1084 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.TransactionRuleBacktestRequest; +import me.didit.types.TransactionRuleBacktestResult; +import me.didit.types.TransactionRuleCreateRequest; +import me.didit.types.TransactionRuleDetail; +import me.didit.types.TransactionRuleInstallRequest; +import me.didit.types.TransactionRuleInstallResult; +import me.didit.types.TransactionRuleLibraryEntry; +import me.didit.types.TransactionRuleUpdateRequest; +import me.didit.types.TransactionsRulesListLibraryParams; +import me.didit.types.TransactionsRulesListParams; +import org.jspecify.annotations.Nullable; + +/** The {@code transactions.rules} resource: {@code client.transactions().rules()}. */ +public final class TransactionsRulesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + TransactionsRulesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List rules + * + *

List the application's transaction-monitoring rules: your custom rules plus any library presets you have installed. Filter by source, category, mode, bundle or free-text search; order with ordering (run_count, approved_pct, reviewed_pct, declined_pct, latest_triggered_at, title, created_at, source, each with an optional - prefix). + * + *

{@code GET /v3/transactions/rules/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(TransactionsRulesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(TransactionsRulesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TransactionsRulesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(TransactionsRulesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(TransactionsRulesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TransactionsRulesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(TransactionsRulesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(TransactionsRulesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TransactionsRulesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(TransactionsRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(TransactionsRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create rule + * + *

Create a CUSTOM transaction-monitoring rule. Titles are unique per application (duplicate -> 400). A change_status action targeting AWAITING_USER must carry workflow_id. Rules created in ACTIVE mode apply to new transactions immediately - the recommended workflow is create in TEST mode, backtest, then switch mode to ACTIVE. + * + *

{@code POST /v3/transactions/rules/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionRuleDetail create(TransactionRuleCreateRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(TransactionRuleCreateRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(TransactionRuleCreateRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(TransactionRuleCreateRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TransactionRuleDetail create(TransactionRuleCreateRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(TransactionRuleCreateRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(TransactionRuleCreateRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get rule + * + *

Retrieve one rule with its full configuration and execution counters. + * + *

{@code GET /v3/transactions/rules/{rule_uuid}/} + * + * @param ruleUuid The rule's uuid from list or create. + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionRuleDetail retrieve(String ruleUuid, RequestOptions options) { + return client.execute(retrieveRequest(ruleUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param ruleUuid the {@code rule_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String ruleUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(ruleUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return the result + */ + public TransactionRuleDetail retrieve(String ruleUuid) { + return client.execute(retrieveRequest(ruleUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String ruleUuid) { + return client.executeAsync(retrieveRequest(ruleUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update rule + * + *

Partially update a rule. Custom rules accept every configuration field. Library (PRESET) rules accept only mode - use it to activate, disable, or switch a preset to TEST; any other field returns 400. + * + *

{@code PATCH /v3/transactions/rules/{rule_uuid}/} + * + * @param ruleUuid The rule's uuid from list or create. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionRuleDetail update(String ruleUuid, TransactionRuleUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(ruleUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)}. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String ruleUuid, TransactionRuleUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(ruleUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)}, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @return the result + */ + public TransactionRuleDetail update(String ruleUuid, TransactionRuleUpdateRequest params) { + return client.execute(updateRequest(ruleUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)}, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String ruleUuid, TransactionRuleUpdateRequest params) { + return client.executeAsync(updateRequest(ruleUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete rule + * + *

Delete a CUSTOM rule. Deletion is immediate and permanent: the rule stops evaluating for new transactions and disappears from listings, while past rule runs on already-evaluated transactions keep their recorded results. Library rules cannot be deleted - uninstall them via the install endpoint instead (they can always be reinstalled from the library). + * + *

{@code DELETE /v3/transactions/rules/{rule_uuid}/} + * + * @param ruleUuid The rule's uuid from list or create. + * @param options per-request options that override the client options + */ + public void delete(String ruleUuid, RequestOptions options) { + client.execute(deleteRequest(ruleUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param ruleUuid the {@code rule_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String ruleUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(ruleUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + */ + public void delete(String ruleUuid) { + client.execute(deleteRequest(ruleUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String ruleUuid) { + return client.executeAsync(deleteRequest(ruleUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Backtest rule configuration + * + *

Evaluate a hypothetical rule configuration against your recent transactions (most recent first, up to the backtest cap) without creating a rule or touching any transaction. Use it before activating a rule to see how often it would have matched and how many subjects it would have affected. + * + *

{@code POST /v3/transactions/rules/backtest/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionRuleBacktestResult backtest(TransactionRuleBacktestRequest params, RequestOptions options) { + return client.execute(backtestRequest(params), options, BACKTEST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture backtestAsync(TransactionRuleBacktestRequest params, RequestOptions options) { + return client.executeAsync(backtestRequest(params), options, BACKTEST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TransactionRuleBacktestResult backtest(TransactionRuleBacktestRequest params) { + return client.execute(backtestRequest(params), RequestOptions.none(), BACKTEST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture backtestAsync(TransactionRuleBacktestRequest params) { + return client.executeAsync(backtestRequest(params), RequestOptions.none(), BACKTEST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List rule library + * + *

Browse the full preset rule library (150+ rules) with each entry's complete configuration and an is_installed flag for this application. Filter by bundle, category, or free-text search. + * + *

{@code GET /v3/transactions/rules/library/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page listLibrary(TransactionsRulesListLibraryParams params, RequestOptions options) { + return client.execute(listLibraryRequest(params), options, LIST_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listLibraryAsync(TransactionsRulesListLibraryParams params, RequestOptions options) { + return client.executeAsync(listLibraryRequest(params), options, LIST_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page listLibrary(TransactionsRulesListLibraryParams params) { + return client.execute(listLibraryRequest(params), RequestOptions.none(), LIST_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listLibraryAsync(TransactionsRulesListLibraryParams params) { + return client.executeAsync(listLibraryRequest(params), RequestOptions.none(), LIST_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page listLibrary(RequestOptions options) { + return client.execute(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), options, LIST_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listLibraryAsync(RequestOptions options) { + return client.executeAsync(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), options, LIST_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page listLibrary() { + return client.execute(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), RequestOptions.none(), LIST_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listLibraryAsync() { + return client.executeAsync(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), RequestOptions.none(), LIST_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Install library rules + * + *

Install one or more presets onto the application, by library_keys or a whole bundle. Installed presets evaluate immediately in their default mode; already-installed keys are skipped. + * + *

{@code POST /v3/transactions/rules/install/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionRuleInstallResult installLibrary(TransactionRuleInstallRequest params, RequestOptions options) { + return client.execute(installLibraryRequest(params), options, INSTALL_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture installLibraryAsync(TransactionRuleInstallRequest params, RequestOptions options) { + return client.executeAsync(installLibraryRequest(params), options, INSTALL_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TransactionRuleInstallResult installLibrary(TransactionRuleInstallRequest params) { + return client.execute(installLibraryRequest(params), RequestOptions.none(), INSTALL_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture installLibraryAsync(TransactionRuleInstallRequest params) { + return client.executeAsync(installLibraryRequest(params), RequestOptions.none(), INSTALL_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Uninstall library rules + * + *

Remove installed presets from the application, by library_keys or a whole bundle. Uninstalled presets stop evaluating immediately and can be reinstalled from the library at any time. + * + *

{@code DELETE /v3/transactions/rules/install/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TransactionRuleInstallResult uninstallLibrary(TransactionRuleInstallRequest params, RequestOptions options) { + return client.execute(uninstallLibraryRequest(params), options, UNINSTALL_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture uninstallLibraryAsync(TransactionRuleInstallRequest params, RequestOptions options) { + return client.executeAsync(uninstallLibraryRequest(params), options, UNINSTALL_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TransactionRuleInstallResult uninstallLibrary(TransactionRuleInstallRequest params) { + return client.execute(uninstallLibraryRequest(params), RequestOptions.none(), UNINSTALL_LIBRARY_RESPONSE).data(); + } + + /** + * Asynchronous {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture uninstallLibraryAsync(TransactionRuleInstallRequest params) { + return client.executeAsync(uninstallLibraryRequest(params), RequestOptions.none(), UNINSTALL_LIBRARY_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(TransactionRuleDetail::fromJson)); + + private static ApiRequest listRequest(TransactionsRulesListParams params) { + return ApiRequest.builder("GET", "/v3/transactions/rules/") + .params(params) + .queryFields("source", "category", "mode", "bundle", "search", "ordering", "limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(TransactionRuleDetail::fromJson)); + + private static ApiRequest createRequest(TransactionRuleCreateRequest params) { + return ApiRequest.builder("POST", "/v3/transactions/rules/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(TransactionRuleDetail::fromJson)); + + private static ApiRequest retrieveRequest(String ruleUuid) { + return ApiRequest.builder("GET", "/v3/transactions/rules/{rule_uuid}/") + .pathParam("rule_uuid", ruleUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(TransactionRuleDetail::fromJson)); + + private static ApiRequest updateRequest(String ruleUuid, TransactionRuleUpdateRequest params) { + return ApiRequest.builder("PATCH", "/v3/transactions/rules/{rule_uuid}/") + .pathParam("rule_uuid", ruleUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String ruleUuid) { + return ApiRequest.builder("DELETE", "/v3/transactions/rules/{rule_uuid}/") + .pathParam("rule_uuid", ruleUuid) + .build(); + } + + private static final ResponseHandler BACKTEST_RESPONSE = Responses.json(Conv.model(TransactionRuleBacktestResult::fromJson)); + + private static ApiRequest backtestRequest(TransactionRuleBacktestRequest params) { + return ApiRequest.builder("POST", "/v3/transactions/rules/backtest/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler> LIST_LIBRARY_RESPONSE = Responses.page(Conv.model(TransactionRuleLibraryEntry::fromJson)); + + private static ApiRequest listLibraryRequest(TransactionsRulesListLibraryParams params) { + return ApiRequest.builder("GET", "/v3/transactions/rules/library/") + .params(params) + .queryFields("bundle", "category", "search", "limit", "offset") + .build(); + } + + private static final ResponseHandler INSTALL_LIBRARY_RESPONSE = Responses.json(Conv.model(TransactionRuleInstallResult::fromJson)); + + private static ApiRequest installLibraryRequest(TransactionRuleInstallRequest params) { + return ApiRequest.builder("POST", "/v3/transactions/rules/install/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UNINSTALL_LIBRARY_RESPONSE = Responses.json(Conv.model(TransactionRuleInstallResult::fromJson)); + + private static ApiRequest uninstallLibraryRequest(TransactionRuleInstallRequest params) { + return ApiRequest.builder("DELETE", "/v3/transactions/rules/install/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code transactions.rules} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(TransactionsRulesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(TransactionsRulesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(TransactionsRulesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(TransactionsRulesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(TransactionsRulesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(TransactionsRulesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(TransactionsRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TransactionsRulesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(TransactionsRulesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(TransactionRuleCreateRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(TransactionRuleCreateRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(TransactionRuleCreateRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(TransactionRuleCreateRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(TransactionRuleCreateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(TransactionRuleCreateRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(TransactionRuleCreateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(TransactionRuleCreateRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param ruleUuid the {@code rule_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String ruleUuid, RequestOptions options) { + return client.execute(retrieveRequest(ruleUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param ruleUuid the {@code rule_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String ruleUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(ruleUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return the result + */ + public RawResponse retrieve(String ruleUuid) { + return client.execute(retrieveRequest(ruleUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String ruleUuid) { + return client.executeAsync(retrieveRequest(ruleUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)} with the raw response. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String ruleUuid, TransactionRuleUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(ruleUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)} with the raw response. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String ruleUuid, TransactionRuleUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(ruleUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String ruleUuid, TransactionRuleUpdateRequest params) { + return client.execute(updateRequest(ruleUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, TransactionRuleUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String ruleUuid, TransactionRuleUpdateRequest params) { + return client.executeAsync(updateRequest(ruleUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param ruleUuid the {@code rule_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String ruleUuid, RequestOptions options) { + return client.execute(deleteRequest(ruleUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param ruleUuid the {@code rule_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String ruleUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(ruleUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String ruleUuid) { + return client.execute(deleteRequest(ruleUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param ruleUuid the {@code rule_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String ruleUuid) { + return client.executeAsync(deleteRequest(ruleUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse backtest(TransactionRuleBacktestRequest params, RequestOptions options) { + return client.execute(backtestRequest(params), options, BACKTEST_RESPONSE); + } + + /** + * Asynchronous {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> backtestAsync(TransactionRuleBacktestRequest params, RequestOptions options) { + return client.executeAsync(backtestRequest(params), options, BACKTEST_RESPONSE); + } + + /** + * {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse backtest(TransactionRuleBacktestRequest params) { + return client.execute(backtestRequest(params), RequestOptions.none(), BACKTEST_RESPONSE); + } + + /** + * Asynchronous {@link #backtest(TransactionRuleBacktestRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> backtestAsync(TransactionRuleBacktestRequest params) { + return client.executeAsync(backtestRequest(params), RequestOptions.none(), BACKTEST_RESPONSE); + } + + /** + * {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> listLibrary(TransactionsRulesListLibraryParams params, RequestOptions options) { + return client.execute(listLibraryRequest(params), options, LIST_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listLibraryAsync(TransactionsRulesListLibraryParams params, RequestOptions options) { + return client.executeAsync(listLibraryRequest(params), options, LIST_LIBRARY_RESPONSE); + } + + /** + * {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> listLibrary(TransactionsRulesListLibraryParams params) { + return client.execute(listLibraryRequest(params), RequestOptions.none(), LIST_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listLibraryAsync(TransactionsRulesListLibraryParams params) { + return client.executeAsync(listLibraryRequest(params), RequestOptions.none(), LIST_LIBRARY_RESPONSE); + } + + /** + * {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> listLibrary(RequestOptions options) { + return client.execute(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), options, LIST_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listLibraryAsync(RequestOptions options) { + return client.executeAsync(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), options, LIST_LIBRARY_RESPONSE); + } + + /** + * {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> listLibrary() { + return client.execute(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), RequestOptions.none(), LIST_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #listLibrary(TransactionsRulesListLibraryParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listLibraryAsync() { + return client.executeAsync(listLibraryRequest(TransactionsRulesListLibraryParams.builder().build()), RequestOptions.none(), LIST_LIBRARY_RESPONSE); + } + + /** + * {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse installLibrary(TransactionRuleInstallRequest params, RequestOptions options) { + return client.execute(installLibraryRequest(params), options, INSTALL_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> installLibraryAsync(TransactionRuleInstallRequest params, RequestOptions options) { + return client.executeAsync(installLibraryRequest(params), options, INSTALL_LIBRARY_RESPONSE); + } + + /** + * {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse installLibrary(TransactionRuleInstallRequest params) { + return client.execute(installLibraryRequest(params), RequestOptions.none(), INSTALL_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #installLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> installLibraryAsync(TransactionRuleInstallRequest params) { + return client.executeAsync(installLibraryRequest(params), RequestOptions.none(), INSTALL_LIBRARY_RESPONSE); + } + + /** + * {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse uninstallLibrary(TransactionRuleInstallRequest params, RequestOptions options) { + return client.execute(uninstallLibraryRequest(params), options, UNINSTALL_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> uninstallLibraryAsync(TransactionRuleInstallRequest params, RequestOptions options) { + return client.executeAsync(uninstallLibraryRequest(params), options, UNINSTALL_LIBRARY_RESPONSE); + } + + /** + * {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse uninstallLibrary(TransactionRuleInstallRequest params) { + return client.execute(uninstallLibraryRequest(params), RequestOptions.none(), UNINSTALL_LIBRARY_RESPONSE); + } + + /** + * Asynchronous {@link #uninstallLibrary(TransactionRuleInstallRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> uninstallLibraryAsync(TransactionRuleInstallRequest params) { + return client.executeAsync(uninstallLibraryRequest(params), RequestOptions.none(), UNINSTALL_LIBRARY_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/TransactionsTravelRuleResource.java b/src/main/java/me/didit/resources/TransactionsTravelRuleResource.java new file mode 100644 index 0000000..3a503b1 --- /dev/null +++ b/src/main/java/me/didit/resources/TransactionsTravelRuleResource.java @@ -0,0 +1,255 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.TravelRuleOwnershipConfirmRequest; +import me.didit.types.TravelRuleTransferDetail; +import me.didit.types.TravelRuleTransferPatchRequest; + +/** The {@code transactions.travel_rule} resource: {@code client.transactions().travelRule()}. */ +public final class TransactionsTravelRuleResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + TransactionsTravelRuleResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Finish, cancel, or resend a Travel Rule transfer + * + *

Provide payment_txn_id to report the on-chain hash and move an outbound COMPLETED transfer to FINISHED (its INTERNAL-rail counterpart also moves to FINISHED), {"action": "cancel"} to cancel a non-terminal transfer, or {"action": "resend"} to re-run routing for an outbound transfer stuck in COUNTERPARTY_VASP_NOT_FOUND, COUNTERPARTY_VASP_NOT_REACHABLE, or NOT_ENOUGH_COUNTERPARTY_DATA (improve the counterparty data first, e.g. add a travel_address to the destination wallet entry). + * + *

{@code PATCH /v3/transactions/{transaction_id}/travel-rule/} + * + * @param transactionId Didit-stable transaction UUID that owns the transfer. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TravelRuleTransferDetail updateTransfer(String transactionId, TravelRuleTransferPatchRequest params, RequestOptions options) { + return client.execute(updateTransferRequest(transactionId, params), options, UPDATE_TRANSFER_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)}. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateTransferAsync(String transactionId, TravelRuleTransferPatchRequest params, RequestOptions options) { + return client.executeAsync(updateTransferRequest(transactionId, params), options, UPDATE_TRANSFER_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)}, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return the result + */ + public TravelRuleTransferDetail updateTransfer(String transactionId, TravelRuleTransferPatchRequest params) { + return client.execute(updateTransferRequest(transactionId, params), RequestOptions.none(), UPDATE_TRANSFER_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)}, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateTransferAsync(String transactionId, TravelRuleTransferPatchRequest params) { + return client.executeAsync(updateTransferRequest(transactionId, params), RequestOptions.none(), UPDATE_TRANSFER_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Confirm or deny wallet ownership + * + *

Called by the beneficiary's application when its INTERNAL-rail transfer is UNCONFIRMED_OWNERSHIP. Confirming marks the matching wallet address book entry as ownership-verified and runs the beneficiary name match on both sides of the transfer; denying declines both sides. + * + *

{@code POST /v3/transactions/{transaction_id}/travel-rule/ownership/} + * + * @param transactionId Didit-stable transaction UUID that owns the transfer (the beneficiary side's transaction). + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TravelRuleTransferDetail confirmOwnership(String transactionId, TravelRuleOwnershipConfirmRequest params, RequestOptions options) { + return client.execute(confirmOwnershipRequest(transactionId, params), options, CONFIRM_OWNERSHIP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)}. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture confirmOwnershipAsync(String transactionId, TravelRuleOwnershipConfirmRequest params, RequestOptions options) { + return client.executeAsync(confirmOwnershipRequest(transactionId, params), options, CONFIRM_OWNERSHIP_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)}, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return the result + */ + public TravelRuleTransferDetail confirmOwnership(String transactionId, TravelRuleOwnershipConfirmRequest params) { + return client.execute(confirmOwnershipRequest(transactionId, params), RequestOptions.none(), CONFIRM_OWNERSHIP_RESPONSE).data(); + } + + /** + * Asynchronous {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)}, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture confirmOwnershipAsync(String transactionId, TravelRuleOwnershipConfirmRequest params) { + return client.executeAsync(confirmOwnershipRequest(transactionId, params), RequestOptions.none(), CONFIRM_OWNERSHIP_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler UPDATE_TRANSFER_RESPONSE = Responses.json(Conv.model(TravelRuleTransferDetail::fromJson)); + + private static ApiRequest updateTransferRequest(String transactionId, TravelRuleTransferPatchRequest params) { + return ApiRequest.builder("PATCH", "/v3/transactions/{transaction_id}/travel-rule/") + .pathParam("transaction_id", transactionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CONFIRM_OWNERSHIP_RESPONSE = Responses.json(Conv.model(TravelRuleTransferDetail::fromJson)); + + private static ApiRequest confirmOwnershipRequest(String transactionId, TravelRuleOwnershipConfirmRequest params) { + return ApiRequest.builder("POST", "/v3/transactions/{transaction_id}/travel-rule/ownership/") + .pathParam("transaction_id", transactionId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code transactions.travel_rule} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)} with the raw response. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateTransfer(String transactionId, TravelRuleTransferPatchRequest params, RequestOptions options) { + return client.execute(updateTransferRequest(transactionId, params), options, UPDATE_TRANSFER_RESPONSE); + } + + /** + * Asynchronous {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)} with the raw response. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateTransferAsync(String transactionId, TravelRuleTransferPatchRequest params, RequestOptions options) { + return client.executeAsync(updateTransferRequest(transactionId, params), options, UPDATE_TRANSFER_RESPONSE); + } + + /** + * {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return the result + */ + public RawResponse updateTransfer(String transactionId, TravelRuleTransferPatchRequest params) { + return client.execute(updateTransferRequest(transactionId, params), RequestOptions.none(), UPDATE_TRANSFER_RESPONSE); + } + + /** + * Asynchronous {@link #updateTransfer(String, TravelRuleTransferPatchRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateTransferAsync(String transactionId, TravelRuleTransferPatchRequest params) { + return client.executeAsync(updateTransferRequest(transactionId, params), RequestOptions.none(), UPDATE_TRANSFER_RESPONSE); + } + + /** + * {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)} with the raw response. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse confirmOwnership(String transactionId, TravelRuleOwnershipConfirmRequest params, RequestOptions options) { + return client.execute(confirmOwnershipRequest(transactionId, params), options, CONFIRM_OWNERSHIP_RESPONSE); + } + + /** + * Asynchronous {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)} with the raw response. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> confirmOwnershipAsync(String transactionId, TravelRuleOwnershipConfirmRequest params, RequestOptions options) { + return client.executeAsync(confirmOwnershipRequest(transactionId, params), options, CONFIRM_OWNERSHIP_RESPONSE); + } + + /** + * {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return the result + */ + public RawResponse confirmOwnership(String transactionId, TravelRuleOwnershipConfirmRequest params) { + return client.execute(confirmOwnershipRequest(transactionId, params), RequestOptions.none(), CONFIRM_OWNERSHIP_RESPONSE); + } + + /** + * Asynchronous {@link #confirmOwnership(String, TravelRuleOwnershipConfirmRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param transactionId the {@code transaction_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> confirmOwnershipAsync(String transactionId, TravelRuleOwnershipConfirmRequest params) { + return client.executeAsync(confirmOwnershipRequest(transactionId, params), RequestOptions.none(), CONFIRM_OWNERSHIP_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/TravelRuleResource.java b/src/main/java/me/didit/resources/TravelRuleResource.java new file mode 100644 index 0000000..8842e94 --- /dev/null +++ b/src/main/java/me/didit/resources/TravelRuleResource.java @@ -0,0 +1,612 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.TravelRuleInboundRequest; +import me.didit.types.TravelRuleInboundResponse; +import me.didit.types.TravelRuleListVaspsParams; +import me.didit.types.TravelRuleSettingsDetail; +import me.didit.types.TravelRuleSettingsUpdate; +import me.didit.types.TravelRuleWidgetSessionCreate; +import me.didit.types.TravelRuleWidgetSessionResponse; +import me.didit.types.VaspDirectoryEntry; + +/** The {@code travel_rule} resource: {@code client.travelRule()}. */ +public final class TravelRuleResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + private final TravelRuleWalletAddressesResource walletAddresses; + + TravelRuleResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + this.walletAddresses = new TravelRuleWalletAddressesResource(client); + } + + /** + * The {@code travel_rule.wallet_addresses} resource. + * + * @return the resource + */ + public TravelRuleWalletAddressesResource walletAddresses() { + return walletAddresses; + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Get Travel Rule settings + * + *

Read the application's Travel Rule settings and VASP profile. Auto-creates a default (disabled) settings row and an empty profile on first read. + * + *

{@code GET /v3/travel-rule/settings/} + * + * @param options per-request options that override the client options + * @return the response body + */ + public TravelRuleSettingsDetail retrieveSettings(RequestOptions options) { + return client.execute(retrieveSettingsRequest(), options, RETRIEVE_SETTINGS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveSettings(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveSettingsAsync(RequestOptions options) { + return client.executeAsync(retrieveSettingsRequest(), options, RETRIEVE_SETTINGS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveSettings(RequestOptions)}, with the client's options. + * + * @return the result + */ + public TravelRuleSettingsDetail retrieveSettings() { + return client.execute(retrieveSettingsRequest(), RequestOptions.none(), RETRIEVE_SETTINGS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveSettings(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture retrieveSettingsAsync() { + return client.executeAsync(retrieveSettingsRequest(), RequestOptions.none(), RETRIEVE_SETTINGS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update Travel Rule settings + * + *

Upsert the application's Travel Rule settings and VASP profile. Partial update โ€” only send the fields you want to change. Setting is_enabled: true requires a non-blank legal_name (already stored or included in the same request), otherwise returns 400. + * + *

{@code PUT /v3/travel-rule/settings/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TravelRuleSettingsDetail updateSettings(TravelRuleSettingsUpdate params, RequestOptions options) { + return client.execute(updateSettingsRequest(params), options, UPDATE_SETTINGS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateSettingsAsync(TravelRuleSettingsUpdate params, RequestOptions options) { + return client.executeAsync(updateSettingsRequest(params), options, UPDATE_SETTINGS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TravelRuleSettingsDetail updateSettings(TravelRuleSettingsUpdate params) { + return client.execute(updateSettingsRequest(params), RequestOptions.none(), UPDATE_SETTINGS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateSettingsAsync(TravelRuleSettingsUpdate params) { + return client.executeAsync(updateSettingsRequest(params), RequestOptions.none(), UPDATE_SETTINGS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Search the VASP directory + * + *

Paginated search across discoverable Didit customers with Travel Rule enabled, plus VASPs catalogued in the internal counterparty registry. Excludes your own application's profile. + * + *

{@code GET /v3/travel-rule/vasps/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page listVasps(TravelRuleListVaspsParams params, RequestOptions options) { + return client.execute(listVaspsRequest(params), options, LIST_VASPS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listVaspsAsync(TravelRuleListVaspsParams params, RequestOptions options) { + return client.executeAsync(listVaspsRequest(params), options, LIST_VASPS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page listVasps(TravelRuleListVaspsParams params) { + return client.execute(listVaspsRequest(params), RequestOptions.none(), LIST_VASPS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listVaspsAsync(TravelRuleListVaspsParams params) { + return client.executeAsync(listVaspsRequest(params), RequestOptions.none(), LIST_VASPS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page listVasps(RequestOptions options) { + return client.execute(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), options, LIST_VASPS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listVaspsAsync(RequestOptions options) { + return client.executeAsync(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), options, LIST_VASPS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page listVasps() { + return client.execute(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), RequestOptions.none(), LIST_VASPS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listVaspsAsync() { + return client.executeAsync(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), RequestOptions.none(), LIST_VASPS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Register an after-deposit (sunrise) inbound transfer + * + *

Register Travel Rule data for a crypto deposit that already settled on-chain before any exchange took place. Creates an inbound travelRule transaction (or reuses an unclaimed deposit) and resolves the transfer against your wallet address book. A transaction.created webhook fires for newly-created transactions. + * + *

{@code POST /v3/travel-rule/inbound/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TravelRuleInboundResponse registerInbound(TravelRuleInboundRequest params, RequestOptions options) { + return client.execute(registerInboundRequest(params), options, REGISTER_INBOUND_RESPONSE).data(); + } + + /** + * Asynchronous {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture registerInboundAsync(TravelRuleInboundRequest params, RequestOptions options) { + return client.executeAsync(registerInboundRequest(params), options, REGISTER_INBOUND_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TravelRuleInboundResponse registerInbound(TravelRuleInboundRequest params) { + return client.execute(registerInboundRequest(params), RequestOptions.none(), REGISTER_INBOUND_RESPONSE).data(); + } + + /** + * Asynchronous {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture registerInboundAsync(TravelRuleInboundRequest params) { + return client.executeAsync(registerInboundRequest(params), RequestOptions.none(), REGISTER_INBOUND_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Mint a wallet-ownership widget session + * + *

Mint a hosted wallet-ownership widget URL/token. Send the customer to the returned url to prove control of a wallet (message signing, Satoshi test, screenshot, or self-declaration). The widget is web-only in this release - open the url in the system browser or a custom tab, never inside a mobile SDK webview. + * + *

{@code POST /v3/travel-rule/widget-session/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public TravelRuleWidgetSessionResponse createWidgetSession(TravelRuleWidgetSessionCreate params, RequestOptions options) { + return client.execute(createWidgetSessionRequest(params), options, CREATE_WIDGET_SESSION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createWidgetSessionAsync(TravelRuleWidgetSessionCreate params, RequestOptions options) { + return client.executeAsync(createWidgetSessionRequest(params), options, CREATE_WIDGET_SESSION_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public TravelRuleWidgetSessionResponse createWidgetSession(TravelRuleWidgetSessionCreate params) { + return client.execute(createWidgetSessionRequest(params), RequestOptions.none(), CREATE_WIDGET_SESSION_RESPONSE).data(); + } + + /** + * Asynchronous {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createWidgetSessionAsync(TravelRuleWidgetSessionCreate params) { + return client.executeAsync(createWidgetSessionRequest(params), RequestOptions.none(), CREATE_WIDGET_SESSION_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler RETRIEVE_SETTINGS_RESPONSE = Responses.json(Conv.model(TravelRuleSettingsDetail::fromJson)); + + private static ApiRequest retrieveSettingsRequest() { + return ApiRequest.builder("GET", "/v3/travel-rule/settings/") + .build(); + } + + private static final ResponseHandler UPDATE_SETTINGS_RESPONSE = Responses.json(Conv.model(TravelRuleSettingsDetail::fromJson)); + + private static ApiRequest updateSettingsRequest(TravelRuleSettingsUpdate params) { + return ApiRequest.builder("PUT", "/v3/travel-rule/settings/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler> LIST_VASPS_RESPONSE = Responses.page(Conv.model(VaspDirectoryEntry::fromJson)); + + private static ApiRequest listVaspsRequest(TravelRuleListVaspsParams params) { + return ApiRequest.builder("GET", "/v3/travel-rule/vasps/") + .params(params) + .queryFields("search", "limit", "offset") + .build(); + } + + private static final ResponseHandler REGISTER_INBOUND_RESPONSE = Responses.json(Conv.model(TravelRuleInboundResponse::fromJson)); + + private static ApiRequest registerInboundRequest(TravelRuleInboundRequest params) { + return ApiRequest.builder("POST", "/v3/travel-rule/inbound/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CREATE_WIDGET_SESSION_RESPONSE = Responses.json(Conv.model(TravelRuleWidgetSessionResponse::fromJson)); + + private static ApiRequest createWidgetSessionRequest(TravelRuleWidgetSessionCreate params) { + return ApiRequest.builder("POST", "/v3/travel-rule/widget-session/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + /** The {@code travel_rule} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #retrieveSettings(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse retrieveSettings(RequestOptions options) { + return client.execute(retrieveSettingsRequest(), options, RETRIEVE_SETTINGS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveSettings(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveSettingsAsync(RequestOptions options) { + return client.executeAsync(retrieveSettingsRequest(), options, RETRIEVE_SETTINGS_RESPONSE); + } + + /** + * {@link #retrieveSettings(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse retrieveSettings() { + return client.execute(retrieveSettingsRequest(), RequestOptions.none(), RETRIEVE_SETTINGS_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveSettings(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> retrieveSettingsAsync() { + return client.executeAsync(retrieveSettingsRequest(), RequestOptions.none(), RETRIEVE_SETTINGS_RESPONSE); + } + + /** + * {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateSettings(TravelRuleSettingsUpdate params, RequestOptions options) { + return client.execute(updateSettingsRequest(params), options, UPDATE_SETTINGS_RESPONSE); + } + + /** + * Asynchronous {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateSettingsAsync(TravelRuleSettingsUpdate params, RequestOptions options) { + return client.executeAsync(updateSettingsRequest(params), options, UPDATE_SETTINGS_RESPONSE); + } + + /** + * {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse updateSettings(TravelRuleSettingsUpdate params) { + return client.execute(updateSettingsRequest(params), RequestOptions.none(), UPDATE_SETTINGS_RESPONSE); + } + + /** + * Asynchronous {@link #updateSettings(TravelRuleSettingsUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateSettingsAsync(TravelRuleSettingsUpdate params) { + return client.executeAsync(updateSettingsRequest(params), RequestOptions.none(), UPDATE_SETTINGS_RESPONSE); + } + + /** + * {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> listVasps(TravelRuleListVaspsParams params, RequestOptions options) { + return client.execute(listVaspsRequest(params), options, LIST_VASPS_RESPONSE); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listVaspsAsync(TravelRuleListVaspsParams params, RequestOptions options) { + return client.executeAsync(listVaspsRequest(params), options, LIST_VASPS_RESPONSE); + } + + /** + * {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> listVasps(TravelRuleListVaspsParams params) { + return client.execute(listVaspsRequest(params), RequestOptions.none(), LIST_VASPS_RESPONSE); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listVaspsAsync(TravelRuleListVaspsParams params) { + return client.executeAsync(listVaspsRequest(params), RequestOptions.none(), LIST_VASPS_RESPONSE); + } + + /** + * {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> listVasps(RequestOptions options) { + return client.execute(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), options, LIST_VASPS_RESPONSE); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listVaspsAsync(RequestOptions options) { + return client.executeAsync(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), options, LIST_VASPS_RESPONSE); + } + + /** + * {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> listVasps() { + return client.execute(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), RequestOptions.none(), LIST_VASPS_RESPONSE); + } + + /** + * Asynchronous {@link #listVasps(TravelRuleListVaspsParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listVaspsAsync() { + return client.executeAsync(listVaspsRequest(TravelRuleListVaspsParams.builder().build()), RequestOptions.none(), LIST_VASPS_RESPONSE); + } + + /** + * {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse registerInbound(TravelRuleInboundRequest params, RequestOptions options) { + return client.execute(registerInboundRequest(params), options, REGISTER_INBOUND_RESPONSE); + } + + /** + * Asynchronous {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> registerInboundAsync(TravelRuleInboundRequest params, RequestOptions options) { + return client.executeAsync(registerInboundRequest(params), options, REGISTER_INBOUND_RESPONSE); + } + + /** + * {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse registerInbound(TravelRuleInboundRequest params) { + return client.execute(registerInboundRequest(params), RequestOptions.none(), REGISTER_INBOUND_RESPONSE); + } + + /** + * Asynchronous {@link #registerInbound(TravelRuleInboundRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> registerInboundAsync(TravelRuleInboundRequest params) { + return client.executeAsync(registerInboundRequest(params), RequestOptions.none(), REGISTER_INBOUND_RESPONSE); + } + + /** + * {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse createWidgetSession(TravelRuleWidgetSessionCreate params, RequestOptions options) { + return client.execute(createWidgetSessionRequest(params), options, CREATE_WIDGET_SESSION_RESPONSE); + } + + /** + * Asynchronous {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createWidgetSessionAsync(TravelRuleWidgetSessionCreate params, RequestOptions options) { + return client.executeAsync(createWidgetSessionRequest(params), options, CREATE_WIDGET_SESSION_RESPONSE); + } + + /** + * {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse createWidgetSession(TravelRuleWidgetSessionCreate params) { + return client.execute(createWidgetSessionRequest(params), RequestOptions.none(), CREATE_WIDGET_SESSION_RESPONSE); + } + + /** + * Asynchronous {@link #createWidgetSession(TravelRuleWidgetSessionCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createWidgetSessionAsync(TravelRuleWidgetSessionCreate params) { + return client.executeAsync(createWidgetSessionRequest(params), RequestOptions.none(), CREATE_WIDGET_SESSION_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/TravelRuleWalletAddressesResource.java b/src/main/java/me/didit/resources/TravelRuleWalletAddressesResource.java new file mode 100644 index 0000000..fddb7d6 --- /dev/null +++ b/src/main/java/me/didit/resources/TravelRuleWalletAddressesResource.java @@ -0,0 +1,517 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.TravelRuleWalletAddressesListParams; +import me.didit.types.WalletAddressEntry; +import me.didit.types.WalletAddressEntryCreate; +import me.didit.types.WalletAddressEntryUpdate; +import org.jspecify.annotations.Nullable; + +/** The {@code travel_rule.wallet_addresses} resource: {@code client.travelRule().walletAddresses()}. */ +public final class TravelRuleWalletAddressesResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + TravelRuleWalletAddressesResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List wallet address book entries + * + *

Paginated list of your application's Travel Rule wallet address book, newest first. + * + *

{@code GET /v3/travel-rule/wallet-addresses/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(TravelRuleWalletAddressesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(TravelRuleWalletAddressesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(TravelRuleWalletAddressesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(TravelRuleWalletAddressesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(TravelRuleWalletAddressesListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(TravelRuleWalletAddressesListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(TravelRuleWalletAddressesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(TravelRuleWalletAddressesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Register a wallet address + * + *

Add an entry to your Travel Rule wallet address book so inbound INTERNAL-rail transfers can resolve against it. + * + *

{@code POST /v3/travel-rule/wallet-addresses/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public WalletAddressEntry create(WalletAddressEntryCreate params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(WalletAddressEntryCreate, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(WalletAddressEntryCreate params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(WalletAddressEntryCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public WalletAddressEntry create(WalletAddressEntryCreate params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(WalletAddressEntryCreate, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(WalletAddressEntryCreate params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update wallet address holder metadata + * + *

Partial update of holder_name, holder_vendor_data, entity_type, and travel_address. Setting travel_address attaches a TRP routing address to the entry; invalid values are rejected with 400. The response echoes only these four fields. + * + *

{@code PATCH /v3/travel-rule/wallet-addresses/{entry_uuid}/} + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public WalletAddressEntryUpdate update(String entryUuid, WalletAddressEntryUpdate params, RequestOptions options) { + return client.execute(updateRequest(entryUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, WalletAddressEntryUpdate, RequestOptions)}. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String entryUuid, WalletAddressEntryUpdate params, RequestOptions options) { + return client.executeAsync(updateRequest(entryUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, WalletAddressEntryUpdate, RequestOptions)}, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @return the result + */ + public WalletAddressEntryUpdate update(String entryUuid, WalletAddressEntryUpdate params) { + return client.execute(updateRequest(entryUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, WalletAddressEntryUpdate, RequestOptions)}, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String entryUuid, WalletAddressEntryUpdate params) { + return client.executeAsync(updateRequest(entryUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete a wallet address + * + *

Deletes the entry. It stops matching new transfers immediately and the address is freed up for re-registration. + * + *

{@code DELETE /v3/travel-rule/wallet-addresses/{entry_uuid}/} + * + * @param entryUuid the {@code entry_uuid} + * @param options per-request options that override the client options + */ + public void delete(String entryUuid, RequestOptions options) { + client.execute(deleteRequest(entryUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param entryUuid the {@code entry_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String entryUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(entryUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + */ + public void delete(String entryUuid) { + client.execute(deleteRequest(entryUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String entryUuid) { + return client.executeAsync(deleteRequest(entryUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(WalletAddressEntry::fromJson)); + + private static ApiRequest listRequest(TravelRuleWalletAddressesListParams params) { + return ApiRequest.builder("GET", "/v3/travel-rule/wallet-addresses/") + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(WalletAddressEntry::fromJson)); + + private static ApiRequest createRequest(WalletAddressEntryCreate params) { + return ApiRequest.builder("POST", "/v3/travel-rule/wallet-addresses/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(WalletAddressEntryUpdate::fromJson)); + + private static ApiRequest updateRequest(String entryUuid, WalletAddressEntryUpdate params) { + return ApiRequest.builder("PATCH", "/v3/travel-rule/wallet-addresses/{entry_uuid}/") + .pathParam("entry_uuid", entryUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String entryUuid) { + return ApiRequest.builder("DELETE", "/v3/travel-rule/wallet-addresses/{entry_uuid}/") + .pathParam("entry_uuid", entryUuid) + .build(); + } + + /** The {@code travel_rule.wallet_addresses} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(TravelRuleWalletAddressesListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(TravelRuleWalletAddressesListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(TravelRuleWalletAddressesListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(TravelRuleWalletAddressesListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(TravelRuleWalletAddressesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(TravelRuleWalletAddressesListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(TravelRuleWalletAddressesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(TravelRuleWalletAddressesListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(TravelRuleWalletAddressesListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(WalletAddressEntryCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(WalletAddressEntryCreate params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(WalletAddressEntryCreate, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(WalletAddressEntryCreate params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(WalletAddressEntryCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(WalletAddressEntryCreate params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(WalletAddressEntryCreate, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(WalletAddressEntryCreate params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #update(String, WalletAddressEntryUpdate, RequestOptions)} with the raw response. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String entryUuid, WalletAddressEntryUpdate params, RequestOptions options) { + return client.execute(updateRequest(entryUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, WalletAddressEntryUpdate, RequestOptions)} with the raw response. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String entryUuid, WalletAddressEntryUpdate params, RequestOptions options) { + return client.executeAsync(updateRequest(entryUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, WalletAddressEntryUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String entryUuid, WalletAddressEntryUpdate params) { + return client.execute(updateRequest(entryUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, WalletAddressEntryUpdate, RequestOptions)} with the raw response, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String entryUuid, WalletAddressEntryUpdate params) { + return client.executeAsync(updateRequest(entryUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param entryUuid the {@code entry_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String entryUuid, RequestOptions options) { + return client.execute(deleteRequest(entryUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param entryUuid the {@code entry_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String entryUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(entryUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String entryUuid) { + return client.execute(deleteRequest(entryUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param entryUuid the {@code entry_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String entryUuid) { + return client.executeAsync(deleteRequest(entryUuid), RequestOptions.none(), DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/UsersResource.java b/src/main/java/me/didit/resources/UsersResource.java new file mode 100644 index 0000000..f8021de --- /dev/null +++ b/src/main/java/me/didit/resources/UsersResource.java @@ -0,0 +1,1512 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.BinaryResponse; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.UserDetailItem; +import me.didit.types.UserListItem; +import me.didit.types.UsersBatchDeleteParams; +import me.didit.types.UsersBatchDeleteResponse; +import me.didit.types.UsersCreateParams; +import me.didit.types.UsersListNetworksResponse; +import me.didit.types.UsersListParams; +import me.didit.types.UsersRetrieveOngoingMonitoringJobResponse; +import me.didit.types.UsersSetAmlMonitoringParams; +import me.didit.types.UsersSetAmlMonitoringResponse; +import me.didit.types.UsersSetOngoingMonitoringParams; +import me.didit.types.UsersSetOngoingMonitoringResponse; +import me.didit.types.UsersUpdateParams; +import me.didit.types.UsersUpdateStatusParams; +import me.didit.types.UsersUploadFaceParams; +import me.didit.types.UsersUploadFaceResponse; + +/** The {@code users} resource: {@code client.users()}. */ +public final class UsersResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + UsersResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List users + * + *

List [users](/entities/users) Didit assembles from KYC sessions sharing the same vendor_data (free-form string, NOT a UUID), plus users created via the API. Paginated, ordered by last_session_at desc. This endpoint does not support filtering or search parameters โ€” fetch pages and filter client-side. + * + *

{@code GET /v3/users/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(UsersListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(UsersListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(UsersListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(UsersListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(UsersListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(UsersListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(UsersListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(UsersListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(UsersListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(UsersListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(UsersListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get user + * + *

Fetch one [user](/entities/users) by vendor_data (exact match). Adds metadata, comments, and updated_at to the list view, and switches tags to the detailed tag-link shape. + * + *

{@code GET /v3/users/{vendor_data}/} + * + * @param vendorData Your unique identifier for the user โ€” a free-form string (NOT a UUID). This is the same value you passed as `vendor_data` when creating the session that first introduced this user, matched exactly as sent. + * @param options per-request options that override the client options + * @return the response body + */ + public UserDetailItem retrieve(String vendorData, RequestOptions options) { + return client.execute(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String vendorData, RequestOptions options) { + return client.executeAsync(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public UserDetailItem retrieve(String vendorData) { + return client.execute(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String vendorData) { + return client.executeAsync(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update user + * + *

Partial update of a user: display_name, full_name, date_of_birth, status, metadata, approved_emails/approved_phones/issuing_states. metadata fully replaces. Note: unlike [Update User Status](#patch-/v3/users/-vendor_data-/update-status/), changing status here does NOT record a status-change activity and does NOT sync the system blocklist โ€” use the dedicated update-status endpoint for BLOCKED/unblock flows. + * + *

{@code PATCH /v3/users/{vendor_data}/} + * + * @param vendorData Your unique identifier for the user (free-form string, NOT a UUID). + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UserDetailItem update(String vendorData, UsersUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(vendorData, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData, UsersUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, UsersUpdateParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public UserDetailItem update(String vendorData, UsersUpdateParams params) { + return client.execute(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData, UsersUpdateParams params) { + return client.executeAsync(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, UsersUpdateParams, RequestOptions)}, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public UserDetailItem update(String vendorData, RequestOptions options) { + return client.execute(updateRequest(vendorData, UsersUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)}, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, UsersUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, UsersUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public UserDetailItem update(String vendorData) { + return client.execute(updateRequest(vendorData, UsersUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String vendorData) { + return client.executeAsync(updateRequest(vendorData, UsersUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Download the full user history PDF report + * + *

Render and download one compliance-ready PDF containing the full verification history of the user identified by vendor_data. It is the same document the Console produces from User detail โ†’ Actions โ†’ Download PDF, so periodic compliance exports no longer need a person clicking in the Console. + * + *

What the report contains. A cover page with the profile summary (name, date of birth, issuing states, approved emails and phones), the latest status of every feature, the session counters and an index of the sessions included โ€” followed by the standard report of every included session, in chronological order (oldest first). Each session report is the same document GET /v3/session/{sessionId}/generate-pdf/ returns for that session. + * + *

Eligible sessions. Only User Verification (KYC) sessions in Approved, Declined, In Review or Kyc Expired are included; sessions in any other status are skipped. If the user has no session in one of those statuses the endpoint returns 403 โ€” see below. + * + *

Cap. The report is capped at the 20 most recent reportable sessions. When a user has more, the newest 20 are included and the cover page states how many older sessions were left out. Use GET /v3/sessions/?vendor_data=โ€ฆ for the complete list as JSON. + * + *

Branding. If your application has white-label customization, the cover and every session report are rendered with your logo and privacy-policy URL; otherwise they carry Didit branding. Reports are rendered in English โ€” there is no language parameter. + * + *

No caching. Every call re-renders the PDF from the current data, so a report generated after a manual review reflects the reviewer's decision. Two calls for the same user can produce byte-different files โ€” archive the downloaded file if you need an immutable copy. + * + *

Latency. Rendering is synchronous and downloads every stored image of every included session, so a user with many media-heavy sessions can take tens of seconds. Use a generous client read timeout (120 s recommended) and stream the body to disk. Generation stops at a server-side time budget instead of running until your client gives up: if that budget is reached, the response is still a valid PDF containing the most recent sessions, and the cover states how many were omitted. + * + *

Scope. The user is resolved inside the application that owns the API key. A key can never export a user of another application โ€” such a user does not exist for it and the endpoint returns 404. + * + *

Trailing slash. The canonical route ends with a trailing slash (โ€ฆ/generate-pdf/). A request without it is served directly with the same response โ€” there is no 301 redirect, so no client has to follow redirects and curl does not need -L. Use the slashed URL as in the samples. + * + *

{@code GET /v3/users/{vendor_data}/generate-pdf/} + *

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it. + * + * @param vendorData Your unique identifier for the user โ€” a free-form string (NOT a UUID). This is the same value you passed as `vendor_data` when creating the user's sessions, matched exactly as sent. URL-encode it; a value containing `/` cannot be addressed by this route. + * @param options per-request options that override the client options + * @return the response body + */ + public BinaryResponse generatePdf(String vendorData, RequestOptions options) { + return client.execute(generatePdfRequest(vendorData), options, GENERATE_PDF_RESPONSE).data(); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture generatePdfAsync(String vendorData, RequestOptions options) { + return client.executeAsync(generatePdfRequest(vendorData), options, GENERATE_PDF_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #generatePdf(String, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public BinaryResponse generatePdf(String vendorData) { + return client.execute(generatePdfRequest(vendorData), RequestOptions.none(), GENERATE_PDF_RESPONSE).data(); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture generatePdfAsync(String vendorData) { + return client.executeAsync(generatePdfRequest(vendorData), RequestOptions.none(), GENERATE_PDF_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Batch delete users + * + *

Permanently delete users โ€” the user records are removed permanently. For everyday blocking prefer [Update User Status](#patch-/v3/users/-vendor_data-/update-status/) with BLOCKED. Select users with vendor_data_list, with didit_internal_id_list, or with both at once; or pass delete_all: true. The Console's filter_* batch params are rejected with a 400 rather than ignored, so a narrowed intent can never turn into a full wipe. + * + *

Biometric templates: every image-free biometric template retained for these users after session deletion (see /v3/biometric-templates/) is purged before the user is deleted, so the person stops matching in duplicate detection and Face Search. If a template cannot be purged because a biometric store is unavailable, the call returns 503, no user in the request is deleted, and repeating the request finishes the job. + * + *

{@code POST /v3/users/delete/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UsersBatchDeleteResponse batchDelete(UsersBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(UsersBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public UsersBatchDeleteResponse batchDelete(UsersBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(UsersBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public UsersBatchDeleteResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public UsersBatchDeleteResponse batchDelete() { + return client.execute(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Enable or disable AML ongoing monitoring for users + * + *

Turns AML ongoing monitoring on or off for the selected users, with the same semantics as the Business Console. Exactly one monitored AML screening is kept per user, so a profile that verified several times is monitored and billed once; disabling turns monitoring off across all of the profile's screenings. Users without any AML screening are screened first (billed as a regular AML screening) when they have the full name, date of birth and country needed; otherwise they are reported as skipped_no_identity_data. + * + *

Set estimate_only: true to preview counts and costs without writing anything. Selections of 20 profiles or fewer resolve inline and return 200 with the completed job; larger selections return 202 and run in the background - poll [Get AML monitoring job](#get-/v3/aml-monitoring/jobs/-job_id-/) with the returned job_id. Enabling is refused with 403 when the organization balance does not cover the estimate. Identifiers that match nothing are listed in unmatched and never fail the request: a selection that matches nothing completes as an empty job (total 0), the same convention as the batch delete endpoints. + * + *

{@code POST /v3/users/aml-monitoring/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UsersSetAmlMonitoringResponse setAmlMonitoring(UsersSetAmlMonitoringParams params, RequestOptions options) { + return client.execute(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture setAmlMonitoringAsync(UsersSetAmlMonitoringParams params, RequestOptions options) { + return client.executeAsync(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public UsersSetAmlMonitoringResponse setAmlMonitoring(UsersSetAmlMonitoringParams params) { + return client.execute(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture setAmlMonitoringAsync(UsersSetAmlMonitoringParams params) { + return client.executeAsync(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update user status + * + *

Flip only the lifecycle status of a user โ€” ACTIVE/FLAGGED/BLOCKED (NOT session statuses). BLOCKED adds the vendor_data to the system blocklist; moving away from BLOCKED removes that entry. Each change is recorded as a STATUS_CHANGED activity on the user. + * + *

{@code PATCH /v3/users/{vendor_data}/update-status/} + * + * @param vendorData Your unique identifier for the user. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UserDetailItem updateStatus(String vendorData, UsersUpdateStatusParams params, RequestOptions options) { + return client.execute(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)}. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateStatusAsync(String vendorData, UsersUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public UserDetailItem updateStatus(String vendorData, UsersUpdateStatusParams params) { + return client.execute(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)}, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateStatusAsync(String vendorData, UsersUpdateStatusParams params) { + return client.executeAsync(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create user + * + *

Pre-create a [user](/entities/users) by vendor_data *without* a verification session. vendor_data must be unique among non-deleted users for the application (exact match; conflicts return 400). Not idempotent. + * + *

{@code POST /v3/users/create/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UserDetailItem create(UsersCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(UsersCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(UsersCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(UsersCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public UserDetailItem create(UsersCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(UsersCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(UsersCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Upload user face + * + *

Attach a trusted imported face image to an existing User profile. Use this after creating or retrieving a User by vendor_data and reading its didit_internal_id. The uploaded face is stored on the User profile and indexed for duplicate detection and face search. It is not added to a face blocklist. + * + *

{@code POST /v3/organization/{organization_id}/application/{application_id}/vendor-users/by-id/{didit_internal_id}/faces/upload/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param diditInternalId Didit's internal User UUID, returned as `didit_internal_id` by `GET /v3/users/{vendor_data}/` and `POST /v3/users/create/`. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UsersUploadFaceResponse uploadFace(String diditInternalId, UsersUploadFaceParams params, RequestOptions options) { + return client.execute(uploadFaceRequest(diditInternalId, params), options, UPLOAD_FACE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)}. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture uploadFaceAsync(String diditInternalId, UsersUploadFaceParams params, RequestOptions options) { + return client.executeAsync(uploadFaceRequest(diditInternalId, params), options, UPLOAD_FACE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)}, with the client's options. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @return the result + */ + public UsersUploadFaceResponse uploadFace(String diditInternalId, UsersUploadFaceParams params) { + return client.execute(uploadFaceRequest(diditInternalId, params), RequestOptions.none(), UPLOAD_FACE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)}, with the client's options. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture uploadFaceAsync(String diditInternalId, UsersUploadFaceParams params) { + return client.executeAsync(uploadFaceRequest(diditInternalId, params), RequestOptions.none(), UPLOAD_FACE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Toggle AML ongoing monitoring for users + * + *

Enables or disables AML ongoing monitoring at the user level. Exactly one monitored AML screening is kept per user; users without any AML screening (for example imported users) get one created and screened first, billed as a regular AML screening. Set estimate_only to preview counts and costs without writing. Batches of 20 or fewer resolve inline (200, COMPLETED); larger batches return 202 and run asynchronously. + * + *

{@code PATCH /v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public UsersSetOngoingMonitoringResponse setOngoingMonitoring(UsersSetOngoingMonitoringParams params, RequestOptions options) { + return client.execute(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture setOngoingMonitoringAsync(UsersSetOngoingMonitoringParams params, RequestOptions options) { + return client.executeAsync(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public UsersSetOngoingMonitoringResponse setOngoingMonitoring(UsersSetOngoingMonitoringParams params) { + return client.execute(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE).data(); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture setOngoingMonitoringAsync(UsersSetOngoingMonitoringParams params) { + return client.executeAsync(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get AML ongoing monitoring job + * + *

Progress and per-outcome counters of a monitoring toggle job. Poll every couple of seconds while status is PENDING or PROCESSING. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/{job_id}/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param jobId Monitoring job UUID returned by the toggle endpoint. + * @param options per-request options that override the client options + * @return the response body + */ + public UsersRetrieveOngoingMonitoringJobResponse retrieveOngoingMonitoringJob(String jobId, RequestOptions options) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)}. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveOngoingMonitoringJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieveOngoingMonitoringJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public UsersRetrieveOngoingMonitoringJobResponse retrieveOngoingMonitoringJob(String jobId) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)}, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture retrieveOngoingMonitoringJobAsync(String jobId) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE).thenApply(RawResponse::data); + } + + /** + * List networks for a user + * + *

List the networks a vendor user belongs to. + * + *

{@code GET /v3/organization/{organization_id}/application/{application_id}/users/{vendor_user_uuid}/networks/} + *

Application scoped: the organization and application ids come from the client options. + * + * @param vendorUserUuid Vendor user UUID. + * @param options per-request options that override the client options + * @return the response body + */ + public UsersListNetworksResponse listNetworks(String vendorUserUuid, RequestOptions options) { + return client.execute(listNetworksRequest(vendorUserUuid), options, LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String vendorUserUuid, RequestOptions options) { + return client.executeAsync(listNetworksRequest(vendorUserUuid), options, LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @return the result + */ + public UsersListNetworksResponse listNetworks(String vendorUserUuid) { + return client.execute(listNetworksRequest(vendorUserUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE).data(); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)}, with the client's options. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @return a future completed with the result + */ + public CompletableFuture listNetworksAsync(String vendorUserUuid) { + return client.executeAsync(listNetworksRequest(vendorUserUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(UserListItem::fromJson)); + + private static ApiRequest listRequest(UsersListParams params) { + return ApiRequest.builder("GET", "/v3/users/") + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(UserDetailItem::fromJson)); + + private static ApiRequest retrieveRequest(String vendorData) { + return ApiRequest.builder("GET", "/v3/users/{vendor_data}/") + .pathParam("vendor_data", vendorData) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(UserDetailItem::fromJson)); + + private static ApiRequest updateRequest(String vendorData, UsersUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/users/{vendor_data}/") + .pathParam("vendor_data", vendorData) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler GENERATE_PDF_RESPONSE = Responses.binary(); + + private static ApiRequest generatePdfRequest(String vendorData) { + return ApiRequest.builder("GET", "/v3/users/{vendor_data}/generate-pdf/") + .pathParam("vendor_data", vendorData) + .accept("application/pdf") + .build(); + } + + private static final ResponseHandler BATCH_DELETE_RESPONSE = Responses.json(Conv.model(UsersBatchDeleteResponse::fromJson)); + + private static ApiRequest batchDeleteRequest(UsersBatchDeleteParams params) { + return ApiRequest.builder("POST", "/v3/users/delete/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SET_AML_MONITORING_RESPONSE = Responses.byStatus(UsersSetAmlMonitoringResponse::fromResponse); + + private static ApiRequest setAmlMonitoringRequest(UsersSetAmlMonitoringParams params) { + return ApiRequest.builder("POST", "/v3/users/aml-monitoring/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPDATE_STATUS_RESPONSE = Responses.json(Conv.model(UserDetailItem::fromJson)); + + private static ApiRequest updateStatusRequest(String vendorData, UsersUpdateStatusParams params) { + return ApiRequest.builder("PATCH", "/v3/users/{vendor_data}/update-status/") + .pathParam("vendor_data", vendorData) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(UserDetailItem::fromJson)); + + private static ApiRequest createRequest(UsersCreateParams params) { + return ApiRequest.builder("POST", "/v3/users/create/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler UPLOAD_FACE_RESPONSE = Responses.json(Conv.model(UsersUploadFaceResponse::fromJson)); + + private static ApiRequest uploadFaceRequest(String diditInternalId, UsersUploadFaceParams params) { + return ApiRequest.builder("POST", "/v3/organization/{organization_id}/application/{application_id}/vendor-users/by-id/{didit_internal_id}/faces/upload/") + .applicationScoped() + .pathParam("didit_internal_id", diditInternalId) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SET_ONGOING_MONITORING_RESPONSE = Responses.byStatus(UsersSetOngoingMonitoringResponse::fromResponse); + + private static ApiRequest setOngoingMonitoringRequest(UsersSetOngoingMonitoringParams params) { + return ApiRequest.builder("PATCH", "/v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/") + .applicationScoped() + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE = Responses.json(Conv.model(UsersRetrieveOngoingMonitoringJobResponse::fromJson)); + + private static ApiRequest retrieveOngoingMonitoringJobRequest(String jobId) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/{job_id}/") + .applicationScoped() + .pathParam("job_id", jobId) + .build(); + } + + private static final ResponseHandler LIST_NETWORKS_RESPONSE = Responses.json(Conv.model(UsersListNetworksResponse::fromJson)); + + private static ApiRequest listNetworksRequest(String vendorUserUuid) { + return ApiRequest.builder("GET", "/v3/organization/{organization_id}/application/{application_id}/users/{vendor_user_uuid}/networks/") + .applicationScoped() + .pathParam("vendor_user_uuid", vendorUserUuid) + .build(); + } + + /** The {@code users} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(UsersListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(UsersListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(UsersListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(UsersListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(UsersListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(UsersListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(UsersListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(UsersListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(UsersListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(UsersListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(UsersListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(UsersListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(UsersListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String vendorData, RequestOptions options) { + return client.execute(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String vendorData, RequestOptions options) { + return client.executeAsync(retrieveRequest(vendorData), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public RawResponse retrieve(String vendorData) { + return client.execute(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String vendorData) { + return client.executeAsync(retrieveRequest(vendorData), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String vendorData, UsersUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(vendorData, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData, UsersUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String vendorData, UsersUpdateParams params) { + return client.execute(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData, UsersUpdateParams params) { + return client.executeAsync(updateRequest(vendorData, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public RawResponse update(String vendorData, RequestOptions options) { + return client.execute(updateRequest(vendorData, UsersUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData, RequestOptions options) { + return client.executeAsync(updateRequest(vendorData, UsersUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public RawResponse update(String vendorData) { + return client.execute(updateRequest(vendorData, UsersUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, UsersUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String vendorData) { + return client.executeAsync(updateRequest(vendorData, UsersUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #generatePdf(String, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return the result + */ + public RawResponse generatePdf(String vendorData, RequestOptions options) { + return client.execute(generatePdfRequest(vendorData), options, GENERATE_PDF_RESPONSE); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> generatePdfAsync(String vendorData, RequestOptions options) { + return client.executeAsync(generatePdfRequest(vendorData), options, GENERATE_PDF_RESPONSE); + } + + /** + * {@link #generatePdf(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return the result + */ + public RawResponse generatePdf(String vendorData) { + return client.execute(generatePdfRequest(vendorData), RequestOptions.none(), GENERATE_PDF_RESPONSE); + } + + /** + * Asynchronous {@link #generatePdf(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @return a future completed with the result + */ + public CompletableFuture> generatePdfAsync(String vendorData) { + return client.executeAsync(generatePdfRequest(vendorData), RequestOptions.none(), GENERATE_PDF_RESPONSE); + } + + /** + * {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(UsersBatchDeleteParams params, RequestOptions options) { + return client.execute(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(UsersBatchDeleteParams params, RequestOptions options) { + return client.executeAsync(batchDeleteRequest(params), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse batchDelete(UsersBatchDeleteParams params) { + return client.execute(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(UsersBatchDeleteParams params) { + return client.executeAsync(batchDeleteRequest(params), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse batchDelete(RequestOptions options) { + return client.execute(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync(RequestOptions options) { + return client.executeAsync(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), options, BATCH_DELETE_RESPONSE); + } + + /** + * {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse batchDelete() { + return client.execute(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #batchDelete(UsersBatchDeleteParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> batchDeleteAsync() { + return client.executeAsync(batchDeleteRequest(UsersBatchDeleteParams.builder().build()), RequestOptions.none(), BATCH_DELETE_RESPONSE); + } + + /** + * {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse setAmlMonitoring(UsersSetAmlMonitoringParams params, RequestOptions options) { + return client.execute(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> setAmlMonitoringAsync(UsersSetAmlMonitoringParams params, RequestOptions options) { + return client.executeAsync(setAmlMonitoringRequest(params), options, SET_AML_MONITORING_RESPONSE); + } + + /** + * {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse setAmlMonitoring(UsersSetAmlMonitoringParams params) { + return client.execute(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setAmlMonitoring(UsersSetAmlMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> setAmlMonitoringAsync(UsersSetAmlMonitoringParams params) { + return client.executeAsync(setAmlMonitoringRequest(params), RequestOptions.none(), SET_AML_MONITORING_RESPONSE); + } + + /** + * {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse updateStatus(String vendorData, UsersUpdateStatusParams params, RequestOptions options) { + return client.execute(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)} with the raw response. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateStatusAsync(String vendorData, UsersUpdateStatusParams params, RequestOptions options) { + return client.executeAsync(updateStatusRequest(vendorData, params), options, UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return the result + */ + public RawResponse updateStatus(String vendorData, UsersUpdateStatusParams params) { + return client.execute(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE); + } + + /** + * Asynchronous {@link #updateStatus(String, UsersUpdateStatusParams, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorData the {@code vendor_data} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateStatusAsync(String vendorData, UsersUpdateStatusParams params) { + return client.executeAsync(updateStatusRequest(vendorData, params), RequestOptions.none(), UPDATE_STATUS_RESPONSE); + } + + /** + * {@link #create(UsersCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(UsersCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(UsersCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(UsersCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(UsersCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(UsersCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(UsersCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(UsersCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)} with the raw response. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse uploadFace(String diditInternalId, UsersUploadFaceParams params, RequestOptions options) { + return client.execute(uploadFaceRequest(diditInternalId, params), options, UPLOAD_FACE_RESPONSE); + } + + /** + * Asynchronous {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)} with the raw response. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> uploadFaceAsync(String diditInternalId, UsersUploadFaceParams params, RequestOptions options) { + return client.executeAsync(uploadFaceRequest(diditInternalId, params), options, UPLOAD_FACE_RESPONSE); + } + + /** + * {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)} with the raw response, with the client's options. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @return the result + */ + public RawResponse uploadFace(String diditInternalId, UsersUploadFaceParams params) { + return client.execute(uploadFaceRequest(diditInternalId, params), RequestOptions.none(), UPLOAD_FACE_RESPONSE); + } + + /** + * Asynchronous {@link #uploadFace(String, UsersUploadFaceParams, RequestOptions)} with the raw response, with the client's options. + * + * @param diditInternalId the {@code didit_internal_id} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> uploadFaceAsync(String diditInternalId, UsersUploadFaceParams params) { + return client.executeAsync(uploadFaceRequest(diditInternalId, params), RequestOptions.none(), UPLOAD_FACE_RESPONSE); + } + + /** + * {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse setOngoingMonitoring(UsersSetOngoingMonitoringParams params, RequestOptions options) { + return client.execute(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> setOngoingMonitoringAsync(UsersSetOngoingMonitoringParams params, RequestOptions options) { + return client.executeAsync(setOngoingMonitoringRequest(params), options, SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse setOngoingMonitoring(UsersSetOngoingMonitoringParams params) { + return client.execute(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * Asynchronous {@link #setOngoingMonitoring(UsersSetOngoingMonitoringParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> setOngoingMonitoringAsync(UsersSetOngoingMonitoringParams params) { + return client.executeAsync(setOngoingMonitoringRequest(params), RequestOptions.none(), SET_ONGOING_MONITORING_RESPONSE); + } + + /** + * {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return the result + */ + public RawResponse retrieveOngoingMonitoringJob(String jobId, RequestOptions options) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response. + * + * @param jobId the {@code job_id} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveOngoingMonitoringJobAsync(String jobId, RequestOptions options) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), options, RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return the result + */ + public RawResponse retrieveOngoingMonitoringJob(String jobId) { + return client.execute(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * Asynchronous {@link #retrieveOngoingMonitoringJob(String, RequestOptions)} with the raw response, with the client's options. + * + * @param jobId the {@code job_id} + * @return a future completed with the result + */ + public CompletableFuture> retrieveOngoingMonitoringJobAsync(String jobId) { + return client.executeAsync(retrieveOngoingMonitoringJobRequest(jobId), RequestOptions.none(), RETRIEVE_ONGOING_MONITORING_JOB_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse listNetworks(String vendorUserUuid, RequestOptions options) { + return client.execute(listNetworksRequest(vendorUserUuid), options, LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String vendorUserUuid, RequestOptions options) { + return client.executeAsync(listNetworksRequest(vendorUserUuid), options, LIST_NETWORKS_RESPONSE); + } + + /** + * {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @return the result + */ + public RawResponse listNetworks(String vendorUserUuid) { + return client.execute(listNetworksRequest(vendorUserUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + + /** + * Asynchronous {@link #listNetworks(String, RequestOptions)} with the raw response, with the client's options. + * + * @param vendorUserUuid the {@code vendor_user_uuid} + * @return a future completed with the result + */ + public CompletableFuture> listNetworksAsync(String vendorUserUuid) { + return client.executeAsync(listNetworksRequest(vendorUserUuid), RequestOptions.none(), LIST_NETWORKS_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/WalletScreeningResource.java b/src/main/java/me/didit/resources/WalletScreeningResource.java new file mode 100644 index 0000000..3040145 --- /dev/null +++ b/src/main/java/me/didit/resources/WalletScreeningResource.java @@ -0,0 +1,239 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.BinaryResponse; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.WalletScreeningResult; +import me.didit.types.WalletScreeningScreenParams; + +/** The {@code wallet_screening} resource: {@code client.walletScreening()}. */ +public final class WalletScreeningResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + WalletScreeningResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * Screen a wallet address + * + *

Run on-demand AML screening for a single crypto wallet/address without creating a transaction. Resolves your application's configured blockchain analytics provider, screens the address synchronously, and returns the normalised risk result. LIGHTNING is available only with an Elliptic or Chainalysis BYOK connection added through Marketplace. Nothing is written to the transactions table. One AML monitoring usage is billed per successful screening (sandbox applications are not billed). + * + *

{@code POST /v3/wallet-screening/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public WalletScreeningResult screen(WalletScreeningScreenParams params, RequestOptions options) { + return client.execute(screenRequest(params), options, SCREEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #screen(WalletScreeningScreenParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture screenAsync(WalletScreeningScreenParams params, RequestOptions options) { + return client.executeAsync(screenRequest(params), options, SCREEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #screen(WalletScreeningScreenParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public WalletScreeningResult screen(WalletScreeningScreenParams params) { + return client.execute(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE).data(); + } + + /** + * Asynchronous {@link #screen(WalletScreeningScreenParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture screenAsync(WalletScreeningScreenParams params) { + return client.executeAsync(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Render a wallet-screening result as a PDF + * + *

Stateless companion to POST /v3/wallet-screening/: repost the exact JSON body that endpoint returned โ€” including the report_signature it added โ€” and get back a Didit-branded PDF of the same result. No provider is called and nothing is billed or persisted; this only re-renders a result Didit already produced. The signature ties the PDF to an unmodified result: editing risk_score, severity, sanctions_hit, or any other signed field before reposting fails with 400. + * + *

{@code POST /v3/wallet-screening/pdf/} + *

Returns the file; close the {@link me.didit.core.BinaryResponse} when you stream it. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public BinaryResponse screenPdf(WalletScreeningResult params, RequestOptions options) { + return client.execute(screenPdfRequest(params), options, SCREEN_PDF_RESPONSE).data(); + } + + /** + * Asynchronous {@link #screenPdf(WalletScreeningResult, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture screenPdfAsync(WalletScreeningResult params, RequestOptions options) { + return client.executeAsync(screenPdfRequest(params), options, SCREEN_PDF_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #screenPdf(WalletScreeningResult, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public BinaryResponse screenPdf(WalletScreeningResult params) { + return client.execute(screenPdfRequest(params), RequestOptions.none(), SCREEN_PDF_RESPONSE).data(); + } + + /** + * Asynchronous {@link #screenPdf(WalletScreeningResult, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture screenPdfAsync(WalletScreeningResult params) { + return client.executeAsync(screenPdfRequest(params), RequestOptions.none(), SCREEN_PDF_RESPONSE).thenApply(RawResponse::data); + } + + private static final ResponseHandler SCREEN_RESPONSE = Responses.json(Conv.model(WalletScreeningResult::fromJson)); + + private static ApiRequest screenRequest(WalletScreeningScreenParams params) { + return ApiRequest.builder("POST", "/v3/wallet-screening/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler SCREEN_PDF_RESPONSE = Responses.binary(); + + private static ApiRequest screenPdfRequest(WalletScreeningResult params) { + return ApiRequest.builder("POST", "/v3/wallet-screening/pdf/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .accept("application/pdf") + .build(); + } + + /** The {@code wallet_screening} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #screen(WalletScreeningScreenParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse screen(WalletScreeningScreenParams params, RequestOptions options) { + return client.execute(screenRequest(params), options, SCREEN_RESPONSE); + } + + /** + * Asynchronous {@link #screen(WalletScreeningScreenParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> screenAsync(WalletScreeningScreenParams params, RequestOptions options) { + return client.executeAsync(screenRequest(params), options, SCREEN_RESPONSE); + } + + /** + * {@link #screen(WalletScreeningScreenParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse screen(WalletScreeningScreenParams params) { + return client.execute(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE); + } + + /** + * Asynchronous {@link #screen(WalletScreeningScreenParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> screenAsync(WalletScreeningScreenParams params) { + return client.executeAsync(screenRequest(params), RequestOptions.none(), SCREEN_RESPONSE); + } + + /** + * {@link #screenPdf(WalletScreeningResult, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse screenPdf(WalletScreeningResult params, RequestOptions options) { + return client.execute(screenPdfRequest(params), options, SCREEN_PDF_RESPONSE); + } + + /** + * Asynchronous {@link #screenPdf(WalletScreeningResult, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> screenPdfAsync(WalletScreeningResult params, RequestOptions options) { + return client.executeAsync(screenPdfRequest(params), options, SCREEN_PDF_RESPONSE); + } + + /** + * {@link #screenPdf(WalletScreeningResult, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse screenPdf(WalletScreeningResult params) { + return client.execute(screenPdfRequest(params), RequestOptions.none(), SCREEN_PDF_RESPONSE); + } + + /** + * Asynchronous {@link #screenPdf(WalletScreeningResult, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> screenPdfAsync(WalletScreeningResult params) { + return client.executeAsync(screenPdfRequest(params), RequestOptions.none(), SCREEN_PDF_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/WebhooksDestinationsResource.java b/src/main/java/me/didit/resources/WebhooksDestinationsResource.java new file mode 100644 index 0000000..241a67b --- /dev/null +++ b/src/main/java/me/didit/resources/WebhooksDestinationsResource.java @@ -0,0 +1,612 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.WebhooksDestinationsCreateParams; +import me.didit.types.WebhooksDestinationsCreateResponse; +import me.didit.types.WebhooksDestinationsListResponse; +import me.didit.types.WebhooksDestinationsRetrieveResponse; +import me.didit.types.WebhooksDestinationsUpdateParams; +import me.didit.types.WebhooksDestinationsUpdateResponse; +import org.jspecify.annotations.Nullable; + +/** The {@code webhooks.destinations} resource: {@code client.webhooks().destinations()}. */ +public final class WebhooksDestinationsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + WebhooksDestinationsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List webhook destinations + * + *

List all webhook destinations (unpaginated array, oldest first). Each row includes URL, subscribed events, and delivery health metrics. The signing secret is NOT included in the list โ€” fetch a single destination (GET /v3/webhook/destinations/{destination_uuid}/) to read secret_shared_key. + * + *

{@code GET /v3/webhook/destinations/} + * + * @param options per-request options that override the client options + * @return the response body + */ + public List list(RequestOptions options) { + return client.execute(listRequest(), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RequestOptions)}. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(RequestOptions)}, with the client's options. + * + * @return the result + */ + public List list() { + return client.execute(listRequest(), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(RequestOptions)}, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create webhook destination + * + *

Create a webhook destination. The response includes the auto-generated secret_shared_key HMAC signing secret (also readable later via GET /v3/webhook/destinations/{destination_uuid}/). Always send subscribed_events with at least one event (no wildcards): an explicit empty list is rejected with 400, and omitting the field creates a destination subscribed to nothing, which never receives a webhook. The (application, url) pair must be unique among non-deleted destinations. + * + *

{@code POST /v3/webhook/destinations/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public WebhooksDestinationsCreateResponse create(WebhooksDestinationsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(WebhooksDestinationsCreateParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture createAsync(WebhooksDestinationsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(WebhooksDestinationsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public WebhooksDestinationsCreateResponse create(WebhooksDestinationsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(WebhooksDestinationsCreateParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture createAsync(WebhooksDestinationsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get webhook destination + * + *

Retrieve one webhook destination with its secret_shared_key signing secret and delivery health summary. API-key callers always receive the secret in full; Console users without read:webhooks see an empty string. + * + *

{@code GET /v3/webhook/destinations/{destination_uuid}/} + * + * @param destinationUuid UUID of the destination (the `uuid` returned from create / list). + * @param options per-request options that override the client options + * @return the response body + */ + public WebhooksDestinationsRetrieveResponse retrieve(String destinationUuid, RequestOptions options) { + return client.execute(retrieveRequest(destinationUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String destinationUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(destinationUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return the result + */ + public WebhooksDestinationsRetrieveResponse retrieve(String destinationUuid) { + return client.execute(retrieveRequest(destinationUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String destinationUuid) { + return client.executeAsync(retrieveRequest(destinationUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update webhook destination + * + *

Update a webhook destination. **subscribed_events is REPLACED wholesale, not merged** โ€” fetch first, append, resend. Secret is not rotated. + * + *

{@code PATCH /v3/webhook/destinations/{destination_uuid}/} + * + * @param destinationUuid UUID of the destination to update. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public WebhooksDestinationsUpdateResponse update(String destinationUuid, WebhooksDestinationsUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(destinationUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String destinationUuid, WebhooksDestinationsUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(destinationUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @return the result + */ + public WebhooksDestinationsUpdateResponse update(String destinationUuid, WebhooksDestinationsUpdateParams params) { + return client.execute(updateRequest(destinationUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String destinationUuid, WebhooksDestinationsUpdateParams params) { + return client.executeAsync(updateRequest(destinationUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}, without parameters. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return the result + */ + public WebhooksDestinationsUpdateResponse update(String destinationUuid, RequestOptions options) { + return client.execute(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}, without parameters. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String destinationUuid, RequestOptions options) { + return client.executeAsync(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return the result + */ + public WebhooksDestinationsUpdateResponse update(String destinationUuid) { + return client.execute(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)}, without parameters, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return a future completed with the result + */ + public CompletableFuture updateAsync(String destinationUuid) { + return client.executeAsync(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete webhook destination + * + *

Delete a webhook destination. Future events stop being pushed to its URL. Past delivery records are not affected and stay queryable from the Business Console, so deleting a destination is not a way to remove your delivery history. Calling again returns 404. + * + *

{@code DELETE /v3/webhook/destinations/{destination_uuid}/} + * + * @param destinationUuid UUID of the destination to delete. + * @param options per-request options that override the client options + */ + public void delete(String destinationUuid, RequestOptions options) { + client.execute(deleteRequest(destinationUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String destinationUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(destinationUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + */ + public void delete(String destinationUuid) { + client.execute(deleteRequest(destinationUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String destinationUuid) { + return client.executeAsync(deleteRequest(destinationUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.json(Conv.list(Conv.model(WebhooksDestinationsListResponse::fromJson))); + + private static ApiRequest listRequest() { + return ApiRequest.builder("GET", "/v3/webhook/destinations/") + .build(); + } + + private static final ResponseHandler CREATE_RESPONSE = Responses.json(Conv.model(WebhooksDestinationsCreateResponse::fromJson)); + + private static ApiRequest createRequest(WebhooksDestinationsCreateParams params) { + return ApiRequest.builder("POST", "/v3/webhook/destinations/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.json(Conv.model(WebhooksDestinationsRetrieveResponse::fromJson)); + + private static ApiRequest retrieveRequest(String destinationUuid) { + return ApiRequest.builder("GET", "/v3/webhook/destinations/{destination_uuid}/") + .pathParam("destination_uuid", destinationUuid) + .build(); + } + + private static final ResponseHandler UPDATE_RESPONSE = Responses.json(Conv.model(WebhooksDestinationsUpdateResponse::fromJson)); + + private static ApiRequest updateRequest(String destinationUuid, WebhooksDestinationsUpdateParams params) { + return ApiRequest.builder("PATCH", "/v3/webhook/destinations/{destination_uuid}/") + .pathParam("destination_uuid", destinationUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String destinationUuid) { + return ApiRequest.builder("DELETE", "/v3/webhook/destinations/{destination_uuid}/") + .pathParam("destination_uuid", destinationUuid) + .build(); + } + + /** The {@code webhooks.destinations} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RequestOptions)} with the raw response. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(), options, LIST_RESPONSE); + } + + /** + * {@link #list(RequestOptions)} with the raw response, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(RequestOptions)} with the raw response, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(WebhooksDestinationsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse create(WebhooksDestinationsCreateParams params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(WebhooksDestinationsCreateParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(WebhooksDestinationsCreateParams params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(WebhooksDestinationsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse create(WebhooksDestinationsCreateParams params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(WebhooksDestinationsCreateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(WebhooksDestinationsCreateParams params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String destinationUuid, RequestOptions options) { + return client.execute(retrieveRequest(destinationUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String destinationUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(destinationUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return the result + */ + public RawResponse retrieve(String destinationUuid) { + return client.execute(retrieveRequest(destinationUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String destinationUuid) { + return client.executeAsync(retrieveRequest(destinationUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse update(String destinationUuid, WebhooksDestinationsUpdateParams params, RequestOptions options) { + return client.execute(updateRequest(destinationUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String destinationUuid, WebhooksDestinationsUpdateParams params, RequestOptions options) { + return client.executeAsync(updateRequest(destinationUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse update(String destinationUuid, WebhooksDestinationsUpdateParams params) { + return client.execute(updateRequest(destinationUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String destinationUuid, WebhooksDestinationsUpdateParams params) { + return client.executeAsync(updateRequest(destinationUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse update(String destinationUuid, RequestOptions options) { + return client.execute(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response, without parameters. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String destinationUuid, RequestOptions options) { + return client.executeAsync(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return the result + */ + public RawResponse update(String destinationUuid) { + return client.execute(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, WebhooksDestinationsUpdateParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String destinationUuid) { + return client.executeAsync(updateRequest(destinationUuid, WebhooksDestinationsUpdateParams.builder().build()), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String destinationUuid, RequestOptions options) { + return client.execute(deleteRequest(destinationUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param destinationUuid the {@code destination_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String destinationUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(destinationUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String destinationUuid) { + return client.execute(deleteRequest(destinationUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param destinationUuid the {@code destination_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String destinationUuid) { + return client.executeAsync(deleteRequest(destinationUuid), RequestOptions.none(), DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/WebhooksResource.java b/src/main/java/me/didit/resources/WebhooksResource.java new file mode 100644 index 0000000..7bb35e7 --- /dev/null +++ b/src/main/java/me/didit/resources/WebhooksResource.java @@ -0,0 +1,24 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import me.didit.core.ApiClient; +import me.didit.webhooks.WebhookMethods; + +/** The {@code webhooks} resource: {@code client.webhooks()}. */ +public final class WebhooksResource extends WebhookMethods { + private final WebhooksDestinationsResource destinations; + + WebhooksResource(ApiClient client) { + this.destinations = new WebhooksDestinationsResource(client); + java.util.Objects.requireNonNull(client, "client"); + } + + /** + * The {@code webhooks.destinations} resource. + * + * @return the resource + */ + public WebhooksDestinationsResource destinations() { + return destinations; + } +} diff --git a/src/main/java/me/didit/resources/WorkflowsResource.java b/src/main/java/me/didit/resources/WorkflowsResource.java new file mode 100644 index 0000000..1d272ab --- /dev/null +++ b/src/main/java/me/didit/resources/WorkflowsResource.java @@ -0,0 +1,615 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import me.didit.core.ApiClient; +import me.didit.core.ApiRequest; +import me.didit.core.Conv; +import me.didit.core.Page; +import me.didit.core.RawResponse; +import me.didit.core.RequestOptions; +import me.didit.core.ResponseHandler; +import me.didit.core.Responses; +import me.didit.types.SimpleWorkflowRequest; +import me.didit.types.SimpleWorkflowUpdateRequest; +import me.didit.types.WorkflowListItem; +import me.didit.types.WorkflowsListParams; +import org.jspecify.annotations.Nullable; + +/** The {@code workflows} resource: {@code client.workflows()}. */ +public final class WorkflowsResource { + private final ApiClient client; + private final WithRawResponse withRawResponse; + + WorkflowsResource(ApiClient client) { + this.client = client; + this.withRawResponse = new WithRawResponse(client); + } + + /** + * The same operations, returning the HTTP status, headers and request id with the parsed body. + * + * @return the raw response view + */ + public WithRawResponse withRawResponse() { + return withRawResponse; + } + + /** + * List workflows + * + *

List your workflows, newest first, in a limit/offset pagination envelope ({count, next, previous, results}, default page size 50). Each row is one version; workflow_id is the stable group ID and new sessions use the latest published version. + * + *

{@code GET /v3/workflows/} + *

Returns one page; iterate it to fetch every following page automatically. + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Page list(WorkflowsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(WorkflowsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(WorkflowsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Page list(WorkflowsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> listAsync(WorkflowsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(WorkflowsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return the result + */ + public Page list(RequestOptions options) { + return client.execute(listRequest(WorkflowsListParams.builder().build()), options, LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)}, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(WorkflowsListParams.builder().build()), options, LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #list(WorkflowsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return the result + */ + public Page list() { + return client.execute(listRequest(WorkflowsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).data(); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)}, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture> listAsync() { + return client.executeAsync(listRequest(WorkflowsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Create workflow + * + *

Create a simple workflow. Send features in execution order (ordering rules apply); defaults to published v1. The body accepts ONLY the fields listed in SimpleWorkflowRequest โ€” any other key (including workflow_type) is rejected with a 400. Not idempotent โ€” each call creates a new workflow. Maximum 50 workflows per application. + * + *

{@code POST /v3/workflows/} + * + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Map create(SimpleWorkflowRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SimpleWorkflowRequest, RequestOptions)}. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SimpleWorkflowRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #create(SimpleWorkflowRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public Map create(SimpleWorkflowRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #create(SimpleWorkflowRequest, RequestOptions)}, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> createAsync(SimpleWorkflowRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Get workflow + * + *

Fetch full configuration for one workflow version by settings_uuid: feature toggles, thresholds, allowed documents, graph, retry policy, callbacks, and pricing. + * + *

{@code GET /v3/workflows/{settings_uuid}/} + * + * @param settingsUuid Per-version UUID of the workflow (the `uuid` value returned by the list endpoint). Each version of a workflow has its own `settings_uuid`. + * @param options per-request options that override the client options + * @return the response body + */ + public JsonNode retrieve(String settingsUuid, RequestOptions options) { + return client.execute(retrieveRequest(settingsUuid), options, RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}. + * + * @param settingsUuid the {@code settings_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String settingsUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(settingsUuid), options, RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return the result + */ + public JsonNode retrieve(String settingsUuid) { + return client.execute(retrieveRequest(settingsUuid), RequestOptions.none(), RETRIEVE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)}, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return a future completed with the result + */ + public CompletableFuture retrieveAsync(String settingsUuid) { + return client.executeAsync(retrieveRequest(settingsUuid), RequestOptions.none(), RETRIEVE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Update workflow + * + *

Update a workflow. Versioning depends on the status field you send and the current state of the version: (1) no status on a published version โ†’ the published version is updated in place (same uuid, same version); (2) no status on a draft โ†’ the draft is updated and immediately published; (3) status: "published" on a published version โ†’ a NEW published version is created under the same workflow_id (new uuid, version + 1) and returned, and any existing draft in the group is deleted; (4) status: "draft" keeps a draft as a draft (autosave) but is rejected with 400 on a published version ("Cannot revert a published version to draft."). The body accepts the same strict field whitelist as create โ€” unknown keys are rejected with 400. + * + *

{@code PATCH /v3/workflows/{settings_uuid}/} + * + * @param settingsUuid Per-version UUID of the workflow to update. + * @param params the request parameters + * @param options per-request options that override the client options + * @return the response body + */ + public Map update(String settingsUuid, SimpleWorkflowUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(settingsUuid, params), options, UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)}. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String settingsUuid, SimpleWorkflowUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(settingsUuid, params), options, UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Same as {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)}, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @return the result + */ + public Map update(String settingsUuid, SimpleWorkflowUpdateRequest params) { + return client.execute(updateRequest(settingsUuid, params), RequestOptions.none(), UPDATE_RESPONSE).data(); + } + + /** + * Asynchronous {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)}, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture> updateAsync(String settingsUuid, SimpleWorkflowUpdateRequest params) { + return client.executeAsync(updateRequest(settingsUuid, params), RequestOptions.none(), UPDATE_RESPONSE).thenApply(RawResponse::data); + } + + /** + * Delete workflow + * + *

Permanently delete one workflow version (no undo). Existing sessions keep their verification results but their workflow reference is cleared; other versions in the same workflow_id group are not deleted. + * + *

{@code DELETE /v3/workflows/{settings_uuid}/} + * + * @param settingsUuid Per-version UUID of the workflow to delete. + * @param options per-request options that override the client options + */ + public void delete(String settingsUuid, RequestOptions options) { + client.execute(deleteRequest(settingsUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}. + * + * @param settingsUuid the {@code settings_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String settingsUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(settingsUuid), options, DELETE_RESPONSE).thenAccept(response -> {}); + } + + /** + * Same as {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + */ + public void delete(String settingsUuid) { + client.execute(deleteRequest(settingsUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)}, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return a future completed with the result + */ + public CompletableFuture deleteAsync(String settingsUuid) { + return client.executeAsync(deleteRequest(settingsUuid), RequestOptions.none(), DELETE_RESPONSE).thenAccept(response -> {}); + } + + private static final ResponseHandler> LIST_RESPONSE = Responses.page(Conv.model(WorkflowListItem::fromJson)); + + private static ApiRequest listRequest(WorkflowsListParams params) { + return ApiRequest.builder("GET", "/v3/workflows/") + .params(params) + .queryFields("limit", "offset") + .build(); + } + + private static final ResponseHandler> CREATE_RESPONSE = Responses.json(Conv.OBJECT); + + private static ApiRequest createRequest(SimpleWorkflowRequest params) { + return ApiRequest.builder("POST", "/v3/workflows/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler RETRIEVE_RESPONSE = Responses.jsonNode(); + + private static ApiRequest retrieveRequest(String settingsUuid) { + return ApiRequest.builder("GET", "/v3/workflows/{settings_uuid}/") + .pathParam("settings_uuid", settingsUuid) + .build(); + } + + private static final ResponseHandler> UPDATE_RESPONSE = Responses.json(Conv.OBJECT); + + private static ApiRequest updateRequest(String settingsUuid, SimpleWorkflowUpdateRequest params) { + return ApiRequest.builder("PATCH", "/v3/workflows/{settings_uuid}/") + .pathParam("settings_uuid", settingsUuid) + .params(params) + .body(ApiRequest.BodyEncoding.JSON) + .build(); + } + + private static final ResponseHandler<@Nullable Void> DELETE_RESPONSE = Responses.none(); + + private static ApiRequest deleteRequest(String settingsUuid) { + return ApiRequest.builder("DELETE", "/v3/workflows/{settings_uuid}/") + .pathParam("settings_uuid", settingsUuid) + .build(); + } + + /** The {@code workflows} operations returning {@link RawResponse}. */ + public static final class WithRawResponse { + private final ApiClient client; + + WithRawResponse(ApiClient client) { + this.client = client; + } + + /** + * {@link #list(WorkflowsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> list(WorkflowsListParams params, RequestOptions options) { + return client.execute(listRequest(params), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(WorkflowsListParams params, RequestOptions options) { + return client.executeAsync(listRequest(params), options, LIST_RESPONSE); + } + + /** + * {@link #list(WorkflowsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> list(WorkflowsListParams params) { + return client.execute(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(WorkflowsListParams params) { + return client.executeAsync(listRequest(params), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #list(WorkflowsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return the result + */ + public RawResponse> list(RequestOptions options) { + return client.execute(listRequest(WorkflowsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)} with the raw response, without parameters. + * + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> listAsync(RequestOptions options) { + return client.executeAsync(listRequest(WorkflowsListParams.builder().build()), options, LIST_RESPONSE); + } + + /** + * {@link #list(WorkflowsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return the result + */ + public RawResponse> list() { + return client.execute(listRequest(WorkflowsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * Asynchronous {@link #list(WorkflowsListParams, RequestOptions)} with the raw response, without parameters, with the client's options. + * + * @return a future completed with the result + */ + public CompletableFuture>> listAsync() { + return client.executeAsync(listRequest(WorkflowsListParams.builder().build()), RequestOptions.none(), LIST_RESPONSE); + } + + /** + * {@link #create(SimpleWorkflowRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> create(SimpleWorkflowRequest params, RequestOptions options) { + return client.execute(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SimpleWorkflowRequest, RequestOptions)} with the raw response. + * + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> createAsync(SimpleWorkflowRequest params, RequestOptions options) { + return client.executeAsync(createRequest(params), options, CREATE_RESPONSE); + } + + /** + * {@link #create(SimpleWorkflowRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return the result + */ + public RawResponse> create(SimpleWorkflowRequest params) { + return client.execute(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * Asynchronous {@link #create(SimpleWorkflowRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> createAsync(SimpleWorkflowRequest params) { + return client.executeAsync(createRequest(params), RequestOptions.none(), CREATE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param settingsUuid the {@code settings_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse retrieve(String settingsUuid, RequestOptions options) { + return client.execute(retrieveRequest(settingsUuid), options, RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response. + * + * @param settingsUuid the {@code settings_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String settingsUuid, RequestOptions options) { + return client.executeAsync(retrieveRequest(settingsUuid), options, RETRIEVE_RESPONSE); + } + + /** + * {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return the result + */ + public RawResponse retrieve(String settingsUuid) { + return client.execute(retrieveRequest(settingsUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * Asynchronous {@link #retrieve(String, RequestOptions)} with the raw response, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return a future completed with the result + */ + public CompletableFuture> retrieveAsync(String settingsUuid) { + return client.executeAsync(retrieveRequest(settingsUuid), RequestOptions.none(), RETRIEVE_RESPONSE); + } + + /** + * {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)} with the raw response. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @param options per-request options + * @return the result + */ + public RawResponse> update(String settingsUuid, SimpleWorkflowUpdateRequest params, RequestOptions options) { + return client.execute(updateRequest(settingsUuid, params), options, UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)} with the raw response. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture>> updateAsync(String settingsUuid, SimpleWorkflowUpdateRequest params, RequestOptions options) { + return client.executeAsync(updateRequest(settingsUuid, params), options, UPDATE_RESPONSE); + } + + /** + * {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @return the result + */ + public RawResponse> update(String settingsUuid, SimpleWorkflowUpdateRequest params) { + return client.execute(updateRequest(settingsUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * Asynchronous {@link #update(String, SimpleWorkflowUpdateRequest, RequestOptions)} with the raw response, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @param params the request parameters + * @return a future completed with the result + */ + public CompletableFuture>> updateAsync(String settingsUuid, SimpleWorkflowUpdateRequest params) { + return client.executeAsync(updateRequest(settingsUuid, params), RequestOptions.none(), UPDATE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response. + * + * @param settingsUuid the {@code settings_uuid} + * @param options per-request options + * @return the result + */ + public RawResponse<@Nullable Void> delete(String settingsUuid, RequestOptions options) { + return client.execute(deleteRequest(settingsUuid), options, DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response. + * + * @param settingsUuid the {@code settings_uuid} + * @param options per-request options + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String settingsUuid, RequestOptions options) { + return client.executeAsync(deleteRequest(settingsUuid), options, DELETE_RESPONSE); + } + + /** + * {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return the result + */ + public RawResponse<@Nullable Void> delete(String settingsUuid) { + return client.execute(deleteRequest(settingsUuid), RequestOptions.none(), DELETE_RESPONSE); + } + + /** + * Asynchronous {@link #delete(String, RequestOptions)} with the raw response, with the client's options. + * + * @param settingsUuid the {@code settings_uuid} + * @return a future completed with the result + */ + public CompletableFuture> deleteAsync(String settingsUuid) { + return client.executeAsync(deleteRequest(settingsUuid), RequestOptions.none(), DELETE_RESPONSE); + } + } +} diff --git a/src/main/java/me/didit/resources/package-info.java b/src/main/java/me/didit/resources/package-info.java new file mode 100644 index 0000000..ee89566 --- /dev/null +++ b/src/main/java/me/didit/resources/package-info.java @@ -0,0 +1,6 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +/** The resources of the Didit API, one class per resource, generated from the OpenAPI documents. */ +@NullMarked +package me.didit.resources; + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/me/didit/types/AccountResendOtpParams.java b/src/main/java/me/didit/types/AccountResendOtpParams.java new file mode 100644 index 0000000..091a1b0 --- /dev/null +++ b/src/main/java/me/didit/types/AccountResendOtpParams.java @@ -0,0 +1,121 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code account.resend_otp}. */ +public final class AccountResendOtpParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "password"); + + private AccountResendOtpParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AccountResendOtpParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AccountResendOtpParams fromJson(JsonNode json) { + return new AccountResendOtpParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Email of the pending (unverified) account. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * Password chosen at registration. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String password() { + return Json.required(json, "password", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AccountResendOtpParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AccountResendOtpParams from) { + super(from); + } + + /** + * Email of the pending (unverified) account. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Password chosen at registration. + * + * @param password the value + * @return this builder + */ + public Builder password(String password) { + return set("password", Conv.STRING, password); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AccountResendOtpParams} + * @throws IllegalStateException when a required field is missing + */ + public AccountResendOtpParams build() { + require("email", false); + require("password", false); + return new AccountResendOtpParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/AgeEstimationEstimateParams.java b/src/main/java/me/didit/types/AgeEstimationEstimateParams.java new file mode 100644 index 0000000..39f3142 --- /dev/null +++ b/src/main/java/me/didit/types/AgeEstimationEstimateParams.java @@ -0,0 +1,231 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code age_estimation.estimate}. */ +public final class AgeEstimationEstimateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_image", "face_liveness_score_decline_threshold", "age_estimation_decline_threshold", "rotate_image", "save_api_request", "vendor_data", "metadata"); + + private AgeEstimationEstimateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AgeEstimationEstimateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AgeEstimationEstimateParams fromJson(JsonNode json) { + return new AgeEstimationEstimateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Face photo to analyze (e.g. a selfie). Submit a single front-facing photo with the subject's face clearly visible and well lit. Allowed extensions: tiff, jpg, jpeg, png, webp (no PDF). Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.3 MB before processing, so very high resolutions do not improve accuracy. + * + * @return the file to upload, if set + */ + public Optional userImage() { + return file("user_image"); + } + + /** + * Liveness threshold (0โ€“100). A liveness score at or below this value adds a LOW_LIVENESS_SCORE warning and declines. Raise it for stricter anti-spoofing; values outside 0โ€“100 return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceLivenessScoreDeclineThreshold() { + return Json.optional(json, "face_liveness_score_decline_threshold", Conv.DOUBLE); + } + + /** + * Minimum acceptable estimated age in years. An estimated age below this value adds an AGE_BELOW_MINIMUM warning and declines. Set 0 to disable the age check (the call then only runs liveness + age estimation without an age-based decision). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ageEstimationDeclineThreshold() { + return Json.optional(json, "age_estimation_decline_threshold", Conv.LONG); + } + + /** + * When true, the service tries the input image in 90-degree increments (0, 90, 180, 270) and uses the orientation that yields the best face detection โ€” useful for mobile captures with missing EXIF orientation. Adds latency, so only enable it if you cannot guarantee upright images. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rotateImage() { + return Json.optional(json, "rotate_image", Conv.BOOLEAN); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, announced through a status.updated webhook, and with the detected face added to your application's face index. When false, nothing is stored and request_id is a transient UUID for response correlation only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"age-gate"}) โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AgeEstimationEstimateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AgeEstimationEstimateParams from) { + super(from); + } + + /** + * Face photo to analyze (e.g. a selfie). Submit a single front-facing photo with the subject's face clearly visible and well lit. Allowed extensions: tiff, jpg, jpeg, png, webp (no PDF). Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.3 MB before processing, so very high resolutions do not improve accuracy. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(FileUpload userImage) { + return setFile("user_image", userImage); + } + + /** + * Uploads the file at {@code path} as {@code user_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder userImage(Path path) { + return setFile("user_image", FileUpload.of(path)); + } + + /** + * Liveness threshold (0โ€“100). A liveness score at or below this value adds a LOW_LIVENESS_SCORE warning and declines. Raise it for stricter anti-spoofing; values outside 0โ€“100 return 400. + * + * @param faceLivenessScoreDeclineThreshold the value + * @return this builder + */ + public Builder faceLivenessScoreDeclineThreshold(double faceLivenessScoreDeclineThreshold) { + return set("face_liveness_score_decline_threshold", Conv.DOUBLE, faceLivenessScoreDeclineThreshold); + } + + /** + * Minimum acceptable estimated age in years. An estimated age below this value adds an AGE_BELOW_MINIMUM warning and declines. Set 0 to disable the age check (the call then only runs liveness + age estimation without an age-based decision). + * + * @param ageEstimationDeclineThreshold the value + * @return this builder + */ + public Builder ageEstimationDeclineThreshold(long ageEstimationDeclineThreshold) { + return set("age_estimation_decline_threshold", Conv.LONG, ageEstimationDeclineThreshold); + } + + /** + * When true, the service tries the input image in 90-degree increments (0, 90, 180, 270) and uses the orientation that yields the best face detection โ€” useful for mobile captures with missing EXIF orientation. Adds latency, so only enable it if you cannot guarantee upright images. + * + * @param rotateImage the value + * @return this builder + */ + public Builder rotateImage(boolean rotateImage) { + return set("rotate_image", Conv.BOOLEAN, rotateImage); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, announced through a status.updated webhook, and with the detected face added to your application's face index. When false, nothing is stored and request_id is a transient UUID for response correlation only. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"age-gate"}) โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AgeEstimationEstimateParams} + * @throws IllegalStateException when a required field is missing + */ + public AgeEstimationEstimateParams build() { + requireFile("user_image"); + return new AgeEstimationEstimateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/AgeEstimationEstimateResponse.java b/src/main/java/me/didit/types/AgeEstimationEstimateResponse.java new file mode 100644 index 0000000..f480794 --- /dev/null +++ b/src/main/java/me/didit/types/AgeEstimationEstimateResponse.java @@ -0,0 +1,1017 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class AgeEstimationEstimateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "age_estimation", "vendor_data", "metadata", "created_at"); + + private AgeEstimationEstimateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AgeEstimationEstimateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AgeEstimationEstimateResponse fromJson(JsonNode json) { + return new AgeEstimationEstimateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The age_estimation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ageEstimation() { + return Json.optional(json, "age_estimation", Conv.model(AgeEstimationEstimateResponse.AgeEstimation::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AgeEstimationEstimateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AgeEstimationEstimateResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The age_estimation field. + * + * @param ageEstimation the value + * @return this builder + */ + public Builder ageEstimation(AgeEstimationEstimateResponse.AgeEstimation ageEstimation) { + return set("age_estimation", Conv.model(AgeEstimationEstimateResponse.AgeEstimation::fromJson), ageEstimation); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AgeEstimationEstimateResponse} + */ + public AgeEstimationEstimateResponse build() { + return new AgeEstimationEstimateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class AgeEstimation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "method", "score", "user_image", "age_estimation", "warnings"); + + private AgeEstimation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AgeEstimation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AgeEstimation fromJson(JsonNode json) { + return new AgeEstimation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Approved when no warnings were raised; Declined otherwise (every warning this endpoint produces declines). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Status::of)); + } + + /** + * Liveness method. Always PASSIVE on this endpoint (single-image, no user challenge). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional method() { + return Json.optional(json, "method", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Method::of)); + } + + /** + * Passive-liveness score from 0 to 100 โ€” the model's confidence that the photo shows a live person. Compared against face_liveness_score_decline_threshold; at or below it the call declines with LOW_LIVENESS_SCORE. null when the liveness model returns no confidence โ€” the call still declines with LOW_LIVENESS_SCORE because null is treated as 0 for the threshold comparison. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Face-detection results for the analyzed image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userImage() { + return Json.optional(json, "user_image", Conv.model(AgeEstimationEstimateResponse.AgeEstimation.UserImage::fromJson)); + } + + /** + * Model-predicted age in years of the largest detected face. null when no face age could be estimated (an AGE_NOT_DETECTED warning is added and the call declines). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ageEstimation() { + return Json.optional(json, "age_estimation", Conv.DOUBLE); + } + + /** + * Empty on a clean approval. Any entry sets status to Declined. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(AgeEstimationEstimateResponse.AgeEstimation.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AgeEstimation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AgeEstimation from) { + super(from); + } + + /** + * Approved when no warnings were raised; Declined otherwise (every warning this endpoint produces declines). + * + * @param status the value + * @return this builder + */ + public Builder status(AgeEstimationEstimateResponse.AgeEstimation.Status status) { + return set("status", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Status::of), status); + } + + /** + * Liveness method. Always PASSIVE on this endpoint (single-image, no user challenge). + * + * @param method the value + * @return this builder + */ + public Builder method(AgeEstimationEstimateResponse.AgeEstimation.Method method) { + return set("method", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Method::of), method); + } + + /** + * Passive-liveness score from 0 to 100 โ€” the model's confidence that the photo shows a live person. Compared against face_liveness_score_decline_threshold; at or below it the call declines with LOW_LIVENESS_SCORE. null when the liveness model returns no confidence โ€” the call still declines with LOW_LIVENESS_SCORE because null is treated as 0 for the threshold comparison. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Face-detection results for the analyzed image. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(AgeEstimationEstimateResponse.AgeEstimation.UserImage userImage) { + return set("user_image", Conv.model(AgeEstimationEstimateResponse.AgeEstimation.UserImage::fromJson), userImage); + } + + /** + * Model-predicted age in years of the largest detected face. null when no face age could be estimated (an AGE_NOT_DETECTED warning is added and the call declines). + * + * @param ageEstimation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ageEstimation(@Nullable Double ageEstimation) { + return setNullable("age_estimation", Conv.DOUBLE, ageEstimation); + } + + /** + * Empty on a clean approval. Any entry sets status to Declined. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(AgeEstimationEstimateResponse.AgeEstimation.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AgeEstimation} + */ + public AgeEstimation build() { + return new AgeEstimation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved when no warnings were raised; Declined otherwise (every warning this endpoint produces declines). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Liveness method. Always PASSIVE on this endpoint (single-image, no user challenge). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Method extends StringEnum { + /** The value {@code "PASSIVE"}. */ + public static final Method PASSIVE = new Method("PASSIVE"); + + private static final List KNOWN_VALUES = List.of(PASSIVE); + + private Method(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Method of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Method::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Face-detection results for the analyzed image. */ + public static final class UserImage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entities", "best_angle"); + + private UserImage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserImage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserImage fromJson(JsonNode json) { + return new UserImage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * One entry per detected face. Empty when no face was found (then age_estimation is null and an AGE_NOT_DETECTED warning is added). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> entities() { + return Json.optional(json, "entities", Conv.list(Conv.model(AgeEstimationEstimateResponse.AgeEstimation.UserImage.Entities::fromJson))); + } + + /** + * Rotation (degrees: 0, 90, 180, or 270) that produced the best face detection. Only non-zero when rotate_image=true corrected the orientation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bestAngle() { + return Json.optional(json, "best_angle", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserImage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserImage from) { + super(from); + } + + /** + * One entry per detected face. Empty when no face was found (then age_estimation is null and an AGE_NOT_DETECTED warning is added). + * + * @param entities the value + * @return this builder + */ + public Builder entities(List entities) { + return set("entities", Conv.list(Conv.model(AgeEstimationEstimateResponse.AgeEstimation.UserImage.Entities::fromJson)), entities); + } + + /** + * Rotation (degrees: 0, 90, 180, or 270) that produced the best face detection. Only non-zero when rotate_image=true corrected the orientation. + * + * @param bestAngle the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bestAngle(@Nullable Long bestAngle) { + return setNullable("best_angle", Conv.LONG, bestAngle); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserImage} + */ + public UserImage build() { + return new UserImage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Entities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("age", "bbox", "confidence", "gender"); + + private Entities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Entities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Entities fromJson(JsonNode json) { + return new Entities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Model-estimated age of this face, in years. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional age() { + return Json.optional(json, "age", Conv.DOUBLE); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> bbox() { + return Json.optional(json, "bbox", Conv.list(Conv.LONG)); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Entities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Entities from) { + super(from); + } + + /** + * Model-estimated age of this face, in years. + * + * @param age the value + * @return this builder + */ + public Builder age(double age) { + return set("age", Conv.DOUBLE, age); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @param bbox the value + * @return this builder + */ + public Builder bbox(List bbox) { + return set("bbox", Conv.list(Conv.LONG), bbox); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Entities} + */ + public Entities build() { + return new Entities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. NO_FACE_DETECTED โ€” the liveness model found no face; LOW_LIVENESS_SCORE โ€” liveness score at or below face_liveness_score_decline_threshold; LIVENESS_FACE_ATTACK โ€” a presentation attack (photo/screen/mask) was detected; AGE_NOT_DETECTED โ€” no face age could be estimated; AGE_BELOW_MINIMUM โ€” estimated age below age_estimation_decline_threshold. NO_FACE_DETECTED and LOW_LIVENESS_SCORE are mutually exclusive โ€” when no face is found only NO_FACE_DETECTED is emitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Warnings.Risk::of)); + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Warnings.Feature::of)); + } + + /** + * Always null for age-estimation warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. Every warning this endpoint produces is an error and sets status to Declined. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. NO_FACE_DETECTED โ€” the liveness model found no face; LOW_LIVENESS_SCORE โ€” liveness score at or below face_liveness_score_decline_threshold; LIVENESS_FACE_ATTACK โ€” a presentation attack (photo/screen/mask) was detected; AGE_NOT_DETECTED โ€” no face age could be estimated; AGE_BELOW_MINIMUM โ€” estimated age below age_estimation_decline_threshold. NO_FACE_DETECTED and LOW_LIVENESS_SCORE are mutually exclusive โ€” when no face is found only NO_FACE_DETECTED is emitted. + * + * @param risk the value + * @return this builder + */ + public Builder risk(AgeEstimationEstimateResponse.AgeEstimation.Warnings.Risk risk) { + return set("risk", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Warnings.Risk::of), risk); + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(AgeEstimationEstimateResponse.AgeEstimation.Warnings.Feature feature) { + return set("feature", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Warnings.Feature::of), feature); + } + + /** + * Always null for age-estimation warnings. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. Every warning this endpoint produces is an error and sets status to Declined. + * + * @param logType the value + * @return this builder + */ + public Builder logType(AgeEstimationEstimateResponse.AgeEstimation.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(AgeEstimationEstimateResponse.AgeEstimation.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Machine-readable risk code. NO_FACE_DETECTED โ€” the liveness model found no face; LOW_LIVENESS_SCORE โ€” liveness score at or below face_liveness_score_decline_threshold; LIVENESS_FACE_ATTACK โ€” a presentation attack (photo/screen/mask) was detected; AGE_NOT_DETECTED โ€” no face age could be estimated; AGE_BELOW_MINIMUM โ€” estimated age below age_estimation_decline_threshold. NO_FACE_DETECTED and LOW_LIVENESS_SCORE are mutually exclusive โ€” when no face is found only NO_FACE_DETECTED is emitted. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Risk extends StringEnum { + /** The value {@code "NO_FACE_DETECTED"}. */ + public static final Risk NO_FACE_DETECTED = new Risk("NO_FACE_DETECTED"); + + /** The value {@code "LOW_LIVENESS_SCORE"}. */ + public static final Risk LOW_LIVENESS_SCORE = new Risk("LOW_LIVENESS_SCORE"); + + /** The value {@code "LIVENESS_FACE_ATTACK"}. */ + public static final Risk LIVENESS_FACE_ATTACK = new Risk("LIVENESS_FACE_ATTACK"); + + /** The value {@code "AGE_NOT_DETECTED"}. */ + public static final Risk AGE_NOT_DETECTED = new Risk("AGE_NOT_DETECTED"); + + /** The value {@code "AGE_BELOW_MINIMUM"}. */ + public static final Risk AGE_BELOW_MINIMUM = new Risk("AGE_BELOW_MINIMUM"); + + private static final List KNOWN_VALUES = List.of(NO_FACE_DETECTED, LOW_LIVENESS_SCORE, LIVENESS_FACE_ATTACK, AGE_NOT_DETECTED, AGE_BELOW_MINIMUM); + + private Risk(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Risk of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Risk::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + private static final List KNOWN_VALUES = List.of(LIVENESS); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity. Every warning this endpoint produces is an error and sets status to Declined. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + private static final List KNOWN_VALUES = List.of(ERROR); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/AmlMonitoringRetrieveJobResponse.java b/src/main/java/me/didit/types/AmlMonitoringRetrieveJobResponse.java new file mode 100644 index 0000000..3c2fefb --- /dev/null +++ b/src/main/java/me/didit/types/AmlMonitoringRetrieveJobResponse.java @@ -0,0 +1,828 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class AmlMonitoringRetrieveJobResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at"); + + private AmlMonitoringRetrieveJobResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AmlMonitoringRetrieveJobResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AmlMonitoringRetrieveJobResponse fromJson(JsonNode json) { + return new AmlMonitoringRetrieveJobResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(AmlMonitoringRetrieveJobResponse.Status::of)); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * Which profile family the job toggles. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional targetType() { + return Json.optional(json, "target_type", Conv.enumeration(AmlMonitoringRetrieveJobResponse.TargetType::of)); + } + + /** + * Profiles the job processes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * Profiles processed so far. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(AmlMonitoringRetrieveJobResponse.Outcomes::fromJson)); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API; a job started from the Business Console reports counters only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(AmlMonitoringRetrieveJobResponse.Results::fromJson))); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AmlMonitoringRetrieveJobResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AmlMonitoringRetrieveJobResponse from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(AmlMonitoringRetrieveJobResponse.Status status) { + return set("status", Conv.enumeration(AmlMonitoringRetrieveJobResponse.Status::of), status); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * Which profile family the job toggles. + * + * @param targetType the value + * @return this builder + */ + public Builder targetType(AmlMonitoringRetrieveJobResponse.TargetType targetType) { + return set("target_type", Conv.enumeration(AmlMonitoringRetrieveJobResponse.TargetType::of), targetType); + } + + /** + * Profiles the job processes. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Profiles processed so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(AmlMonitoringRetrieveJobResponse.Outcomes outcomes) { + return set("outcomes", Conv.model(AmlMonitoringRetrieveJobResponse.Outcomes::fromJson), outcomes); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API; a job started from the Business Console reports counters only. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(AmlMonitoringRetrieveJobResponse.Results::fromJson)), results); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AmlMonitoringRetrieveJobResponse} + */ + public AmlMonitoringRetrieveJobResponse build() { + return new AmlMonitoringRetrieveJobResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Which profile family the job toggles. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TargetType extends StringEnum { + /** The value {@code "user"}. */ + public static final TargetType USER = new TargetType("user"); + + /** The value {@code "business"}. */ + public static final TargetType BUSINESS = new TargetType("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private TargetType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TargetType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TargetType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening could not be completed; retry later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out while the job was running. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening could not be completed; retry later. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out while the job was running. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "outcome"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit internal id of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your own identifier for the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(AmlMonitoringRetrieveJobResponse.Results.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Didit internal id of the profile. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your own identifier for the profile. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(AmlMonitoringRetrieveJobResponse.Results.Outcome outcome) { + return set("outcome", Conv.enumeration(AmlMonitoringRetrieveJobResponse.Results.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "enabled"}. */ + public static final Outcome ENABLED = new Outcome("enabled"); + + /** The value {@code "screened_and_enabled"}. */ + public static final Outcome SCREENED_AND_ENABLED = new Outcome("screened_and_enabled"); + + /** The value {@code "already_enabled"}. */ + public static final Outcome ALREADY_ENABLED = new Outcome("already_enabled"); + + /** The value {@code "disabled"}. */ + public static final Outcome DISABLED = new Outcome("disabled"); + + /** The value {@code "skipped_no_identity_data"}. */ + public static final Outcome SKIPPED_NO_IDENTITY_DATA = new Outcome("skipped_no_identity_data"); + + /** The value {@code "skipped_blocked"}. */ + public static final Outcome SKIPPED_BLOCKED = new Outcome("skipped_blocked"); + + /** The value {@code "skipped_sandbox"}. */ + public static final Outcome SKIPPED_SANDBOX = new Outcome("skipped_sandbox"); + + /** The value {@code "failed_provider"}. */ + public static final Outcome FAILED_PROVIDER = new Outcome("failed_provider"); + + /** The value {@code "failed_insufficient_balance"}. */ + public static final Outcome FAILED_INSUFFICIENT_BALANCE = new Outcome("failed_insufficient_balance"); + + private static final List KNOWN_VALUES = List.of(ENABLED, SCREENED_AND_ENABLED, ALREADY_ENABLED, DISABLED, SKIPPED_NO_IDENTITY_DATA, SKIPPED_BLOCKED, SKIPPED_SANDBOX, FAILED_PROVIDER, FAILED_INSUFFICIENT_BALANCE); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/AmlScreenParams.java b/src/main/java/me/didit/types/AmlScreenParams.java new file mode 100644 index 0000000..c26e7f5 --- /dev/null +++ b/src/main/java/me/didit/types/AmlScreenParams.java @@ -0,0 +1,467 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code aml.screen}. */ +public final class AmlScreenParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "entity_type", "date_of_birth", "nationality", "document_number", "aml_score_approve_threshold", "aml_score_review_threshold", "aml_name_weight", "aml_dob_weight", "aml_country_weight", "aml_match_score_threshold", "include_adverse_media", "include_ongoing_monitoring", "save_api_request", "vendor_data", "metadata", "sandbox_scenario"); + + private AmlScreenParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AmlScreenParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AmlScreenParams fromJson(JsonNode json) { + return new AmlScreenParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Full name of the person or company to screen. Minimum 2 characters - the screening provider's own floor. A shorter or blank name returns 400 on this field before any screening runs, so nothing is billed. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String fullName() { + return Json.required(json, "full_name", Conv.STRING); + } + + /** + * Type of entity to screen. Defaults to person. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(AmlScreenParams.EntityType::of)); + } + + /** + * Date of birth (persons) or incorporation date (companies), YYYY-MM-DD. Improves match precision via the DOB weight. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * ISO 3166-1 alpha-2 country code (e.g. ES). Invalid codes return 400. Improves match precision via the country weight. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Identity document number. Not weighted โ€” acts as a golden key: an exact match overrides the hit's match_score to 100, a hard mismatch penalizes it. Sent to the screening provider as a search filter only when it is 2-50 characters; a value outside that range is accepted and stored, and the screening still runs and is billed, just not narrowed by document number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * Risk-score threshold at or below which the result is Approved. Must be โ‰ค aml_score_review_threshold (else 400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlScoreApproveThreshold() { + return Json.optional(json, "aml_score_approve_threshold", Conv.DOUBLE); + } + + /** + * Risk-score threshold above which the result is Declined. Scores between the two thresholds produce In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlScoreReviewThreshold() { + return Json.optional(json, "aml_score_review_threshold", Conv.DOUBLE); + } + + /** + * Weight of name similarity in the per-hit match score. The three weights must sum to exactly 100 (else 400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlNameWeight() { + return Json.optional(json, "aml_name_weight", Conv.LONG); + } + + /** + * Weight of date of birth in the per-hit match score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlDobWeight() { + return Json.optional(json, "aml_dob_weight", Conv.LONG); + } + + /** + * Weight of country/nationality in the per-hit match score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlCountryWeight() { + return Json.optional(json, "aml_country_weight", Conv.LONG); + } + + /** + * Per-hit cutoff: hits with match_score below this are False Positive (excluded from risk assessment); at or above are Unreviewed possible matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlMatchScoreThreshold() { + return Json.optional(json, "aml_match_score_threshold", Conv.LONG); + } + + /** + * Also search news media for negative coverage. Adds up to ~30 s of latency while results are gathered โ€” use a โ‰ฅ60 s client timeout. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional includeAdverseMedia() { + return Json.optional(json, "include_adverse_media", Conv.BOOLEAN); + } + + /** + * Keep re-screening this profile and push changes via webhook. Requires save_api_request=true (else 400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional includeOngoingMonitoring() { + return Json.optional(json, "include_ongoing_monitoring", Conv.BOOLEAN); + } + + /** + * Persist the screening as a session (console visibility, decision endpoint, webhooks, hit review). Set to false for a stateless check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Your identifier for the screened user; echoed back and stored with the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Free-form JSON stored with the request and echoed back. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox-only scenario slug. Only accepted when the API key belongs to a sandbox-mode application; rejected on live applications. A standalone screening has no session to arm, so the slug goes on the screening request itself: decline_aml_hit returns one production-shaped hit and settles the screening as Declined, review_aml_possible_match settles it In Review, and a scenario that arms no AML outcome leaves the screening clean. See the scenario catalog at GET /v1/sandbox/scenarios/ or [Sandbox & Test Data](/integration/sandbox-testing). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AmlScreenParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AmlScreenParams from) { + super(from); + } + + /** + * Full name of the person or company to screen. Minimum 2 characters - the screening provider's own floor. A shorter or blank name returns 400 on this field before any screening runs, so nothing is billed. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * Type of entity to screen. Defaults to person. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(AmlScreenParams.EntityType entityType) { + return set("entity_type", Conv.enumeration(AmlScreenParams.EntityType::of), entityType); + } + + /** + * Date of birth (persons) or incorporation date (companies), YYYY-MM-DD. Improves match precision via the DOB weight. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * ISO 3166-1 alpha-2 country code (e.g. ES). Invalid codes return 400. Improves match precision via the country weight. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * Identity document number. Not weighted โ€” acts as a golden key: an exact match overrides the hit's match_score to 100, a hard mismatch penalizes it. Sent to the screening provider as a search filter only when it is 2-50 characters; a value outside that range is accepted and stored, and the screening still runs and is billed, just not narrowed by document number. + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * Risk-score threshold at or below which the result is Approved. Must be โ‰ค aml_score_review_threshold (else 400). + * + * @param amlScoreApproveThreshold the value + * @return this builder + */ + public Builder amlScoreApproveThreshold(double amlScoreApproveThreshold) { + return set("aml_score_approve_threshold", Conv.DOUBLE, amlScoreApproveThreshold); + } + + /** + * Risk-score threshold above which the result is Declined. Scores between the two thresholds produce In Review. + * + * @param amlScoreReviewThreshold the value + * @return this builder + */ + public Builder amlScoreReviewThreshold(double amlScoreReviewThreshold) { + return set("aml_score_review_threshold", Conv.DOUBLE, amlScoreReviewThreshold); + } + + /** + * Weight of name similarity in the per-hit match score. The three weights must sum to exactly 100 (else 400). + * + * @param amlNameWeight the value + * @return this builder + */ + public Builder amlNameWeight(long amlNameWeight) { + return set("aml_name_weight", Conv.LONG, amlNameWeight); + } + + /** + * Weight of date of birth in the per-hit match score. + * + * @param amlDobWeight the value + * @return this builder + */ + public Builder amlDobWeight(long amlDobWeight) { + return set("aml_dob_weight", Conv.LONG, amlDobWeight); + } + + /** + * Weight of country/nationality in the per-hit match score. + * + * @param amlCountryWeight the value + * @return this builder + */ + public Builder amlCountryWeight(long amlCountryWeight) { + return set("aml_country_weight", Conv.LONG, amlCountryWeight); + } + + /** + * Per-hit cutoff: hits with match_score below this are False Positive (excluded from risk assessment); at or above are Unreviewed possible matches. + * + * @param amlMatchScoreThreshold the value + * @return this builder + */ + public Builder amlMatchScoreThreshold(long amlMatchScoreThreshold) { + return set("aml_match_score_threshold", Conv.LONG, amlMatchScoreThreshold); + } + + /** + * Also search news media for negative coverage. Adds up to ~30 s of latency while results are gathered โ€” use a โ‰ฅ60 s client timeout. + * + * @param includeAdverseMedia the value + * @return this builder + */ + public Builder includeAdverseMedia(boolean includeAdverseMedia) { + return set("include_adverse_media", Conv.BOOLEAN, includeAdverseMedia); + } + + /** + * Keep re-screening this profile and push changes via webhook. Requires save_api_request=true (else 400). + * + * @param includeOngoingMonitoring the value + * @return this builder + */ + public Builder includeOngoingMonitoring(boolean includeOngoingMonitoring) { + return set("include_ongoing_monitoring", Conv.BOOLEAN, includeOngoingMonitoring); + } + + /** + * Persist the screening as a session (console visibility, decision endpoint, webhooks, hit review). Set to false for a stateless check. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Your identifier for the screened user; echoed back and stored with the session. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Free-form JSON stored with the request and echoed back. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox-only scenario slug. Only accepted when the API key belongs to a sandbox-mode application; rejected on live applications. A standalone screening has no session to arm, so the slug goes on the screening request itself: decline_aml_hit returns one production-shaped hit and settles the screening as Declined, review_aml_possible_match settles it In Review, and a scenario that arms no AML outcome leaves the screening clean. See the scenario catalog at GET /v1/sandbox/scenarios/ or [Sandbox & Test Data](/integration/sandbox-testing). + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AmlScreenParams} + * @throws IllegalStateException when a required field is missing + */ + public AmlScreenParams build() { + require("full_name", false); + return new AmlScreenParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Type of entity to screen. Defaults to person. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/AmlScreenResponse.java b/src/main/java/me/didit/types/AmlScreenResponse.java new file mode 100644 index 0000000..2b3ca6d --- /dev/null +++ b/src/main/java/me/didit/types/AmlScreenResponse.java @@ -0,0 +1,2554 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class AmlScreenResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "aml", "vendor_data", "metadata", "created_at"); + + private AmlScreenResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AmlScreenResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AmlScreenResponse fromJson(JsonNode json) { + return new AmlScreenResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The aml field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional aml() { + return Json.optional(json, "aml", Conv.model(AmlScreenResponse.Aml::fromJson)); + } + + /** + * Echo of the vendor_data you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AmlScreenResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AmlScreenResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The aml field. + * + * @param aml the value + * @return this builder + */ + public Builder aml(AmlScreenResponse.Aml aml) { + return set("aml", Conv.model(AmlScreenResponse.Aml::fromJson), aml); + } + + /** + * Echo of the vendor_data you sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AmlScreenResponse} + */ + public AmlScreenResponse build() { + return new AmlScreenResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Aml extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "total_hits", "entity_type", "hits", "score", "screened_data", "warnings"); + + private Aml(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Aml} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Aml fromJson(JsonNode json) { + return new Aml(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Declined when score > aml_score_review_threshold; In Review when score > aml_score_approve_threshold; Approved otherwise (including when no score is available). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(AmlScreenResponse.Aml.Status::of)); + } + + /** + * Number of entries in hits. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalHits() { + return Json.optional(json, "total_hits", Conv.LONG); + } + + /** + * Echo of the screened entity type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(AmlScreenResponse.Aml.EntityType::of)); + } + + /** + * The hits field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> hits() { + return Json.optional(json, "hits", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits::fromJson))); + } + + /** + * Overall AML risk score (0โ€“100): the highest risk_score among hits that are not False Positives. Drives status via the two thresholds. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Echo of what was screened: full_name, date_of_birth, nationality, document_number (absent fields are null). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedData() { + return Json.optional(json, "screened_data", Conv.model(AmlScreenResponse.Aml.ScreenedData::fromJson)); + } + + /** + * Contains a POSSIBLE_MATCH_FOUND warning whenever score is non-zero and โ‰ฅ aml_score_approve_threshold (a score of exactly 0 never warns); empty otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(AmlScreenResponse.Aml.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Aml}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Aml from) { + super(from); + } + + /** + * Declined when score > aml_score_review_threshold; In Review when score > aml_score_approve_threshold; Approved otherwise (including when no score is available). + * + * @param status the value + * @return this builder + */ + public Builder status(AmlScreenResponse.Aml.Status status) { + return set("status", Conv.enumeration(AmlScreenResponse.Aml.Status::of), status); + } + + /** + * Number of entries in hits. + * + * @param totalHits the value + * @return this builder + */ + public Builder totalHits(long totalHits) { + return set("total_hits", Conv.LONG, totalHits); + } + + /** + * Echo of the screened entity type. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(AmlScreenResponse.Aml.EntityType entityType) { + return set("entity_type", Conv.enumeration(AmlScreenResponse.Aml.EntityType::of), entityType); + } + + /** + * The hits field. + * + * @param hits the value + * @return this builder + */ + public Builder hits(List hits) { + return set("hits", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits::fromJson)), hits); + } + + /** + * Overall AML risk score (0โ€“100): the highest risk_score among hits that are not False Positives. Drives status via the two thresholds. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Echo of what was screened: full_name, date_of_birth, nationality, document_number (absent fields are null). + * + * @param screenedData the value + * @return this builder + */ + public Builder screenedData(AmlScreenResponse.Aml.ScreenedData screenedData) { + return set("screened_data", Conv.model(AmlScreenResponse.Aml.ScreenedData::fromJson), screenedData); + } + + /** + * Contains a POSSIBLE_MATCH_FOUND warning whenever score is non-zero and โ‰ฅ aml_score_approve_threshold (a score of exactly 0 never warns); empty otherwise. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(AmlScreenResponse.Aml.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Aml} + */ + public Aml build() { + return new Aml(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Declined when score > aml_score_review_threshold; In Review when score > aml_score_approve_threshold; Approved otherwise (including when no score is available). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Echo of the screened entity type. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * One screening hit. match_score (0โ€“100) measures identity confidence โ€” hits below aml_match_score_threshold are tagged review_status: "False Positive" and excluded from the risk assessment; hits at or above it are "Unreviewed" possible matches. risk_score (0โ€“100) measures how risky the matched entity is and drives the top-level aml.score. + */ + public static final class Hits extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "url", "match", "score", "match_score", "risk_score", "target", "caption", "datasets", "features", "properties", "rca_name", "pep_matches", "sanction_matches", "warning_matches", "adverse_media_matches", "adverse_media_details", "first_seen", "last_seen", "linked_entities", "risk_view", "additional_information", "review_status", "score_breakdown"); + + private Hits(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Hits} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Hits fromJson(JsonNode json) { + return new Hits(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable identifier of the matched entity in the screening datasets. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * Source URL for the matched entity, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * Legacy exact-match flag. Prefer match_score + review_status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional match() { + return Json.optional(json, "match", Conv.BOOLEAN); + } + + /** + * DEPRECATED weighted match score in the 0โ€“1 range. Use match_score instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Identity confidence (0โ€“100). Compared against aml_match_score_threshold to split False Positives from Possible Matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchScore() { + return Json.optional(json, "match_score", Conv.DOUBLE); + } + + /** + * Entity risk score (0โ€“100). The highest risk_score among non-false-positive hits becomes the top-level aml.score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskScore() { + return Json.optional(json, "risk_score", Conv.DOUBLE); + } + + /** + * The target field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional target() { + return Json.optional(json, "target", Conv.BOOLEAN); + } + + /** + * Display name of the matched entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caption() { + return Json.optional(json, "caption", Conv.STRING); + } + + /** + * Datasets the entity appears in (e.g. PEP, PEP Level 1, sanctions list names). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> datasets() { + return Json.optional(json, "datasets", Conv.list(Conv.STRING)); + } + + /** + * The features field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.OBJECT); + } + + /** + * Entity profile: name, alias, notes, gender, birthDate, birthPlace, nationality, position, and other biographical arrays (each nullable). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> properties() { + return Json.optional(json, "properties", Conv.OBJECT); + } + + /** + * Name of the related close associate through which the entity was matched, when the hit is an RCA. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rcaName() { + return Json.optional(json, "rca_name", Conv.STRING); + } + + /** + * PEP list entries backing this hit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> pepMatches() { + return Json.optional(json, "pep_matches", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits.PepMatches::fromJson))); + } + + /** + * Sanctions list entries backing this hit (same backing-list shape as pep_matches, plus sanction-specific fields). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> sanctionMatches() { + return Json.optional(json, "sanction_matches", Conv.list(Conv.OBJECT)); + } + + /** + * Warning/watchlist entries backing this hit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> warningMatches() { + return Json.optional(json, "warning_matches", Conv.list(Conv.OBJECT)); + } + + /** + * Adverse-media articles. Populated only when include_adverse_media=true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> adverseMediaMatches() { + return Json.optional(json, "adverse_media_matches", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits.AdverseMediaMatches::fromJson))); + } + + /** + * Aggregated adverse-media sentiment for the entity (sentiment, sentiment_score, adverse_keywords frequency map). Populated only when include_adverse_media=true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> adverseMediaDetails() { + return Json.optional(json, "adverse_media_details", Conv.OBJECT); + } + + /** + * When the entity first appeared in the datasets. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSeen() { + return Json.optional(json, "first_seen", Conv.DATE_TIME); + } + + /** + * Most recent dataset refresh that included the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSeen() { + return Json.optional(json, "last_seen", Conv.DATE_TIME); + } + + /** + * Known relationships of the matched entity (family, associates, companies). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> linkedEntities() { + return Json.optional(json, "linked_entities", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits.LinkedEntities::fromJson))); + } + + /** + * Per-dimension risk breakdown (crimes, countries, categories, custom_list), each with score, weightage, risk_level, and a risk_scores map. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskView() { + return Json.optional(json, "risk_view", Conv.OBJECT); + } + + /** + * Free-form extra context, e.g. a flag_summary array explaining why the entity is flagged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalInformation() { + return Json.optional(json, "additional_information", Conv.OBJECT); + } + + /** + * False Positive โ€” match_score below aml_match_score_threshold, excluded from risk assessment. Unreviewed โ€” possible match awaiting review. Confirmed Match / Inconclusive โ€” set manually by a reviewer (via the Business Console) on saved sessions; that review capability is not part of this spec. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewStatus() { + return Json.optional(json, "review_status", Conv.enumeration(AmlScreenResponse.Aml.Hits.ReviewStatus::of)); + } + + /** + * How match_score was computed. Name, date of birth, and country each contribute <component>_score ร— <component>_weight_normalized points; weights are re-normalized when a component is missing from the screened data. The document number is not weighted โ€” it acts as a 'golden key': MATCH overrides the score to 100, NEUTRAL leaves it unchanged, HARD_MISMATCH applies a penalty. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scoreBreakdown() { + return Json.optional(json, "score_breakdown", Conv.model(AmlScreenResponse.Aml.Hits.ScoreBreakdown::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Hits}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Hits from) { + super(from); + } + + /** + * Stable identifier of the matched entity in the screening datasets. + * + * @param id the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder id(@Nullable String id) { + return setNullable("id", Conv.STRING, id); + } + + /** + * Source URL for the matched entity, when available. + * + * @param url the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder url(@Nullable String url) { + return setNullable("url", Conv.STRING, url); + } + + /** + * Legacy exact-match flag. Prefer match_score + review_status. + * + * @param match the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder match(@Nullable Boolean match) { + return setNullable("match", Conv.BOOLEAN, match); + } + + /** + * DEPRECATED weighted match score in the 0โ€“1 range. Use match_score instead. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Identity confidence (0โ€“100). Compared against aml_match_score_threshold to split False Positives from Possible Matches. + * + * @param matchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchScore(@Nullable Double matchScore) { + return setNullable("match_score", Conv.DOUBLE, matchScore); + } + + /** + * Entity risk score (0โ€“100). The highest risk_score among non-false-positive hits becomes the top-level aml.score. + * + * @param riskScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskScore(@Nullable Double riskScore) { + return setNullable("risk_score", Conv.DOUBLE, riskScore); + } + + /** + * The target field. + * + * @param target the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder target(@Nullable Boolean target) { + return setNullable("target", Conv.BOOLEAN, target); + } + + /** + * Display name of the matched entity. + * + * @param caption the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder caption(@Nullable String caption) { + return setNullable("caption", Conv.STRING, caption); + } + + /** + * Datasets the entity appears in (e.g. PEP, PEP Level 1, sanctions list names). + * + * @param datasets the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder datasets(@Nullable List datasets) { + return setNullable("datasets", Conv.list(Conv.STRING), datasets); + } + + /** + * The features field. + * + * @param features the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder features(@Nullable Map features) { + return setAny("features", features); + } + + /** + * Entity profile: name, alias, notes, gender, birthDate, birthPlace, nationality, position, and other biographical arrays (each nullable). + * + * @param properties the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder properties(@Nullable Map properties) { + return setAny("properties", properties); + } + + /** + * Name of the related close associate through which the entity was matched, when the hit is an RCA. + * + * @param rcaName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rcaName(@Nullable String rcaName) { + return setNullable("rca_name", Conv.STRING, rcaName); + } + + /** + * PEP list entries backing this hit. + * + * @param pepMatches the value + * @return this builder + */ + public Builder pepMatches(List pepMatches) { + return set("pep_matches", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits.PepMatches::fromJson)), pepMatches); + } + + /** + * Sanctions list entries backing this hit (same backing-list shape as pep_matches, plus sanction-specific fields). + * + * @param sanctionMatches the value + * @return this builder + */ + public Builder sanctionMatches(List> sanctionMatches) { + return setAny("sanction_matches", sanctionMatches); + } + + /** + * Warning/watchlist entries backing this hit. + * + * @param warningMatches the value + * @return this builder + */ + public Builder warningMatches(List> warningMatches) { + return setAny("warning_matches", warningMatches); + } + + /** + * Adverse-media articles. Populated only when include_adverse_media=true. + * + * @param adverseMediaMatches the value + * @return this builder + */ + public Builder adverseMediaMatches(List adverseMediaMatches) { + return set("adverse_media_matches", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits.AdverseMediaMatches::fromJson)), adverseMediaMatches); + } + + /** + * Aggregated adverse-media sentiment for the entity (sentiment, sentiment_score, adverse_keywords frequency map). Populated only when include_adverse_media=true. + * + * @param adverseMediaDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder adverseMediaDetails(@Nullable Map adverseMediaDetails) { + return setAny("adverse_media_details", adverseMediaDetails); + } + + /** + * When the entity first appeared in the datasets. + * + * @param firstSeen the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSeen(@Nullable OffsetDateTime firstSeen) { + return setNullable("first_seen", Conv.DATE_TIME, firstSeen); + } + + /** + * Most recent dataset refresh that included the entity. + * + * @param lastSeen the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSeen(@Nullable OffsetDateTime lastSeen) { + return setNullable("last_seen", Conv.DATE_TIME, lastSeen); + } + + /** + * Known relationships of the matched entity (family, associates, companies). + * + * @param linkedEntities the value + * @return this builder + */ + public Builder linkedEntities(List linkedEntities) { + return set("linked_entities", Conv.list(Conv.model(AmlScreenResponse.Aml.Hits.LinkedEntities::fromJson)), linkedEntities); + } + + /** + * Per-dimension risk breakdown (crimes, countries, categories, custom_list), each with score, weightage, risk_level, and a risk_scores map. + * + * @param riskView the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskView(@Nullable Map riskView) { + return setAny("risk_view", riskView); + } + + /** + * Free-form extra context, e.g. a flag_summary array explaining why the entity is flagged. + * + * @param additionalInformation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalInformation(@Nullable Map additionalInformation) { + return setAny("additional_information", additionalInformation); + } + + /** + * False Positive โ€” match_score below aml_match_score_threshold, excluded from risk assessment. Unreviewed โ€” possible match awaiting review. Confirmed Match / Inconclusive โ€” set manually by a reviewer (via the Business Console) on saved sessions; that review capability is not part of this spec. + * + * @param reviewStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewStatus(AmlScreenResponse.Aml.Hits.@Nullable ReviewStatus reviewStatus) { + return setNullable("review_status", Conv.enumeration(AmlScreenResponse.Aml.Hits.ReviewStatus::of), reviewStatus); + } + + /** + * How match_score was computed. Name, date of birth, and country each contribute <component>_score ร— <component>_weight_normalized points; weights are re-normalized when a component is missing from the screened data. The document number is not weighted โ€” it acts as a 'golden key': MATCH overrides the score to 100, NEUTRAL leaves it unchanged, HARD_MISMATCH applies a penalty. + * + * @param scoreBreakdown the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder scoreBreakdown(AmlScreenResponse.Aml.Hits.@Nullable ScoreBreakdown scoreBreakdown) { + return setNullable("score_breakdown", Conv.model(AmlScreenResponse.Aml.Hits.ScoreBreakdown::fromJson), scoreBreakdown); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Hits} + */ + public Hits build() { + return new Hits(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class PepMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("list_name", "publisher", "source_url", "description", "matched_name", "pep_position", "date_of_birth", "place_of_birth", "aliases", "education", "other_sources"); + + private PepMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PepMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PepMatches fromJson(JsonNode json) { + return new PepMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The list_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional listName() { + return Json.optional(json, "list_name", Conv.STRING); + } + + /** + * The publisher field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publisher() { + return Json.optional(json, "publisher", Conv.STRING); + } + + /** + * The source_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceUrl() { + return Json.optional(json, "source_url", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The matched_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchedName() { + return Json.optional(json, "matched_name", Conv.STRING); + } + + /** + * The pep_position field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pepPosition() { + return Json.optional(json, "pep_position", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.STRING); + } + + /** + * The place_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + /** + * The aliases field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aliases() { + return Json.optional(json, "aliases", Conv.list(Conv.STRING)); + } + + /** + * The education field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> education() { + return Json.optional(json, "education", Conv.list(Conv.STRING)); + } + + /** + * The other_sources field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> otherSources() { + return Json.optional(json, "other_sources", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PepMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PepMatches from) { + super(from); + } + + /** + * The list_name field. + * + * @param listName the value + * @return this builder + */ + public Builder listName(String listName) { + return set("list_name", Conv.STRING, listName); + } + + /** + * The publisher field. + * + * @param publisher the value + * @return this builder + */ + public Builder publisher(String publisher) { + return set("publisher", Conv.STRING, publisher); + } + + /** + * The source_url field. + * + * @param sourceUrl the value + * @return this builder + */ + public Builder sourceUrl(String sourceUrl) { + return set("source_url", Conv.STRING, sourceUrl); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The matched_name field. + * + * @param matchedName the value + * @return this builder + */ + public Builder matchedName(String matchedName) { + return set("matched_name", Conv.STRING, matchedName); + } + + /** + * The pep_position field. + * + * @param pepPosition the value + * @return this builder + */ + public Builder pepPosition(String pepPosition) { + return set("pep_position", Conv.STRING, pepPosition); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(String dateOfBirth) { + return set("date_of_birth", Conv.STRING, dateOfBirth); + } + + /** + * The place_of_birth field. + * + * @param placeOfBirth the value + * @return this builder + */ + public Builder placeOfBirth(String placeOfBirth) { + return set("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * The aliases field. + * + * @param aliases the value + * @return this builder + */ + public Builder aliases(List aliases) { + return set("aliases", Conv.list(Conv.STRING), aliases); + } + + /** + * The education field. + * + * @param education the value + * @return this builder + */ + public Builder education(List education) { + return set("education", Conv.list(Conv.STRING), education); + } + + /** + * The other_sources field. + * + * @param otherSources the value + * @return this builder + */ + public Builder otherSources(List otherSources) { + return set("other_sources", Conv.list(Conv.STRING), otherSources); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PepMatches} + */ + public PepMatches build() { + return new PepMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class AdverseMediaMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("headline", "summary", "sentiment", "sentiment_score", "source_url", "thumbnail", "country", "author_name", "publication_date", "adverse_keywords", "other_sources"); + + private AdverseMediaMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AdverseMediaMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AdverseMediaMatches fromJson(JsonNode json) { + return new AdverseMediaMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The headline field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional headline() { + return Json.optional(json, "headline", Conv.STRING); + } + + /** + * The summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.STRING); + } + + /** + * The sentiment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentiment() { + return Json.optional(json, "sentiment", Conv.STRING); + } + + /** + * The sentiment_score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentimentScore() { + return Json.optional(json, "sentiment_score", Conv.DOUBLE); + } + + /** + * The source_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceUrl() { + return Json.optional(json, "source_url", Conv.STRING); + } + + /** + * The thumbnail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional thumbnail() { + return Json.optional(json, "thumbnail", Conv.STRING); + } + + /** + * The country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The author_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional authorName() { + return Json.optional(json, "author_name", Conv.STRING); + } + + /** + * The publication_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publicationDate() { + return Json.optional(json, "publication_date", Conv.STRING); + } + + /** + * The adverse_keywords field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> adverseKeywords() { + return Json.optional(json, "adverse_keywords", Conv.list(Conv.STRING)); + } + + /** + * The other_sources field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> otherSources() { + return Json.optional(json, "other_sources", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AdverseMediaMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AdverseMediaMatches from) { + super(from); + } + + /** + * The headline field. + * + * @param headline the value + * @return this builder + */ + public Builder headline(String headline) { + return set("headline", Conv.STRING, headline); + } + + /** + * The summary field. + * + * @param summary the value + * @return this builder + */ + public Builder summary(String summary) { + return set("summary", Conv.STRING, summary); + } + + /** + * The sentiment field. + * + * @param sentiment the value + * @return this builder + */ + public Builder sentiment(String sentiment) { + return set("sentiment", Conv.STRING, sentiment); + } + + /** + * The sentiment_score field. + * + * @param sentimentScore the value + * @return this builder + */ + public Builder sentimentScore(double sentimentScore) { + return set("sentiment_score", Conv.DOUBLE, sentimentScore); + } + + /** + * The source_url field. + * + * @param sourceUrl the value + * @return this builder + */ + public Builder sourceUrl(String sourceUrl) { + return set("source_url", Conv.STRING, sourceUrl); + } + + /** + * The thumbnail field. + * + * @param thumbnail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder thumbnail(@Nullable String thumbnail) { + return setNullable("thumbnail", Conv.STRING, thumbnail); + } + + /** + * The country field. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * The author_name field. + * + * @param authorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder authorName(@Nullable String authorName) { + return setNullable("author_name", Conv.STRING, authorName); + } + + /** + * The publication_date field. + * + * @param publicationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder publicationDate(@Nullable String publicationDate) { + return setNullable("publication_date", Conv.STRING, publicationDate); + } + + /** + * The adverse_keywords field. + * + * @param adverseKeywords the value + * @return this builder + */ + public Builder adverseKeywords(List adverseKeywords) { + return set("adverse_keywords", Conv.list(Conv.STRING), adverseKeywords); + } + + /** + * The other_sources field. + * + * @param otherSources the value + * @return this builder + */ + public Builder otherSources(List otherSources) { + return set("other_sources", Conv.list(Conv.STRING), otherSources); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AdverseMediaMatches} + */ + public AdverseMediaMatches build() { + return new AdverseMediaMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class LinkedEntities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "relation", "status", "details", "active"); + + private LinkedEntities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code LinkedEntities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static LinkedEntities fromJson(JsonNode json) { + return new LinkedEntities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> name() { + return Json.optional(json, "name", Conv.list(Conv.STRING)); + } + + /** + * The relation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> relation() { + return Json.optional(json, "relation", Conv.list(Conv.STRING)); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> status() { + return Json.optional(json, "status", Conv.list(Conv.STRING)); + } + + /** + * The details field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.list(Conv.STRING)); + } + + /** + * The active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> active() { + return Json.optional(json, "active", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link LinkedEntities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(LinkedEntities from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(List name) { + return set("name", Conv.list(Conv.STRING), name); + } + + /** + * The relation field. + * + * @param relation the value + * @return this builder + */ + public Builder relation(List relation) { + return set("relation", Conv.list(Conv.STRING), relation); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(List status) { + return set("status", Conv.list(Conv.STRING), status); + } + + /** + * The details field. + * + * @param details the value + * @return this builder + */ + public Builder details(List details) { + return set("details", Conv.list(Conv.STRING), details); + } + + /** + * The active field. + * + * @param active the value + * @return this builder + */ + public Builder active(List active) { + return set("active", Conv.list(Conv.STRING), active); + } + + /** + * Builds the value. + * + * @return a new immutable {@code LinkedEntities} + */ + public LinkedEntities build() { + return new LinkedEntities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * False Positive โ€” match_score below aml_match_score_threshold, excluded from risk assessment. Unreviewed โ€” possible match awaiting review. Confirmed Match / Inconclusive โ€” set manually by a reviewer (via the Business Console) on saved sessions; that review capability is not part of this spec. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReviewStatus extends StringEnum { + /** The value {@code "False Positive"}. */ + public static final ReviewStatus FALSE_POSITIVE = new ReviewStatus("False Positive"); + + /** The value {@code "Unreviewed"}. */ + public static final ReviewStatus UNREVIEWED = new ReviewStatus("Unreviewed"); + + /** The value {@code "Confirmed Match"}. */ + public static final ReviewStatus CONFIRMED_MATCH = new ReviewStatus("Confirmed Match"); + + /** The value {@code "Inconclusive"}. */ + public static final ReviewStatus INCONCLUSIVE = new ReviewStatus("Inconclusive"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, UNREVIEWED, CONFIRMED_MATCH, INCONCLUSIVE); + + private ReviewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReviewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReviewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * How match_score was computed. Name, date of birth, and country each contribute <component>_score ร— <component>_weight_normalized points; weights are re-normalized when a component is missing from the screened data. The document number is not weighted โ€” it acts as a 'golden key': MATCH overrides the score to 100, NEUTRAL leaves it unchanged, HARD_MISMATCH applies a penalty. + */ + public static final class ScoreBreakdown extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name_score", "name_weight", "name_weight_normalized", "name_contribution", "dob_score", "dob_weight", "dob_weight_normalized", "dob_contribution", "country_score", "country_weight", "country_weight_normalized", "country_contribution", "document_number_match_type", "document_number_effect", "total_score"); + + private ScoreBreakdown(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScoreBreakdown} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScoreBreakdown fromJson(JsonNode json) { + return new ScoreBreakdown(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Raw name similarity (0โ€“100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameScore() { + return Json.optional(json, "name_score", Conv.LONG); + } + + /** + * Configured name weight (aml_name_weight). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameWeight() { + return Json.optional(json, "name_weight", Conv.LONG); + } + + /** + * Name weight after re-normalization (0โ€“100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameWeightNormalized() { + return Json.optional(json, "name_weight_normalized", Conv.DOUBLE); + } + + /** + * Points the name contributed to total_score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameContribution() { + return Json.optional(json, "name_contribution", Conv.DOUBLE); + } + + /** + * Date-of-birth score as a percentage of its weight (โˆ’100 to 100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobScore() { + return Json.optional(json, "dob_score", Conv.LONG); + } + + /** + * Configured DOB weight (aml_dob_weight). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobWeight() { + return Json.optional(json, "dob_weight", Conv.LONG); + } + + /** + * DOB weight after re-normalization (0โ€“100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobWeightNormalized() { + return Json.optional(json, "dob_weight_normalized", Conv.DOUBLE); + } + + /** + * Points the DOB contributed to total_score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobContribution() { + return Json.optional(json, "dob_contribution", Conv.DOUBLE); + } + + /** + * Country score as a percentage of its weight (โˆ’100 to 100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryScore() { + return Json.optional(json, "country_score", Conv.LONG); + } + + /** + * Configured country weight (aml_country_weight). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryWeight() { + return Json.optional(json, "country_weight", Conv.LONG); + } + + /** + * Country weight after re-normalization (0โ€“100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryWeightNormalized() { + return Json.optional(json, "country_weight_normalized", Conv.DOUBLE); + } + + /** + * Points the country contributed to total_score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryContribution() { + return Json.optional(json, "country_contribution", Conv.DOUBLE); + } + + /** + * Golden-key result for the document number comparison. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumberMatchType() { + return Json.optional(json, "document_number_match_type", Conv.enumeration(AmlScreenResponse.Aml.Hits.ScoreBreakdown.DocumentNumberMatchType::of)); + } + + /** + * Human-readable description of the document-number effect. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumberEffect() { + return Json.optional(json, "document_number_effect", Conv.STRING); + } + + /** + * Final weighted match score (0โ€“100) โ€” mirrors match_score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalScore() { + return Json.optional(json, "total_score", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScoreBreakdown}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScoreBreakdown from) { + super(from); + } + + /** + * Raw name similarity (0โ€“100). + * + * @param nameScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameScore(@Nullable Long nameScore) { + return setNullable("name_score", Conv.LONG, nameScore); + } + + /** + * Configured name weight (aml_name_weight). + * + * @param nameWeight the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameWeight(@Nullable Long nameWeight) { + return setNullable("name_weight", Conv.LONG, nameWeight); + } + + /** + * Name weight after re-normalization (0โ€“100). + * + * @param nameWeightNormalized the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameWeightNormalized(@Nullable Double nameWeightNormalized) { + return setNullable("name_weight_normalized", Conv.DOUBLE, nameWeightNormalized); + } + + /** + * Points the name contributed to total_score. + * + * @param nameContribution the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameContribution(@Nullable Double nameContribution) { + return setNullable("name_contribution", Conv.DOUBLE, nameContribution); + } + + /** + * Date-of-birth score as a percentage of its weight (โˆ’100 to 100). + * + * @param dobScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dobScore(@Nullable Long dobScore) { + return setNullable("dob_score", Conv.LONG, dobScore); + } + + /** + * Configured DOB weight (aml_dob_weight). + * + * @param dobWeight the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dobWeight(@Nullable Long dobWeight) { + return setNullable("dob_weight", Conv.LONG, dobWeight); + } + + /** + * DOB weight after re-normalization (0โ€“100). + * + * @param dobWeightNormalized the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dobWeightNormalized(@Nullable Double dobWeightNormalized) { + return setNullable("dob_weight_normalized", Conv.DOUBLE, dobWeightNormalized); + } + + /** + * Points the DOB contributed to total_score. + * + * @param dobContribution the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dobContribution(@Nullable Double dobContribution) { + return setNullable("dob_contribution", Conv.DOUBLE, dobContribution); + } + + /** + * Country score as a percentage of its weight (โˆ’100 to 100). + * + * @param countryScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryScore(@Nullable Long countryScore) { + return setNullable("country_score", Conv.LONG, countryScore); + } + + /** + * Configured country weight (aml_country_weight). + * + * @param countryWeight the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryWeight(@Nullable Long countryWeight) { + return setNullable("country_weight", Conv.LONG, countryWeight); + } + + /** + * Country weight after re-normalization (0โ€“100). + * + * @param countryWeightNormalized the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryWeightNormalized(@Nullable Double countryWeightNormalized) { + return setNullable("country_weight_normalized", Conv.DOUBLE, countryWeightNormalized); + } + + /** + * Points the country contributed to total_score. + * + * @param countryContribution the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryContribution(@Nullable Double countryContribution) { + return setNullable("country_contribution", Conv.DOUBLE, countryContribution); + } + + /** + * Golden-key result for the document number comparison. + * + * @param documentNumberMatchType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumberMatchType(AmlScreenResponse.Aml.Hits.ScoreBreakdown.@Nullable DocumentNumberMatchType documentNumberMatchType) { + return setNullable("document_number_match_type", Conv.enumeration(AmlScreenResponse.Aml.Hits.ScoreBreakdown.DocumentNumberMatchType::of), documentNumberMatchType); + } + + /** + * Human-readable description of the document-number effect. + * + * @param documentNumberEffect the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumberEffect(@Nullable String documentNumberEffect) { + return setNullable("document_number_effect", Conv.STRING, documentNumberEffect); + } + + /** + * Final weighted match score (0โ€“100) โ€” mirrors match_score. + * + * @param totalScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder totalScore(@Nullable Long totalScore) { + return setNullable("total_score", Conv.LONG, totalScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScoreBreakdown} + */ + public ScoreBreakdown build() { + return new ScoreBreakdown(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Golden-key result for the document number comparison. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentNumberMatchType extends StringEnum { + /** The value {@code "MATCH"}. */ + public static final DocumentNumberMatchType MATCH = new DocumentNumberMatchType("MATCH"); + + /** The value {@code "NEUTRAL"}. */ + public static final DocumentNumberMatchType NEUTRAL = new DocumentNumberMatchType("NEUTRAL"); + + /** The value {@code "HARD_MISMATCH"}. */ + public static final DocumentNumberMatchType HARD_MISMATCH = new DocumentNumberMatchType("HARD_MISMATCH"); + + private static final List KNOWN_VALUES = List.of(MATCH, NEUTRAL, HARD_MISMATCH); + + private DocumentNumberMatchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentNumberMatchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentNumberMatchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + /** + * Echo of what was screened: full_name, date_of_birth, nationality, document_number (absent fields are null). + */ + public static final class ScreenedData extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "date_of_birth", "nationality", "document_number"); + + private ScreenedData(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScreenedData} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScreenedData fromJson(JsonNode json) { + return new ScreenedData(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScreenedData}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScreenedData from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable String dateOfBirth) { + return setNullable("date_of_birth", Conv.STRING, dateOfBirth); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScreenedData} + */ + public ScreenedData build() { + return new ScreenedData(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature that raised the warning. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Machine-readable risk identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Extra context for the warning, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * warning, information, or error โ€” how the risk affected the outcome. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * One-line human-readable summary. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Full human-readable explanation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Feature that raised the warning. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Machine-readable risk identifier. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Extra context for the warning, when available. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * warning, information, or error โ€” how the risk affected the outcome. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * One-line human-readable summary. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Full human-readable explanation. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/Application.java b/src/main/java/me/didit/types/Application.java new file mode 100644 index 0000000..8b15be6 --- /dev/null +++ b/src/main/java/me/didit/types/Application.java @@ -0,0 +1,283 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Full application record. uuid, client_id, and api_key never change after creation. + */ +public final class Application extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "client_id", "api_key", "website_url", "redirect_uris", "terms_url", "privacy_url", "description", "created_at"); + + private Application(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Application} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Application fromJson(JsonNode json) { + return new Application(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Application UUID. Use as {app_id} in subsequent calls. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Application display name shown in the Didit console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Public client identifier, safe to embed in OAuth-style flows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientId() { + return Json.optional(json, "client_id", Conv.STRING); + } + + /** + * Long-lived secret (also called client_secret). Use as the x-api-key header for every call to https://verification.didit.me/v3/... (sessions, workflows, AML, etc.). Treat as a credential; never expose client-side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiKey() { + return Json.optional(json, "api_key", Conv.STRING); + } + + /** + * Website or app URL associated with this application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional websiteUrl() { + return Json.optional(json, "website_url", Conv.STRING); + } + + /** + * Allowed redirect URIs for OAuth-style and verification redirect flows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> redirectUris() { + return Json.optional(json, "redirect_uris", Conv.list(Conv.STRING)); + } + + /** + * Terms of service URL shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional termsUrl() { + return Json.optional(json, "terms_url", Conv.STRING); + } + + /** + * Privacy policy URL shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional privacyUrl() { + return Json.optional(json, "privacy_url", Conv.STRING); + } + + /** + * Internal description for the application (not shown to end users). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Application}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Application from) { + super(from); + } + + /** + * Application UUID. Use as {app_id} in subsequent calls. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Application display name shown in the Didit console. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Public client identifier, safe to embed in OAuth-style flows. + * + * @param clientId the value + * @return this builder + */ + public Builder clientId(String clientId) { + return set("client_id", Conv.STRING, clientId); + } + + /** + * Long-lived secret (also called client_secret). Use as the x-api-key header for every call to https://verification.didit.me/v3/... (sessions, workflows, AML, etc.). Treat as a credential; never expose client-side. + * + * @param apiKey the value + * @return this builder + */ + public Builder apiKey(String apiKey) { + return set("api_key", Conv.STRING, apiKey); + } + + /** + * Website or app URL associated with this application. + * + * @param websiteUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder websiteUrl(@Nullable String websiteUrl) { + return setNullable("website_url", Conv.STRING, websiteUrl); + } + + /** + * Allowed redirect URIs for OAuth-style and verification redirect flows. + * + * @param redirectUris the value + * @return this builder + */ + public Builder redirectUris(List redirectUris) { + return set("redirect_uris", Conv.list(Conv.STRING), redirectUris); + } + + /** + * Terms of service URL shown in the verification flow. + * + * @param termsUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder termsUrl(@Nullable String termsUrl) { + return setNullable("terms_url", Conv.STRING, termsUrl); + } + + /** + * Privacy policy URL shown in the verification flow. + * + * @param privacyUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder privacyUrl(@Nullable String privacyUrl) { + return setNullable("privacy_url", Conv.STRING, privacyUrl); + } + + /** + * Internal description for the application (not shown to end users). + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Application} + */ + public Application build() { + return new Application(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/ApplicationCreateRequest.java b/src/main/java/me/didit/types/ApplicationCreateRequest.java new file mode 100644 index 0000000..65ef7cc --- /dev/null +++ b/src/main/java/me/didit/types/ApplicationCreateRequest.java @@ -0,0 +1,201 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** + * All fields are optional. Sending an empty body creates an application with a default name. + */ +public final class ApplicationCreateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "website_url", "redirect_uris", "terms_url", "privacy_url", "description"); + + private ApplicationCreateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ApplicationCreateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ApplicationCreateRequest fromJson(JsonNode json) { + return new ApplicationCreateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Application display name. Defaults to "<organization name> App". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Website or app URL associated with this application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional websiteUrl() { + return Json.optional(json, "website_url", Conv.STRING); + } + + /** + * Allowed redirect URIs for OAuth-style and verification redirect flows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> redirectUris() { + return Json.optional(json, "redirect_uris", Conv.list(Conv.STRING)); + } + + /** + * Terms of service URL shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional termsUrl() { + return Json.optional(json, "terms_url", Conv.STRING); + } + + /** + * Privacy policy URL shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional privacyUrl() { + return Json.optional(json, "privacy_url", Conv.STRING); + } + + /** + * Internal description for the application (not shown to end users). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ApplicationCreateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ApplicationCreateRequest from) { + super(from); + } + + /** + * Application display name. Defaults to "<organization name> App". + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Website or app URL associated with this application. + * + * @param websiteUrl the value + * @return this builder + */ + public Builder websiteUrl(String websiteUrl) { + return set("website_url", Conv.STRING, websiteUrl); + } + + /** + * Allowed redirect URIs for OAuth-style and verification redirect flows. + * + * @param redirectUris the value + * @return this builder + */ + public Builder redirectUris(List redirectUris) { + return set("redirect_uris", Conv.list(Conv.STRING), redirectUris); + } + + /** + * Terms of service URL shown in the verification flow. + * + * @param termsUrl the value + * @return this builder + */ + public Builder termsUrl(String termsUrl) { + return set("terms_url", Conv.STRING, termsUrl); + } + + /** + * Privacy policy URL shown in the verification flow. + * + * @param privacyUrl the value + * @return this builder + */ + public Builder privacyUrl(String privacyUrl) { + return set("privacy_url", Conv.STRING, privacyUrl); + } + + /** + * Internal description for the application (not shown to end users). + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ApplicationCreateRequest} + */ + public ApplicationCreateRequest build() { + return new ApplicationCreateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/ApplicationCredentialsSummary.java b/src/main/java/me/didit/types/ApplicationCredentialsSummary.java new file mode 100644 index 0000000..121c676 --- /dev/null +++ b/src/main/java/me/didit/types/ApplicationCredentialsSummary.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** + * Minimal application shape returned inline by POST /programmatic/verify-email/. Persist the api_key immediately. + */ +public final class ApplicationCredentialsSummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "client_id", "api_key"); + + private ApplicationCredentialsSummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ApplicationCredentialsSummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ApplicationCredentialsSummary fromJson(JsonNode json) { + return new ApplicationCredentialsSummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The client_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientId() { + return Json.optional(json, "client_id", Conv.STRING); + } + + /** + * Use this as x-api-key on every verification API call. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiKey() { + return Json.optional(json, "api_key", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ApplicationCredentialsSummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ApplicationCredentialsSummary from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The client_id field. + * + * @param clientId the value + * @return this builder + */ + public Builder clientId(String clientId) { + return set("client_id", Conv.STRING, clientId); + } + + /** + * Use this as x-api-key on every verification API call. + * + * @param apiKey the value + * @return this builder + */ + public Builder apiKey(String apiKey) { + return set("api_key", Conv.STRING, apiKey); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ApplicationCredentialsSummary} + */ + public ApplicationCredentialsSummary build() { + return new ApplicationCredentialsSummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/ApplicationUpdateRequest.java b/src/main/java/me/didit/types/ApplicationUpdateRequest.java new file mode 100644 index 0000000..7c83a98 --- /dev/null +++ b/src/main/java/me/didit/types/ApplicationUpdateRequest.java @@ -0,0 +1,201 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** + * PATCH body for application metadata. Send only the fields you want to change; omitted fields are preserved. uuid, client_id, and api_key cannot be updated. + */ +public final class ApplicationUpdateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "website_url", "redirect_uris", "terms_url", "privacy_url", "description"); + + private ApplicationUpdateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ApplicationUpdateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ApplicationUpdateRequest fromJson(JsonNode json) { + return new ApplicationUpdateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Application display name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Website or app URL associated with this application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional websiteUrl() { + return Json.optional(json, "website_url", Conv.STRING); + } + + /** + * Allowed redirect URIs for OAuth-style and verification redirect flows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> redirectUris() { + return Json.optional(json, "redirect_uris", Conv.list(Conv.STRING)); + } + + /** + * Terms of service URL shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional termsUrl() { + return Json.optional(json, "terms_url", Conv.STRING); + } + + /** + * Privacy policy URL shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional privacyUrl() { + return Json.optional(json, "privacy_url", Conv.STRING); + } + + /** + * Internal description for the application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ApplicationUpdateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ApplicationUpdateRequest from) { + super(from); + } + + /** + * Application display name. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Website or app URL associated with this application. + * + * @param websiteUrl the value + * @return this builder + */ + public Builder websiteUrl(String websiteUrl) { + return set("website_url", Conv.STRING, websiteUrl); + } + + /** + * Allowed redirect URIs for OAuth-style and verification redirect flows. + * + * @param redirectUris the value + * @return this builder + */ + public Builder redirectUris(List redirectUris) { + return set("redirect_uris", Conv.list(Conv.STRING), redirectUris); + } + + /** + * Terms of service URL shown in the verification flow. + * + * @param termsUrl the value + * @return this builder + */ + public Builder termsUrl(String termsUrl) { + return set("terms_url", Conv.STRING, termsUrl); + } + + /** + * Privacy policy URL shown in the verification flow. + * + * @param privacyUrl the value + * @return this builder + */ + public Builder privacyUrl(String privacyUrl) { + return set("privacy_url", Conv.STRING, privacyUrl); + } + + /** + * Internal description for the application. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ApplicationUpdateRequest} + */ + public ApplicationUpdateRequest build() { + return new ApplicationUpdateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/AuthError.java b/src/main/java/me/didit/types/AuthError.java new file mode 100644 index 0000000..ec5d1f2 --- /dev/null +++ b/src/main/java/me/didit/types/AuthError.java @@ -0,0 +1,99 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Authentication / authorization / not-found error envelope. */ +public final class AuthError extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private AuthError(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AuthError} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AuthError fromJson(JsonNode json) { + return new AuthError(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AuthError}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AuthError from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AuthError} + */ + public AuthError build() { + return new AuthError(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BillingRetrieveBalanceResponse.java b/src/main/java/me/didit/types/BillingRetrieveBalanceResponse.java new file mode 100644 index 0000000..9829177 --- /dev/null +++ b/src/main/java/me/didit/types/BillingRetrieveBalanceResponse.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class BillingRetrieveBalanceResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("balance", "auto_refill_enabled", "auto_refill_amount", "auto_refill_threshold"); + + private BillingRetrieveBalanceResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BillingRetrieveBalanceResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BillingRetrieveBalanceResponse fromJson(JsonNode json) { + return new BillingRetrieveBalanceResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Current pre-paid credit balance in USD, as a fixed-point decimal string. Decreases as verifications are billed and increases when a top-up settles. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String balance() { + return Json.required(json, "balance", Conv.STRING); + } + + /** + * When true, Didit will automatically charge the saved Stripe payment method to add credits once the balance crosses auto_refill_threshold. Configured from Console โ†’ Billing. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean autoRefillEnabled() { + return Json.required(json, "auto_refill_enabled", Conv.BOOLEAN); + } + + /** + * USD amount that will be charged on each auto-refill. null when auto-refill is disabled or unset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional autoRefillAmount() { + return Json.optional(json, "auto_refill_amount", Conv.STRING); + } + + /** + * Trigger threshold in USD. Auto-refill fires when balance falls below this value. null when auto-refill is disabled or unset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional autoRefillThreshold() { + return Json.optional(json, "auto_refill_threshold", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BillingRetrieveBalanceResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BillingRetrieveBalanceResponse from) { + super(from); + } + + /** + * Current pre-paid credit balance in USD, as a fixed-point decimal string. Decreases as verifications are billed and increases when a top-up settles. + * + * @param balance the value + * @return this builder + */ + public Builder balance(String balance) { + return set("balance", Conv.STRING, balance); + } + + /** + * When true, Didit will automatically charge the saved Stripe payment method to add credits once the balance crosses auto_refill_threshold. Configured from Console โ†’ Billing. + * + * @param autoRefillEnabled the value + * @return this builder + */ + public Builder autoRefillEnabled(boolean autoRefillEnabled) { + return set("auto_refill_enabled", Conv.BOOLEAN, autoRefillEnabled); + } + + /** + * USD amount that will be charged on each auto-refill. null when auto-refill is disabled or unset. + * + * @param autoRefillAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder autoRefillAmount(@Nullable String autoRefillAmount) { + return setNullable("auto_refill_amount", Conv.STRING, autoRefillAmount); + } + + /** + * Trigger threshold in USD. Auto-refill fires when balance falls below this value. null when auto-refill is disabled or unset. + * + * @param autoRefillThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder autoRefillThreshold(@Nullable String autoRefillThreshold) { + return setNullable("auto_refill_threshold", Conv.STRING, autoRefillThreshold); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BillingRetrieveBalanceResponse} + * @throws IllegalStateException when a required field is missing + */ + public BillingRetrieveBalanceResponse build() { + require("balance", false); + require("auto_refill_enabled", false); + return new BillingRetrieveBalanceResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BillingTopUpParams.java b/src/main/java/me/didit/types/BillingTopUpParams.java new file mode 100644 index 0000000..2a76ccf --- /dev/null +++ b/src/main/java/me/didit/types/BillingTopUpParams.java @@ -0,0 +1,141 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code billing.top_up}. */ +public final class BillingTopUpParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("amount_in_dollars", "success_url", "cancel_url"); + + private BillingTopUpParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BillingTopUpParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BillingTopUpParams fromJson(JsonNode json) { + return new BillingTopUpParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Amount to charge, in USD. Must be at least 50. Tax is added automatically at checkout based on the customer's billing address. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double amountInDollars() { + return Json.required(json, "amount_in_dollars", Conv.DOUBLE); + } + + /** + * URL Stripe redirects the customer to after a successful payment. Currently defaults to https://console.didit.me. Pass a working URL explicitly; the default host is unavailable. Append the literal placeholder {CHECKOUT_SESSION_ID} if you want Stripe to substitute the session ID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional successUrl() { + return Json.optional(json, "success_url", Conv.STRING); + } + + /** + * URL Stripe redirects the customer to when they abort or close the Checkout window. Currently defaults to https://console.didit.me. Pass a working URL explicitly; the default host is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional cancelUrl() { + return Json.optional(json, "cancel_url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BillingTopUpParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BillingTopUpParams from) { + super(from); + } + + /** + * Amount to charge, in USD. Must be at least 50. Tax is added automatically at checkout based on the customer's billing address. + * + * @param amountInDollars the value + * @return this builder + */ + public Builder amountInDollars(double amountInDollars) { + return set("amount_in_dollars", Conv.DOUBLE, amountInDollars); + } + + /** + * URL Stripe redirects the customer to after a successful payment. Currently defaults to https://console.didit.me. Pass a working URL explicitly; the default host is unavailable. Append the literal placeholder {CHECKOUT_SESSION_ID} if you want Stripe to substitute the session ID. + * + * @param successUrl the value + * @return this builder + */ + public Builder successUrl(String successUrl) { + return set("success_url", Conv.STRING, successUrl); + } + + /** + * URL Stripe redirects the customer to when they abort or close the Checkout window. Currently defaults to https://console.didit.me. Pass a working URL explicitly; the default host is unavailable. + * + * @param cancelUrl the value + * @return this builder + */ + public Builder cancelUrl(String cancelUrl) { + return set("cancel_url", Conv.STRING, cancelUrl); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BillingTopUpParams} + * @throws IllegalStateException when a required field is missing + */ + public BillingTopUpParams build() { + require("amount_in_dollars", false); + return new BillingTopUpParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BillingTopUpResponse.java b/src/main/java/me/didit/types/BillingTopUpResponse.java new file mode 100644 index 0000000..c19df88 --- /dev/null +++ b/src/main/java/me/didit/types/BillingTopUpResponse.java @@ -0,0 +1,120 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class BillingTopUpResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("checkout_session_id", "checkout_session_url"); + + private BillingTopUpResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BillingTopUpResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BillingTopUpResponse fromJson(JsonNode json) { + return new BillingTopUpResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stripe Checkout Session identifier (e.g. cs_test_a1B2c3...). Useful for server-side reconciliation. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String checkoutSessionId() { + return Json.required(json, "checkout_session_id", Conv.STRING); + } + + /** + * Single-use Stripe-hosted payment page URL. Redirect the customer here to complete payment. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String checkoutSessionUrl() { + return Json.required(json, "checkout_session_url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BillingTopUpResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BillingTopUpResponse from) { + super(from); + } + + /** + * Stripe Checkout Session identifier (e.g. cs_test_a1B2c3...). Useful for server-side reconciliation. + * + * @param checkoutSessionId the value + * @return this builder + */ + public Builder checkoutSessionId(String checkoutSessionId) { + return set("checkout_session_id", Conv.STRING, checkoutSessionId); + } + + /** + * Single-use Stripe-hosted payment page URL. Redirect the customer here to complete payment. + * + * @param checkoutSessionUrl the value + * @return this builder + */ + public Builder checkoutSessionUrl(String checkoutSessionUrl) { + return set("checkout_session_url", Conv.STRING, checkoutSessionUrl); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BillingTopUpResponse} + * @throws IllegalStateException when a required field is missing + */ + public BillingTopUpResponse build() { + require("checkout_session_id", false); + require("checkout_session_url", false); + return new BillingTopUpResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesBatchDeleteParams.java b/src/main/java/me/didit/types/BiometricTemplatesBatchDeleteParams.java new file mode 100644 index 0000000..596e82e --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesBatchDeleteParams.java @@ -0,0 +1,342 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code biometric_templates.batch_delete}. */ +public final class BiometricTemplatesBatchDeleteParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("template_uuids", "delete_all", "vendor_data", "vendor_user_uuid", "status", "source_type", "retained_from", "retained_to"); + + private BiometricTemplatesBatchDeleteParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesBatchDeleteParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesBatchDeleteParams fromJson(JsonNode json) { + return new BiometricTemplatesBatchDeleteParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Templates to purge. Required unless delete_all is true. Already purged ids are reported as already_purged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> templateUuids() { + return Json.optional(json, "template_uuids", Conv.list(Conv.STRING)); + } + + /** + * When true, purges every template matching the filters below (all of the application's templates when no filter is given). template_uuids is ignored. Irreversible. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteAll() { + return Json.optional(json, "delete_all", Conv.BOOLEAN); + } + + /** + * Only with delete_all: case-insensitive substring match on the owning User's vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Only with delete_all: exact match on the owning User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserUuid() { + return Json.optional(json, "vendor_user_uuid", Conv.STRING); + } + + /** + * Only with delete_all. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BiometricTemplatesBatchDeleteParams.Status::of)); + } + + /** + * Only with delete_all. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceType() { + return Json.optional(json, "source_type", Conv.enumeration(BiometricTemplatesBatchDeleteParams.SourceType::of)); + } + + /** + * Only with delete_all. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedFrom() { + return Json.optional(json, "retained_from", Conv.DATE_TIME); + } + + /** + * Only with delete_all. Must not be earlier than retained_from. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedTo() { + return Json.optional(json, "retained_to", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesBatchDeleteParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesBatchDeleteParams from) { + super(from); + } + + /** + * Templates to purge. Required unless delete_all is true. Already purged ids are reported as already_purged. + * + * @param templateUuids the value + * @return this builder + */ + public Builder templateUuids(List templateUuids) { + return set("template_uuids", Conv.list(Conv.STRING), templateUuids); + } + + /** + * When true, purges every template matching the filters below (all of the application's templates when no filter is given). template_uuids is ignored. Irreversible. + * + * @param deleteAll the value + * @return this builder + */ + public Builder deleteAll(boolean deleteAll) { + return set("delete_all", Conv.BOOLEAN, deleteAll); + } + + /** + * Only with delete_all: case-insensitive substring match on the owning User's vendor_data. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Only with delete_all: exact match on the owning User. + * + * @param vendorUserUuid the value + * @return this builder + */ + public Builder vendorUserUuid(String vendorUserUuid) { + return set("vendor_user_uuid", Conv.STRING, vendorUserUuid); + } + + /** + * Only with delete_all. + * + * @param status the value + * @return this builder + */ + public Builder status(BiometricTemplatesBatchDeleteParams.Status status) { + return set("status", Conv.enumeration(BiometricTemplatesBatchDeleteParams.Status::of), status); + } + + /** + * Only with delete_all. + * + * @param sourceType the value + * @return this builder + */ + public Builder sourceType(BiometricTemplatesBatchDeleteParams.SourceType sourceType) { + return set("source_type", Conv.enumeration(BiometricTemplatesBatchDeleteParams.SourceType::of), sourceType); + } + + /** + * Only with delete_all. + * + * @param retainedFrom the value + * @return this builder + */ + public Builder retainedFrom(OffsetDateTime retainedFrom) { + return set("retained_from", Conv.DATE_TIME, retainedFrom); + } + + /** + * Only with delete_all. Must not be earlier than retained_from. + * + * @param retainedTo the value + * @return this builder + */ + public Builder retainedTo(OffsetDateTime retainedTo) { + return set("retained_to", Conv.DATE_TIME, retainedTo); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesBatchDeleteParams} + */ + public BiometricTemplatesBatchDeleteParams build() { + return new BiometricTemplatesBatchDeleteParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Only with delete_all. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "pending"}. */ + public static final Status PENDING = new Status("pending"); + + /** The value {@code "active"}. */ + public static final Status ACTIVE = new Status("active"); + + /** The value {@code "expired"}. */ + public static final Status EXPIRED = new Status("expired"); + + /** The value {@code "held_out_of_use"}. */ + public static final Status HELD_OUT_OF_USE = new Status("held_out_of_use"); + + /** The value {@code "purge_pending"}. */ + public static final Status PURGE_PENDING = new Status("purge_pending"); + + /** The value {@code "purge_failed"}. */ + public static final Status PURGE_FAILED = new Status("purge_failed"); + + private static final List KNOWN_VALUES = List.of(PENDING, ACTIVE, EXPIRED, HELD_OUT_OF_USE, PURGE_PENDING, PURGE_FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Only with delete_all. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceType extends StringEnum { + /** The value {@code "session_delete"}. */ + public static final SourceType SESSION_DELETE = new SourceType("session_delete"); + + /** The value {@code "automatic_retention"}. */ + public static final SourceType AUTOMATIC_RETENTION = new SourceType("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final SourceType BACKFILL = new SourceType("backfill"); + + private static final List KNOWN_VALUES = List.of(SESSION_DELETE, AUTOMATIC_RETENTION, BACKFILL); + + private SourceType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesBatchDeleteResponse.java b/src/main/java/me/didit/types/BiometricTemplatesBatchDeleteResponse.java new file mode 100644 index 0000000..c39eaf3 --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesBatchDeleteResponse.java @@ -0,0 +1,246 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class BiometricTemplatesBatchDeleteResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private BiometricTemplatesBatchDeleteResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesBatchDeleteResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesBatchDeleteResponse fromJson(JsonNode json) { + return new BiometricTemplatesBatchDeleteResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(BiometricTemplatesBatchDeleteResponse.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesBatchDeleteResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesBatchDeleteResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(BiometricTemplatesBatchDeleteResponse.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesBatchDeleteResponse} + */ + public BiometricTemplatesBatchDeleteResponse build() { + return new BiometricTemplatesBatchDeleteResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "outcome"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(BiometricTemplatesBatchDeleteResponse.Results.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(BiometricTemplatesBatchDeleteResponse.Results.Outcome outcome) { + return set("outcome", Conv.enumeration(BiometricTemplatesBatchDeleteResponse.Results.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "purged"}. */ + public static final Outcome PURGED = new Outcome("purged"); + + /** The value {@code "already_purged"}. */ + public static final Outcome ALREADY_PURGED = new Outcome("already_purged"); + + private static final List KNOWN_VALUES = List.of(PURGED, ALREADY_PURGED); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesCountParams.java b/src/main/java/me/didit/types/BiometricTemplatesCountParams.java new file mode 100644 index 0000000..d335162 --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesCountParams.java @@ -0,0 +1,300 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code biometric_templates.count}. */ +public final class BiometricTemplatesCountParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "vendor_user_uuid", "status", "source_type", "retained_from", "retained_to"); + + private BiometricTemplatesCountParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesCountParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesCountParams fromJson(JsonNode json) { + return new BiometricTemplatesCountParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Case-insensitive substring match on the owning User's current vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Exact match on the owning User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserUuid() { + return Json.optional(json, "vendor_user_uuid", Conv.STRING); + } + + /** + * Lifecycle status. Purged templates are never listed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BiometricTemplatesCountParams.Status::of)); + } + + /** + * How the template was created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceType() { + return Json.optional(json, "source_type", Conv.enumeration(BiometricTemplatesCountParams.SourceType::of)); + } + + /** + * Templates retained at or after this time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedFrom() { + return Json.optional(json, "retained_from", Conv.DATE_TIME); + } + + /** + * Templates retained at or before this time. Must not be earlier than retained_from (400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedTo() { + return Json.optional(json, "retained_to", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesCountParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesCountParams from) { + super(from); + } + + /** + * Case-insensitive substring match on the owning User's current vendor_data. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Exact match on the owning User. + * + * @param vendorUserUuid the value + * @return this builder + */ + public Builder vendorUserUuid(String vendorUserUuid) { + return set("vendor_user_uuid", Conv.STRING, vendorUserUuid); + } + + /** + * Lifecycle status. Purged templates are never listed. + * + * @param status the value + * @return this builder + */ + public Builder status(BiometricTemplatesCountParams.Status status) { + return set("status", Conv.enumeration(BiometricTemplatesCountParams.Status::of), status); + } + + /** + * How the template was created. + * + * @param sourceType the value + * @return this builder + */ + public Builder sourceType(BiometricTemplatesCountParams.SourceType sourceType) { + return set("source_type", Conv.enumeration(BiometricTemplatesCountParams.SourceType::of), sourceType); + } + + /** + * Templates retained at or after this time. + * + * @param retainedFrom the value + * @return this builder + */ + public Builder retainedFrom(OffsetDateTime retainedFrom) { + return set("retained_from", Conv.DATE_TIME, retainedFrom); + } + + /** + * Templates retained at or before this time. Must not be earlier than retained_from (400). + * + * @param retainedTo the value + * @return this builder + */ + public Builder retainedTo(OffsetDateTime retainedTo) { + return set("retained_to", Conv.DATE_TIME, retainedTo); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesCountParams} + */ + public BiometricTemplatesCountParams build() { + return new BiometricTemplatesCountParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "pending"}. */ + public static final Status PENDING = new Status("pending"); + + /** The value {@code "active"}. */ + public static final Status ACTIVE = new Status("active"); + + /** The value {@code "expired"}. */ + public static final Status EXPIRED = new Status("expired"); + + /** The value {@code "held_out_of_use"}. */ + public static final Status HELD_OUT_OF_USE = new Status("held_out_of_use"); + + /** The value {@code "purge_pending"}. */ + public static final Status PURGE_PENDING = new Status("purge_pending"); + + /** The value {@code "purge_failed"}. */ + public static final Status PURGE_FAILED = new Status("purge_failed"); + + private static final List KNOWN_VALUES = List.of(PENDING, ACTIVE, EXPIRED, HELD_OUT_OF_USE, PURGE_PENDING, PURGE_FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceType extends StringEnum { + /** The value {@code "session_delete"}. */ + public static final SourceType SESSION_DELETE = new SourceType("session_delete"); + + /** The value {@code "automatic_retention"}. */ + public static final SourceType AUTOMATIC_RETENTION = new SourceType("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final SourceType BACKFILL = new SourceType("backfill"); + + private static final List KNOWN_VALUES = List.of(SESSION_DELETE, AUTOMATIC_RETENTION, BACKFILL); + + private SourceType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesCountResponse.java b/src/main/java/me/didit/types/BiometricTemplatesCountResponse.java new file mode 100644 index 0000000..d7e4fd9 --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesCountResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class BiometricTemplatesCountResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count"); + + private BiometricTemplatesCountResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesCountResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesCountResponse fromJson(JsonNode json) { + return new BiometricTemplatesCountResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesCountResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesCountResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesCountResponse} + */ + public BiometricTemplatesCountResponse build() { + return new BiometricTemplatesCountResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesDeleteResponse.java b/src/main/java/me/didit/types/BiometricTemplatesDeleteResponse.java new file mode 100644 index 0000000..cfd809f --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesDeleteResponse.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class BiometricTemplatesDeleteResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "outcome"); + + private BiometricTemplatesDeleteResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesDeleteResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesDeleteResponse fromJson(JsonNode json) { + return new BiometricTemplatesDeleteResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(BiometricTemplatesDeleteResponse.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesDeleteResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesDeleteResponse from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(BiometricTemplatesDeleteResponse.Outcome outcome) { + return set("outcome", Conv.enumeration(BiometricTemplatesDeleteResponse.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesDeleteResponse} + */ + public BiometricTemplatesDeleteResponse build() { + return new BiometricTemplatesDeleteResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "purged"}. */ + public static final Outcome PURGED = new Outcome("purged"); + + /** The value {@code "already_purged"}. */ + public static final Outcome ALREADY_PURGED = new Outcome("already_purged"); + + private static final List KNOWN_VALUES = List.of(PURGED, ALREADY_PURGED); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesListParams.java b/src/main/java/me/didit/types/BiometricTemplatesListParams.java new file mode 100644 index 0000000..c14d33e --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesListParams.java @@ -0,0 +1,408 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code biometric_templates.list}. */ +public final class BiometricTemplatesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "vendor_user_uuid", "status", "source_type", "retained_from", "retained_to", "ordering", "limit", "offset"); + + private BiometricTemplatesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesListParams fromJson(JsonNode json) { + return new BiometricTemplatesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Case-insensitive substring match on the owning User's current vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Exact match on the owning User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserUuid() { + return Json.optional(json, "vendor_user_uuid", Conv.STRING); + } + + /** + * Lifecycle status. Purged templates are never listed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BiometricTemplatesListParams.Status::of)); + } + + /** + * How the template was created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceType() { + return Json.optional(json, "source_type", Conv.enumeration(BiometricTemplatesListParams.SourceType::of)); + } + + /** + * Templates retained at or after this time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedFrom() { + return Json.optional(json, "retained_from", Conv.DATE_TIME); + } + + /** + * Templates retained at or before this time. Must not be earlier than retained_from (400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedTo() { + return Json.optional(json, "retained_to", Conv.DATE_TIME); + } + + /** + * Sort order. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.enumeration(BiometricTemplatesListParams.Ordering::of)); + } + + /** + * Page size. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Pagination offset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesListParams from) { + super(from); + } + + /** + * Case-insensitive substring match on the owning User's current vendor_data. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Exact match on the owning User. + * + * @param vendorUserUuid the value + * @return this builder + */ + public Builder vendorUserUuid(String vendorUserUuid) { + return set("vendor_user_uuid", Conv.STRING, vendorUserUuid); + } + + /** + * Lifecycle status. Purged templates are never listed. + * + * @param status the value + * @return this builder + */ + public Builder status(BiometricTemplatesListParams.Status status) { + return set("status", Conv.enumeration(BiometricTemplatesListParams.Status::of), status); + } + + /** + * How the template was created. + * + * @param sourceType the value + * @return this builder + */ + public Builder sourceType(BiometricTemplatesListParams.SourceType sourceType) { + return set("source_type", Conv.enumeration(BiometricTemplatesListParams.SourceType::of), sourceType); + } + + /** + * Templates retained at or after this time. + * + * @param retainedFrom the value + * @return this builder + */ + public Builder retainedFrom(OffsetDateTime retainedFrom) { + return set("retained_from", Conv.DATE_TIME, retainedFrom); + } + + /** + * Templates retained at or before this time. Must not be earlier than retained_from (400). + * + * @param retainedTo the value + * @return this builder + */ + public Builder retainedTo(OffsetDateTime retainedTo) { + return set("retained_to", Conv.DATE_TIME, retainedTo); + } + + /** + * Sort order. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(BiometricTemplatesListParams.Ordering ordering) { + return set("ordering", Conv.enumeration(BiometricTemplatesListParams.Ordering::of), ordering); + } + + /** + * Page size. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Pagination offset. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesListParams} + */ + public BiometricTemplatesListParams build() { + return new BiometricTemplatesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "pending"}. */ + public static final Status PENDING = new Status("pending"); + + /** The value {@code "active"}. */ + public static final Status ACTIVE = new Status("active"); + + /** The value {@code "expired"}. */ + public static final Status EXPIRED = new Status("expired"); + + /** The value {@code "held_out_of_use"}. */ + public static final Status HELD_OUT_OF_USE = new Status("held_out_of_use"); + + /** The value {@code "purge_pending"}. */ + public static final Status PURGE_PENDING = new Status("purge_pending"); + + /** The value {@code "purge_failed"}. */ + public static final Status PURGE_FAILED = new Status("purge_failed"); + + private static final List KNOWN_VALUES = List.of(PENDING, ACTIVE, EXPIRED, HELD_OUT_OF_USE, PURGE_PENDING, PURGE_FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceType extends StringEnum { + /** The value {@code "session_delete"}. */ + public static final SourceType SESSION_DELETE = new SourceType("session_delete"); + + /** The value {@code "automatic_retention"}. */ + public static final SourceType AUTOMATIC_RETENTION = new SourceType("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final SourceType BACKFILL = new SourceType("backfill"); + + private static final List KNOWN_VALUES = List.of(SESSION_DELETE, AUTOMATIC_RETENTION, BACKFILL); + + private SourceType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Ordering extends StringEnum { + /** The value {@code "retained_at"}. */ + public static final Ordering RETAINED_AT = new Ordering("retained_at"); + + /** The value {@code "-retained_at"}. */ + public static final Ordering RETAINED_AT_2 = new Ordering("-retained_at"); + + /** The value {@code "expires_at"}. */ + public static final Ordering EXPIRES_AT = new Ordering("expires_at"); + + /** The value {@code "-expires_at"}. */ + public static final Ordering EXPIRES_AT_2 = new Ordering("-expires_at"); + + private static final List KNOWN_VALUES = List.of(RETAINED_AT, RETAINED_AT_2, EXPIRES_AT, EXPIRES_AT_2); + + private Ordering(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Ordering of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Ordering::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesListResponse.java b/src/main/java/me/didit/types/BiometricTemplatesListResponse.java new file mode 100644 index 0000000..2ec90c2 --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesListResponse.java @@ -0,0 +1,869 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class BiometricTemplatesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private BiometricTemplatesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesListResponse fromJson(JsonNode json) { + return new BiometricTemplatesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(BiometricTemplatesListResponse.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesListResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(BiometricTemplatesListResponse.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesListResponse} + */ + public BiometricTemplatesListResponse build() { + return new BiometricTemplatesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "vendor_user_uuid", "vendor_data", "source_type", "provenance_reference", "retention_policy", "retention_override", "retained_at", "expires_at", "retained_by", "retained_by_type", "instruction_class", "instruction_source", "instruction_id", "held_out_of_use", "status", "purged_at"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Template id. Randomly generated; not derived from the deleted session or its face. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The owning User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserUuid() { + return Json.optional(json, "vendor_user_uuid", Conv.STRING); + } + + /** + * The User's current vendor_data, resolved when you read the template (never copied). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * How the template was created: a session deletion (API or Console), the application's automatic data-retention window, or a Didit-operated backfill you instructed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceType() { + return Json.optional(json, "source_type", Conv.enumeration(BiometricTemplatesListResponse.Results.SourceType::of)); + } + + /** + * Opaque reference tying the template to its audit trail. It is not the deleted session's id and cannot be resolved to it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional provenanceReference() { + return Json.optional(json, "provenance_reference", Conv.STRING); + } + + /** + * The application policy at retention time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retentionPolicy() { + return Json.optional(json, "retention_policy", Conv.enumeration(BiometricTemplatesListResponse.Results.RetentionPolicy::of)); + } + + /** + * The retain_face_embeddings value sent on the deletion, or null when the policy applied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retentionOverride() { + return Json.optional(json, "retention_override", Conv.BOOLEAN); + } + + /** + * The retained_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedAt() { + return Json.optional(json, "retained_at", Conv.DATE_TIME); + } + + /** + * When the template expires and is purged automatically. Always set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + /** + * Principal that gave the instruction: the application id for API keys, the Console member id for Console actions, or a service: identifier for automatic retention. Never an email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedBy() { + return Json.optional(json, "retained_by", Conv.STRING); + } + + /** + * The retained_by_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedByType() { + return Json.optional(json, "retained_by_type", Conv.enumeration(BiometricTemplatesListResponse.Results.RetainedByType::of)); + } + + /** + * The instruction_class field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionClass() { + return Json.optional(json, "instruction_class", Conv.enumeration(BiometricTemplatesListResponse.Results.InstructionClass::of)); + } + + /** + * The instruction_source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionSource() { + return Json.optional(json, "instruction_source", Conv.enumeration(BiometricTemplatesListResponse.Results.InstructionSource::of)); + } + + /** + * The instruction_id sent on the deletion, or a Didit-generated id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionId() { + return Json.optional(json, "instruction_id", Conv.STRING); + } + + /** + * true only while a legal hold applies. A held template is excluded from all matching. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional heldOutOfUse() { + return Json.optional(json, "held_out_of_use", Conv.BOOLEAN); + } + + /** + * Only active templates that are not held, not past expires_at, and whose User still exists take part in matching. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BiometricTemplatesListResponse.Results.Status::of)); + } + + /** + * The purged_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional purgedAt() { + return Json.optional(json, "purged_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Template id. Randomly generated; not derived from the deleted session or its face. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The owning User. + * + * @param vendorUserUuid the value + * @return this builder + */ + public Builder vendorUserUuid(String vendorUserUuid) { + return set("vendor_user_uuid", Conv.STRING, vendorUserUuid); + } + + /** + * The User's current vendor_data, resolved when you read the template (never copied). + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * How the template was created: a session deletion (API or Console), the application's automatic data-retention window, or a Didit-operated backfill you instructed. + * + * @param sourceType the value + * @return this builder + */ + public Builder sourceType(BiometricTemplatesListResponse.Results.SourceType sourceType) { + return set("source_type", Conv.enumeration(BiometricTemplatesListResponse.Results.SourceType::of), sourceType); + } + + /** + * Opaque reference tying the template to its audit trail. It is not the deleted session's id and cannot be resolved to it. + * + * @param provenanceReference the value + * @return this builder + */ + public Builder provenanceReference(String provenanceReference) { + return set("provenance_reference", Conv.STRING, provenanceReference); + } + + /** + * The application policy at retention time. + * + * @param retentionPolicy the value + * @return this builder + */ + public Builder retentionPolicy(BiometricTemplatesListResponse.Results.RetentionPolicy retentionPolicy) { + return set("retention_policy", Conv.enumeration(BiometricTemplatesListResponse.Results.RetentionPolicy::of), retentionPolicy); + } + + /** + * The retain_face_embeddings value sent on the deletion, or null when the policy applied. + * + * @param retentionOverride the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retentionOverride(@Nullable Boolean retentionOverride) { + return setNullable("retention_override", Conv.BOOLEAN, retentionOverride); + } + + /** + * The retained_at field. + * + * @param retainedAt the value + * @return this builder + */ + public Builder retainedAt(OffsetDateTime retainedAt) { + return set("retained_at", Conv.DATE_TIME, retainedAt); + } + + /** + * When the template expires and is purged automatically. Always set. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Principal that gave the instruction: the application id for API keys, the Console member id for Console actions, or a service: identifier for automatic retention. Never an email address. + * + * @param retainedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retainedBy(@Nullable String retainedBy) { + return setNullable("retained_by", Conv.STRING, retainedBy); + } + + /** + * The retained_by_type field. + * + * @param retainedByType the value + * @return this builder + */ + public Builder retainedByType(BiometricTemplatesListResponse.Results.RetainedByType retainedByType) { + return set("retained_by_type", Conv.enumeration(BiometricTemplatesListResponse.Results.RetainedByType::of), retainedByType); + } + + /** + * The instruction_class field. + * + * @param instructionClass the value + * @return this builder + */ + public Builder instructionClass(BiometricTemplatesListResponse.Results.InstructionClass instructionClass) { + return set("instruction_class", Conv.enumeration(BiometricTemplatesListResponse.Results.InstructionClass::of), instructionClass); + } + + /** + * The instruction_source field. + * + * @param instructionSource the value + * @return this builder + */ + public Builder instructionSource(BiometricTemplatesListResponse.Results.InstructionSource instructionSource) { + return set("instruction_source", Conv.enumeration(BiometricTemplatesListResponse.Results.InstructionSource::of), instructionSource); + } + + /** + * The instruction_id sent on the deletion, or a Didit-generated id. + * + * @param instructionId the value + * @return this builder + */ + public Builder instructionId(String instructionId) { + return set("instruction_id", Conv.STRING, instructionId); + } + + /** + * true only while a legal hold applies. A held template is excluded from all matching. + * + * @param heldOutOfUse the value + * @return this builder + */ + public Builder heldOutOfUse(boolean heldOutOfUse) { + return set("held_out_of_use", Conv.BOOLEAN, heldOutOfUse); + } + + /** + * Only active templates that are not held, not past expires_at, and whose User still exists take part in matching. + * + * @param status the value + * @return this builder + */ + public Builder status(BiometricTemplatesListResponse.Results.Status status) { + return set("status", Conv.enumeration(BiometricTemplatesListResponse.Results.Status::of), status); + } + + /** + * The purged_at field. + * + * @param purgedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder purgedAt(@Nullable OffsetDateTime purgedAt) { + return setNullable("purged_at", Conv.DATE_TIME, purgedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * How the template was created: a session deletion (API or Console), the application's automatic data-retention window, or a Didit-operated backfill you instructed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceType extends StringEnum { + /** The value {@code "session_delete"}. */ + public static final SourceType SESSION_DELETE = new SourceType("session_delete"); + + /** The value {@code "automatic_retention"}. */ + public static final SourceType AUTOMATIC_RETENTION = new SourceType("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final SourceType BACKFILL = new SourceType("backfill"); + + private static final List KNOWN_VALUES = List.of(SESSION_DELETE, AUTOMATIC_RETENTION, BACKFILL); + + private SourceType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The application policy at retention time. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RetentionPolicy extends StringEnum { + /** The value {@code "delete_with_session"}. */ + public static final RetentionPolicy DELETE_WITH_SESSION = new RetentionPolicy("delete_with_session"); + + /** The value {@code "retain_until_user_deleted"}. */ + public static final RetentionPolicy RETAIN_UNTIL_USER_DELETED = new RetentionPolicy("retain_until_user_deleted"); + + private static final List KNOWN_VALUES = List.of(DELETE_WITH_SESSION, RETAIN_UNTIL_USER_DELETED); + + private RetentionPolicy(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RetentionPolicy of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RetentionPolicy::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RetainedByType extends StringEnum { + /** The value {@code "API_KEY"}. */ + public static final RetainedByType API_KEY = new RetainedByType("API_KEY"); + + /** The value {@code "CONSOLE_USER"}. */ + public static final RetainedByType CONSOLE_USER = new RetainedByType("CONSOLE_USER"); + + /** The value {@code "SYSTEM"}. */ + public static final RetainedByType SYSTEM = new RetainedByType("SYSTEM"); + + private static final List KNOWN_VALUES = List.of(API_KEY, CONSOLE_USER, SYSTEM); + + private RetainedByType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RetainedByType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RetainedByType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class InstructionClass extends StringEnum { + /** The value {@code "operational_session_delete"}. */ + public static final InstructionClass OPERATIONAL_SESSION_DELETE = new InstructionClass("operational_session_delete"); + + /** The value {@code "privacy_erasure"}. */ + public static final InstructionClass PRIVACY_ERASURE = new InstructionClass("privacy_erasure"); + + private static final List KNOWN_VALUES = List.of(OPERATIONAL_SESSION_DELETE, PRIVACY_ERASURE); + + private InstructionClass(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static InstructionClass of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, InstructionClass::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class InstructionSource extends StringEnum { + /** The value {@code "api"}. */ + public static final InstructionSource API = new InstructionSource("api"); + + /** The value {@code "console"}. */ + public static final InstructionSource CONSOLE = new InstructionSource("console"); + + /** The value {@code "automatic_retention"}. */ + public static final InstructionSource AUTOMATIC_RETENTION = new InstructionSource("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final InstructionSource BACKFILL = new InstructionSource("backfill"); + + /** The value {@code "privacy_erasure"}. */ + public static final InstructionSource PRIVACY_ERASURE = new InstructionSource("privacy_erasure"); + + /** The value {@code "explicit_template_purge"}. */ + public static final InstructionSource EXPLICIT_TEMPLATE_PURGE = new InstructionSource("explicit_template_purge"); + + /** The value {@code "vendor_user_delete"}. */ + public static final InstructionSource VENDOR_USER_DELETE = new InstructionSource("vendor_user_delete"); + + /** The value {@code "expiry"}. */ + public static final InstructionSource EXPIRY = new InstructionSource("expiry"); + + /** The value {@code "reconciliation"}. */ + public static final InstructionSource RECONCILIATION = new InstructionSource("reconciliation"); + + /** The value {@code "migration"}. */ + public static final InstructionSource MIGRATION = new InstructionSource("migration"); + + /** The value {@code "system"}. */ + public static final InstructionSource SYSTEM = new InstructionSource("system"); + + private static final List KNOWN_VALUES = List.of(API, CONSOLE, AUTOMATIC_RETENTION, BACKFILL, PRIVACY_ERASURE, EXPLICIT_TEMPLATE_PURGE, VENDOR_USER_DELETE, EXPIRY, RECONCILIATION, MIGRATION, SYSTEM); + + private InstructionSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static InstructionSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, InstructionSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Only active templates that are not held, not past expires_at, and whose User still exists take part in matching. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "pending"}. */ + public static final Status PENDING = new Status("pending"); + + /** The value {@code "active"}. */ + public static final Status ACTIVE = new Status("active"); + + /** The value {@code "expired"}. */ + public static final Status EXPIRED = new Status("expired"); + + /** The value {@code "held_out_of_use"}. */ + public static final Status HELD_OUT_OF_USE = new Status("held_out_of_use"); + + /** The value {@code "purge_pending"}. */ + public static final Status PURGE_PENDING = new Status("purge_pending"); + + /** The value {@code "purge_failed"}. */ + public static final Status PURGE_FAILED = new Status("purge_failed"); + + /** The value {@code "purged"}. */ + public static final Status PURGED = new Status("purged"); + + private static final List KNOWN_VALUES = List.of(PENDING, ACTIVE, EXPIRED, HELD_OUT_OF_USE, PURGE_PENDING, PURGE_FAILED, PURGED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/BiometricTemplatesRetrieveResponse.java b/src/main/java/me/didit/types/BiometricTemplatesRetrieveResponse.java new file mode 100644 index 0000000..13d34be --- /dev/null +++ b/src/main/java/me/didit/types/BiometricTemplatesRetrieveResponse.java @@ -0,0 +1,724 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class BiometricTemplatesRetrieveResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "vendor_user_uuid", "vendor_data", "source_type", "provenance_reference", "retention_policy", "retention_override", "retained_at", "expires_at", "retained_by", "retained_by_type", "instruction_class", "instruction_source", "instruction_id", "held_out_of_use", "status", "purged_at"); + + private BiometricTemplatesRetrieveResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BiometricTemplatesRetrieveResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BiometricTemplatesRetrieveResponse fromJson(JsonNode json) { + return new BiometricTemplatesRetrieveResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Template id. Randomly generated; not derived from the deleted session or its face. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The owning User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserUuid() { + return Json.optional(json, "vendor_user_uuid", Conv.STRING); + } + + /** + * The User's current vendor_data, resolved when you read the template (never copied). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * How the template was created: a session deletion (API or Console), the application's automatic data-retention window, or a Didit-operated backfill you instructed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceType() { + return Json.optional(json, "source_type", Conv.enumeration(BiometricTemplatesRetrieveResponse.SourceType::of)); + } + + /** + * Opaque reference tying the template to its audit trail. It is not the deleted session's id and cannot be resolved to it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional provenanceReference() { + return Json.optional(json, "provenance_reference", Conv.STRING); + } + + /** + * The application policy at retention time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retentionPolicy() { + return Json.optional(json, "retention_policy", Conv.enumeration(BiometricTemplatesRetrieveResponse.RetentionPolicy::of)); + } + + /** + * The retain_face_embeddings value sent on the deletion, or null when the policy applied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retentionOverride() { + return Json.optional(json, "retention_override", Conv.BOOLEAN); + } + + /** + * The retained_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedAt() { + return Json.optional(json, "retained_at", Conv.DATE_TIME); + } + + /** + * When the template expires and is purged automatically. Always set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + /** + * Principal that gave the instruction: the application id for API keys, the Console member id for Console actions, or a service: identifier for automatic retention. Never an email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedBy() { + return Json.optional(json, "retained_by", Conv.STRING); + } + + /** + * The retained_by_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedByType() { + return Json.optional(json, "retained_by_type", Conv.enumeration(BiometricTemplatesRetrieveResponse.RetainedByType::of)); + } + + /** + * The instruction_class field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionClass() { + return Json.optional(json, "instruction_class", Conv.enumeration(BiometricTemplatesRetrieveResponse.InstructionClass::of)); + } + + /** + * The instruction_source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionSource() { + return Json.optional(json, "instruction_source", Conv.enumeration(BiometricTemplatesRetrieveResponse.InstructionSource::of)); + } + + /** + * The instruction_id sent on the deletion, or a Didit-generated id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionId() { + return Json.optional(json, "instruction_id", Conv.STRING); + } + + /** + * true only while a legal hold applies. A held template is excluded from all matching. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional heldOutOfUse() { + return Json.optional(json, "held_out_of_use", Conv.BOOLEAN); + } + + /** + * Only active templates that are not held, not past expires_at, and whose User still exists take part in matching. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BiometricTemplatesRetrieveResponse.Status::of)); + } + + /** + * The purged_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional purgedAt() { + return Json.optional(json, "purged_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BiometricTemplatesRetrieveResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BiometricTemplatesRetrieveResponse from) { + super(from); + } + + /** + * Template id. Randomly generated; not derived from the deleted session or its face. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The owning User. + * + * @param vendorUserUuid the value + * @return this builder + */ + public Builder vendorUserUuid(String vendorUserUuid) { + return set("vendor_user_uuid", Conv.STRING, vendorUserUuid); + } + + /** + * The User's current vendor_data, resolved when you read the template (never copied). + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * How the template was created: a session deletion (API or Console), the application's automatic data-retention window, or a Didit-operated backfill you instructed. + * + * @param sourceType the value + * @return this builder + */ + public Builder sourceType(BiometricTemplatesRetrieveResponse.SourceType sourceType) { + return set("source_type", Conv.enumeration(BiometricTemplatesRetrieveResponse.SourceType::of), sourceType); + } + + /** + * Opaque reference tying the template to its audit trail. It is not the deleted session's id and cannot be resolved to it. + * + * @param provenanceReference the value + * @return this builder + */ + public Builder provenanceReference(String provenanceReference) { + return set("provenance_reference", Conv.STRING, provenanceReference); + } + + /** + * The application policy at retention time. + * + * @param retentionPolicy the value + * @return this builder + */ + public Builder retentionPolicy(BiometricTemplatesRetrieveResponse.RetentionPolicy retentionPolicy) { + return set("retention_policy", Conv.enumeration(BiometricTemplatesRetrieveResponse.RetentionPolicy::of), retentionPolicy); + } + + /** + * The retain_face_embeddings value sent on the deletion, or null when the policy applied. + * + * @param retentionOverride the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retentionOverride(@Nullable Boolean retentionOverride) { + return setNullable("retention_override", Conv.BOOLEAN, retentionOverride); + } + + /** + * The retained_at field. + * + * @param retainedAt the value + * @return this builder + */ + public Builder retainedAt(OffsetDateTime retainedAt) { + return set("retained_at", Conv.DATE_TIME, retainedAt); + } + + /** + * When the template expires and is purged automatically. Always set. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Principal that gave the instruction: the application id for API keys, the Console member id for Console actions, or a service: identifier for automatic retention. Never an email address. + * + * @param retainedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retainedBy(@Nullable String retainedBy) { + return setNullable("retained_by", Conv.STRING, retainedBy); + } + + /** + * The retained_by_type field. + * + * @param retainedByType the value + * @return this builder + */ + public Builder retainedByType(BiometricTemplatesRetrieveResponse.RetainedByType retainedByType) { + return set("retained_by_type", Conv.enumeration(BiometricTemplatesRetrieveResponse.RetainedByType::of), retainedByType); + } + + /** + * The instruction_class field. + * + * @param instructionClass the value + * @return this builder + */ + public Builder instructionClass(BiometricTemplatesRetrieveResponse.InstructionClass instructionClass) { + return set("instruction_class", Conv.enumeration(BiometricTemplatesRetrieveResponse.InstructionClass::of), instructionClass); + } + + /** + * The instruction_source field. + * + * @param instructionSource the value + * @return this builder + */ + public Builder instructionSource(BiometricTemplatesRetrieveResponse.InstructionSource instructionSource) { + return set("instruction_source", Conv.enumeration(BiometricTemplatesRetrieveResponse.InstructionSource::of), instructionSource); + } + + /** + * The instruction_id sent on the deletion, or a Didit-generated id. + * + * @param instructionId the value + * @return this builder + */ + public Builder instructionId(String instructionId) { + return set("instruction_id", Conv.STRING, instructionId); + } + + /** + * true only while a legal hold applies. A held template is excluded from all matching. + * + * @param heldOutOfUse the value + * @return this builder + */ + public Builder heldOutOfUse(boolean heldOutOfUse) { + return set("held_out_of_use", Conv.BOOLEAN, heldOutOfUse); + } + + /** + * Only active templates that are not held, not past expires_at, and whose User still exists take part in matching. + * + * @param status the value + * @return this builder + */ + public Builder status(BiometricTemplatesRetrieveResponse.Status status) { + return set("status", Conv.enumeration(BiometricTemplatesRetrieveResponse.Status::of), status); + } + + /** + * The purged_at field. + * + * @param purgedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder purgedAt(@Nullable OffsetDateTime purgedAt) { + return setNullable("purged_at", Conv.DATE_TIME, purgedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BiometricTemplatesRetrieveResponse} + */ + public BiometricTemplatesRetrieveResponse build() { + return new BiometricTemplatesRetrieveResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * How the template was created: a session deletion (API or Console), the application's automatic data-retention window, or a Didit-operated backfill you instructed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceType extends StringEnum { + /** The value {@code "session_delete"}. */ + public static final SourceType SESSION_DELETE = new SourceType("session_delete"); + + /** The value {@code "automatic_retention"}. */ + public static final SourceType AUTOMATIC_RETENTION = new SourceType("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final SourceType BACKFILL = new SourceType("backfill"); + + private static final List KNOWN_VALUES = List.of(SESSION_DELETE, AUTOMATIC_RETENTION, BACKFILL); + + private SourceType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The application policy at retention time. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RetentionPolicy extends StringEnum { + /** The value {@code "delete_with_session"}. */ + public static final RetentionPolicy DELETE_WITH_SESSION = new RetentionPolicy("delete_with_session"); + + /** The value {@code "retain_until_user_deleted"}. */ + public static final RetentionPolicy RETAIN_UNTIL_USER_DELETED = new RetentionPolicy("retain_until_user_deleted"); + + private static final List KNOWN_VALUES = List.of(DELETE_WITH_SESSION, RETAIN_UNTIL_USER_DELETED); + + private RetentionPolicy(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RetentionPolicy of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RetentionPolicy::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RetainedByType extends StringEnum { + /** The value {@code "API_KEY"}. */ + public static final RetainedByType API_KEY = new RetainedByType("API_KEY"); + + /** The value {@code "CONSOLE_USER"}. */ + public static final RetainedByType CONSOLE_USER = new RetainedByType("CONSOLE_USER"); + + /** The value {@code "SYSTEM"}. */ + public static final RetainedByType SYSTEM = new RetainedByType("SYSTEM"); + + private static final List KNOWN_VALUES = List.of(API_KEY, CONSOLE_USER, SYSTEM); + + private RetainedByType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RetainedByType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RetainedByType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class InstructionClass extends StringEnum { + /** The value {@code "operational_session_delete"}. */ + public static final InstructionClass OPERATIONAL_SESSION_DELETE = new InstructionClass("operational_session_delete"); + + /** The value {@code "privacy_erasure"}. */ + public static final InstructionClass PRIVACY_ERASURE = new InstructionClass("privacy_erasure"); + + private static final List KNOWN_VALUES = List.of(OPERATIONAL_SESSION_DELETE, PRIVACY_ERASURE); + + private InstructionClass(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static InstructionClass of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, InstructionClass::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class InstructionSource extends StringEnum { + /** The value {@code "api"}. */ + public static final InstructionSource API = new InstructionSource("api"); + + /** The value {@code "console"}. */ + public static final InstructionSource CONSOLE = new InstructionSource("console"); + + /** The value {@code "automatic_retention"}. */ + public static final InstructionSource AUTOMATIC_RETENTION = new InstructionSource("automatic_retention"); + + /** The value {@code "backfill"}. */ + public static final InstructionSource BACKFILL = new InstructionSource("backfill"); + + /** The value {@code "privacy_erasure"}. */ + public static final InstructionSource PRIVACY_ERASURE = new InstructionSource("privacy_erasure"); + + /** The value {@code "explicit_template_purge"}. */ + public static final InstructionSource EXPLICIT_TEMPLATE_PURGE = new InstructionSource("explicit_template_purge"); + + /** The value {@code "vendor_user_delete"}. */ + public static final InstructionSource VENDOR_USER_DELETE = new InstructionSource("vendor_user_delete"); + + /** The value {@code "expiry"}. */ + public static final InstructionSource EXPIRY = new InstructionSource("expiry"); + + /** The value {@code "reconciliation"}. */ + public static final InstructionSource RECONCILIATION = new InstructionSource("reconciliation"); + + /** The value {@code "migration"}. */ + public static final InstructionSource MIGRATION = new InstructionSource("migration"); + + /** The value {@code "system"}. */ + public static final InstructionSource SYSTEM = new InstructionSource("system"); + + private static final List KNOWN_VALUES = List.of(API, CONSOLE, AUTOMATIC_RETENTION, BACKFILL, PRIVACY_ERASURE, EXPLICIT_TEMPLATE_PURGE, VENDOR_USER_DELETE, EXPIRY, RECONCILIATION, MIGRATION, SYSTEM); + + private InstructionSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static InstructionSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, InstructionSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Only active templates that are not held, not past expires_at, and whose User still exists take part in matching. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "pending"}. */ + public static final Status PENDING = new Status("pending"); + + /** The value {@code "active"}. */ + public static final Status ACTIVE = new Status("active"); + + /** The value {@code "expired"}. */ + public static final Status EXPIRED = new Status("expired"); + + /** The value {@code "held_out_of_use"}. */ + public static final Status HELD_OUT_OF_USE = new Status("held_out_of_use"); + + /** The value {@code "purge_pending"}. */ + public static final Status PURGE_PENDING = new Status("purge_pending"); + + /** The value {@code "purge_failed"}. */ + public static final Status PURGE_FAILED = new Status("purge_failed"); + + /** The value {@code "purged"}. */ + public static final Status PURGED = new Status("purged"); + + private static final List KNOWN_VALUES = List.of(PENDING, ACTIVE, EXPIRED, HELD_OUT_OF_USE, PURGE_PENDING, PURGE_FAILED, PURGED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BlocklistItem.java b/src/main/java/me/didit/types/BlocklistItem.java new file mode 100644 index 0000000..67742c2 --- /dev/null +++ b/src/main/java/me/didit/types/BlocklistItem.java @@ -0,0 +1,309 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class BlocklistItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "session_id", "session_number", "blocklisted_at", "face_image", "document_type", "document_number", "phone_number", "email"); + + private BlocklistItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BlocklistItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BlocklistItem fromJson(JsonNode json) { + return new BlocklistItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.enumeration(BlocklistItem.Type::of)); + } + + /** + * The session_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The session_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * The blocklisted_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blocklistedAt() { + return Json.optional(json, "blocklisted_at", Conv.DATE_TIME); + } + + /** + * The face_image field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceImage() { + return Json.optional(json, "face_image", Conv.STRING); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * The phone_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BlocklistItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BlocklistItem from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(BlocklistItem.Type type) { + return set("type", Conv.enumeration(BlocklistItem.Type::of), type); + } + + /** + * The session_id field. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * The session_number field. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * The blocklisted_at field. + * + * @param blocklistedAt the value + * @return this builder + */ + public Builder blocklistedAt(OffsetDateTime blocklistedAt) { + return set("blocklisted_at", Conv.DATE_TIME, blocklistedAt); + } + + /** + * The face_image field. + * + * @param faceImage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceImage(@Nullable String faceImage) { + return setNullable("face_image", Conv.STRING, faceImage); + } + + /** + * The document_type field. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(@Nullable String documentType) { + return setNullable("document_type", Conv.STRING, documentType); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * The phone_number field. + * + * @param phoneNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneNumber(@Nullable String phoneNumber) { + return setNullable("phone_number", Conv.STRING, phoneNumber); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BlocklistItem} + */ + public BlocklistItem build() { + return new BlocklistItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "face"}. */ + public static final Type FACE = new Type("face"); + + /** The value {@code "document"}. */ + public static final Type DOCUMENT = new Type("document"); + + /** The value {@code "phone"}. */ + public static final Type PHONE = new Type("phone"); + + /** The value {@code "email"}. */ + public static final Type EMAIL = new Type("email"); + + private static final List KNOWN_VALUES = List.of(FACE, DOCUMENT, PHONE, EMAIL); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BrandingCustomization.java b/src/main/java/me/didit/types/BrandingCustomization.java new file mode 100644 index 0000000..4e217d2 --- /dev/null +++ b/src/main/java/me/didit/types/BrandingCustomization.java @@ -0,0 +1,622 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * White-label branding for an application: colors, fonts, radii, logo URLs and UI/UX options. Logo URLs are read-only (set them by uploading images). Custom domain and white-label email are not included. + */ +public final class BrandingCustomization extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("color_primary", "color_secondary", "color_background", "color_panel", "color_panel_10", "color_on_panel_1", "color_on_panel_2", "color_on_background", "color_button_1", "color_button_2", "color_button_text_1", "color_button_text_2", "color_pill_text", "border_radius_panel", "border_radius_buttons", "font_family", "font_weight", "font_url", "logo_square", "logo_rectangular", "favicon", "app_public_name", "privacy_policy_url", "skip_welcome_screen", "disable_login_with_didit", "hide_progress_bar", "callback_seconds"); + + private BrandingCustomization(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BrandingCustomization} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BrandingCustomization fromJson(JsonNode json) { + return new BrandingCustomization(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The color_primary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPrimary() { + return Json.optional(json, "color_primary", Conv.STRING); + } + + /** + * The color_secondary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorSecondary() { + return Json.optional(json, "color_secondary", Conv.STRING); + } + + /** + * The color_background field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorBackground() { + return Json.optional(json, "color_background", Conv.STRING); + } + + /** + * The color_panel field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPanel() { + return Json.optional(json, "color_panel", Conv.STRING); + } + + /** + * The color_panel_10 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPanel10() { + return Json.optional(json, "color_panel_10", Conv.STRING); + } + + /** + * The color_on_panel_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorOnPanel1() { + return Json.optional(json, "color_on_panel_1", Conv.STRING); + } + + /** + * The color_on_panel_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorOnPanel2() { + return Json.optional(json, "color_on_panel_2", Conv.STRING); + } + + /** + * The color_on_background field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorOnBackground() { + return Json.optional(json, "color_on_background", Conv.STRING); + } + + /** + * The color_button_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButton1() { + return Json.optional(json, "color_button_1", Conv.STRING); + } + + /** + * The color_button_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButton2() { + return Json.optional(json, "color_button_2", Conv.STRING); + } + + /** + * The color_button_text_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButtonText1() { + return Json.optional(json, "color_button_text_1", Conv.STRING); + } + + /** + * The color_button_text_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButtonText2() { + return Json.optional(json, "color_button_text_2", Conv.STRING); + } + + /** + * The color_pill_text field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPillText() { + return Json.optional(json, "color_pill_text", Conv.STRING); + } + + /** + * The border_radius_panel field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional borderRadiusPanel() { + return Json.optional(json, "border_radius_panel", Conv.LONG); + } + + /** + * The border_radius_buttons field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional borderRadiusButtons() { + return Json.optional(json, "border_radius_buttons", Conv.LONG); + } + + /** + * The font_family field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fontFamily() { + return Json.optional(json, "font_family", Conv.STRING); + } + + /** + * The font_weight field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fontWeight() { + return Json.optional(json, "font_weight", Conv.STRING); + } + + /** + * Read-only. Resolved Google Fonts stylesheet URL for the selected family. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fontUrl() { + return Json.optional(json, "font_url", Conv.STRING); + } + + /** + * Read-only URL of the square logo. Upload via image_square. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logoSquare() { + return Json.optional(json, "logo_square", Conv.STRING); + } + + /** + * Read-only URL of the rectangular logo. Upload via image_rectangular. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logoRectangular() { + return Json.optional(json, "logo_rectangular", Conv.STRING); + } + + /** + * Read-only URL of the favicon. Upload via image_favicon. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional favicon() { + return Json.optional(json, "favicon", Conv.STRING); + } + + /** + * The app_public_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appPublicName() { + return Json.optional(json, "app_public_name", Conv.STRING); + } + + /** + * The privacy_policy_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional privacyPolicyUrl() { + return Json.optional(json, "privacy_policy_url", Conv.STRING); + } + + /** + * The skip_welcome_screen field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skipWelcomeScreen() { + return Json.optional(json, "skip_welcome_screen", Conv.BOOLEAN); + } + + /** + * The disable_login_with_didit field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disableLoginWithDidit() { + return Json.optional(json, "disable_login_with_didit", Conv.BOOLEAN); + } + + /** + * The hide_progress_bar field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hideProgressBar() { + return Json.optional(json, "hide_progress_bar", Conv.BOOLEAN); + } + + /** + * The callback_seconds field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callbackSeconds() { + return Json.optional(json, "callback_seconds", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BrandingCustomization}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BrandingCustomization from) { + super(from); + } + + /** + * The color_primary field. + * + * @param colorPrimary the value + * @return this builder + */ + public Builder colorPrimary(String colorPrimary) { + return set("color_primary", Conv.STRING, colorPrimary); + } + + /** + * The color_secondary field. + * + * @param colorSecondary the value + * @return this builder + */ + public Builder colorSecondary(String colorSecondary) { + return set("color_secondary", Conv.STRING, colorSecondary); + } + + /** + * The color_background field. + * + * @param colorBackground the value + * @return this builder + */ + public Builder colorBackground(String colorBackground) { + return set("color_background", Conv.STRING, colorBackground); + } + + /** + * The color_panel field. + * + * @param colorPanel the value + * @return this builder + */ + public Builder colorPanel(String colorPanel) { + return set("color_panel", Conv.STRING, colorPanel); + } + + /** + * The color_panel_10 field. + * + * @param colorPanel10 the value + * @return this builder + */ + public Builder colorPanel10(String colorPanel10) { + return set("color_panel_10", Conv.STRING, colorPanel10); + } + + /** + * The color_on_panel_1 field. + * + * @param colorOnPanel1 the value + * @return this builder + */ + public Builder colorOnPanel1(String colorOnPanel1) { + return set("color_on_panel_1", Conv.STRING, colorOnPanel1); + } + + /** + * The color_on_panel_2 field. + * + * @param colorOnPanel2 the value + * @return this builder + */ + public Builder colorOnPanel2(String colorOnPanel2) { + return set("color_on_panel_2", Conv.STRING, colorOnPanel2); + } + + /** + * The color_on_background field. + * + * @param colorOnBackground the value + * @return this builder + */ + public Builder colorOnBackground(String colorOnBackground) { + return set("color_on_background", Conv.STRING, colorOnBackground); + } + + /** + * The color_button_1 field. + * + * @param colorButton1 the value + * @return this builder + */ + public Builder colorButton1(String colorButton1) { + return set("color_button_1", Conv.STRING, colorButton1); + } + + /** + * The color_button_2 field. + * + * @param colorButton2 the value + * @return this builder + */ + public Builder colorButton2(String colorButton2) { + return set("color_button_2", Conv.STRING, colorButton2); + } + + /** + * The color_button_text_1 field. + * + * @param colorButtonText1 the value + * @return this builder + */ + public Builder colorButtonText1(String colorButtonText1) { + return set("color_button_text_1", Conv.STRING, colorButtonText1); + } + + /** + * The color_button_text_2 field. + * + * @param colorButtonText2 the value + * @return this builder + */ + public Builder colorButtonText2(String colorButtonText2) { + return set("color_button_text_2", Conv.STRING, colorButtonText2); + } + + /** + * The color_pill_text field. + * + * @param colorPillText the value + * @return this builder + */ + public Builder colorPillText(String colorPillText) { + return set("color_pill_text", Conv.STRING, colorPillText); + } + + /** + * The border_radius_panel field. + * + * @param borderRadiusPanel the value + * @return this builder + */ + public Builder borderRadiusPanel(long borderRadiusPanel) { + return set("border_radius_panel", Conv.LONG, borderRadiusPanel); + } + + /** + * The border_radius_buttons field. + * + * @param borderRadiusButtons the value + * @return this builder + */ + public Builder borderRadiusButtons(long borderRadiusButtons) { + return set("border_radius_buttons", Conv.LONG, borderRadiusButtons); + } + + /** + * The font_family field. + * + * @param fontFamily the value + * @return this builder + */ + public Builder fontFamily(String fontFamily) { + return set("font_family", Conv.STRING, fontFamily); + } + + /** + * The font_weight field. + * + * @param fontWeight the value + * @return this builder + */ + public Builder fontWeight(String fontWeight) { + return set("font_weight", Conv.STRING, fontWeight); + } + + /** + * Read-only. Resolved Google Fonts stylesheet URL for the selected family. + * + * @param fontUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fontUrl(@Nullable String fontUrl) { + return setNullable("font_url", Conv.STRING, fontUrl); + } + + /** + * Read-only URL of the square logo. Upload via image_square. + * + * @param logoSquare the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder logoSquare(@Nullable String logoSquare) { + return setNullable("logo_square", Conv.STRING, logoSquare); + } + + /** + * Read-only URL of the rectangular logo. Upload via image_rectangular. + * + * @param logoRectangular the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder logoRectangular(@Nullable String logoRectangular) { + return setNullable("logo_rectangular", Conv.STRING, logoRectangular); + } + + /** + * Read-only URL of the favicon. Upload via image_favicon. + * + * @param favicon the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder favicon(@Nullable String favicon) { + return setNullable("favicon", Conv.STRING, favicon); + } + + /** + * The app_public_name field. + * + * @param appPublicName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appPublicName(@Nullable String appPublicName) { + return setNullable("app_public_name", Conv.STRING, appPublicName); + } + + /** + * The privacy_policy_url field. + * + * @param privacyPolicyUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder privacyPolicyUrl(@Nullable String privacyPolicyUrl) { + return setNullable("privacy_policy_url", Conv.STRING, privacyPolicyUrl); + } + + /** + * The skip_welcome_screen field. + * + * @param skipWelcomeScreen the value + * @return this builder + */ + public Builder skipWelcomeScreen(boolean skipWelcomeScreen) { + return set("skip_welcome_screen", Conv.BOOLEAN, skipWelcomeScreen); + } + + /** + * The disable_login_with_didit field. + * + * @param disableLoginWithDidit the value + * @return this builder + */ + public Builder disableLoginWithDidit(boolean disableLoginWithDidit) { + return set("disable_login_with_didit", Conv.BOOLEAN, disableLoginWithDidit); + } + + /** + * The hide_progress_bar field. + * + * @param hideProgressBar the value + * @return this builder + */ + public Builder hideProgressBar(boolean hideProgressBar) { + return set("hide_progress_bar", Conv.BOOLEAN, hideProgressBar); + } + + /** + * The callback_seconds field. + * + * @param callbackSeconds the value + * @return this builder + */ + public Builder callbackSeconds(long callbackSeconds) { + return set("callback_seconds", Conv.LONG, callbackSeconds); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BrandingCustomization} + */ + public BrandingCustomization build() { + return new BrandingCustomization(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BrandingCustomizationUpdate.java b/src/main/java/me/didit/types/BrandingCustomizationUpdate.java new file mode 100644 index 0000000..bf68691 --- /dev/null +++ b/src/main/java/me/didit/types/BrandingCustomizationUpdate.java @@ -0,0 +1,602 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Partial branding update body. Provide only the fields you want to change. Hex colors accept #RRGGBB or #RRGGBBAA. Custom domain and white-label email are not accepted here. + */ +public final class BrandingCustomizationUpdate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("color_primary", "color_secondary", "color_background", "color_panel", "color_panel_10", "color_on_panel_1", "color_on_panel_2", "color_on_background", "color_button_1", "color_button_2", "color_button_text_1", "color_button_text_2", "color_pill_text", "border_radius_panel", "border_radius_buttons", "font_family", "font_weight", "app_public_name", "privacy_policy_url", "skip_welcome_screen", "disable_login_with_didit", "hide_progress_bar", "callback_seconds", "delete_logo_square", "delete_logo_rectangular", "delete_favicon"); + + private BrandingCustomizationUpdate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BrandingCustomizationUpdate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BrandingCustomizationUpdate fromJson(JsonNode json) { + return new BrandingCustomizationUpdate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Headers / primary text color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPrimary() { + return Json.optional(json, "color_primary", Conv.STRING); + } + + /** + * Paragraph / secondary text color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorSecondary() { + return Json.optional(json, "color_secondary", Conv.STRING); + } + + /** + * Page background color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorBackground() { + return Json.optional(json, "color_background", Conv.STRING); + } + + /** + * Panel / accent color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPanel() { + return Json.optional(json, "color_panel", Conv.STRING); + } + + /** + * Panel color at 10% opacity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPanel10() { + return Json.optional(json, "color_panel_10", Conv.STRING); + } + + /** + * Support text color on panels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorOnPanel1() { + return Json.optional(json, "color_on_panel_1", Conv.STRING); + } + + /** + * Pill / badge color on panels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorOnPanel2() { + return Json.optional(json, "color_on_panel_2", Conv.STRING); + } + + /** + * Text color on background. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorOnBackground() { + return Json.optional(json, "color_on_background", Conv.STRING); + } + + /** + * Primary button color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButton1() { + return Json.optional(json, "color_button_1", Conv.STRING); + } + + /** + * Secondary button color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButton2() { + return Json.optional(json, "color_button_2", Conv.STRING); + } + + /** + * Primary button text color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButtonText1() { + return Json.optional(json, "color_button_text_1", Conv.STRING); + } + + /** + * Secondary button text color. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorButtonText2() { + return Json.optional(json, "color_button_text_2", Conv.STRING); + } + + /** + * Text color for pills, inputs and selectors. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional colorPillText() { + return Json.optional(json, "color_pill_text", Conv.STRING); + } + + /** + * Panel corner radius in pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional borderRadiusPanel() { + return Json.optional(json, "border_radius_panel", Conv.LONG); + } + + /** + * Button corner radius in pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional borderRadiusButtons() { + return Json.optional(json, "border_radius_buttons", Conv.LONG); + } + + /** + * Google Font family name (e.g. Inter, AR One Sans). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fontFamily() { + return Json.optional(json, "font_family", Conv.STRING); + } + + /** + * Font weight available for the selected family (e.g. regular, 500, 700). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fontWeight() { + return Json.optional(json, "font_weight", Conv.STRING); + } + + /** + * Public name shown in the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appPublicName() { + return Json.optional(json, "app_public_name", Conv.STRING); + } + + /** + * Privacy policy URL shown to the end user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional privacyPolicyUrl() { + return Json.optional(json, "privacy_policy_url", Conv.STRING); + } + + /** + * Skip the initial welcome screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skipWelcomeScreen() { + return Json.optional(json, "skip_welcome_screen", Conv.BOOLEAN); + } + + /** + * Continue as guest instead of showing the login-with-Didit screen. Cannot be set back to false while a custom domain is configured (400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disableLoginWithDidit() { + return Json.optional(json, "disable_login_with_didit", Conv.BOOLEAN); + } + + /** + * Hide the progress bar during the flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hideProgressBar() { + return Json.optional(json, "hide_progress_bar", Conv.BOOLEAN); + } + + /** + * Delay (seconds) before redirecting to the callback URL. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callbackSeconds() { + return Json.optional(json, "callback_seconds", Conv.LONG); + } + + /** + * When true, removes the current square logo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteLogoSquare() { + return Json.optional(json, "delete_logo_square", Conv.BOOLEAN); + } + + /** + * When true, removes the current rectangular logo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteLogoRectangular() { + return Json.optional(json, "delete_logo_rectangular", Conv.BOOLEAN); + } + + /** + * When true, removes the current favicon. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteFavicon() { + return Json.optional(json, "delete_favicon", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BrandingCustomizationUpdate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BrandingCustomizationUpdate from) { + super(from); + } + + /** + * Headers / primary text color. + * + * @param colorPrimary the value + * @return this builder + */ + public Builder colorPrimary(String colorPrimary) { + return set("color_primary", Conv.STRING, colorPrimary); + } + + /** + * Paragraph / secondary text color. + * + * @param colorSecondary the value + * @return this builder + */ + public Builder colorSecondary(String colorSecondary) { + return set("color_secondary", Conv.STRING, colorSecondary); + } + + /** + * Page background color. + * + * @param colorBackground the value + * @return this builder + */ + public Builder colorBackground(String colorBackground) { + return set("color_background", Conv.STRING, colorBackground); + } + + /** + * Panel / accent color. + * + * @param colorPanel the value + * @return this builder + */ + public Builder colorPanel(String colorPanel) { + return set("color_panel", Conv.STRING, colorPanel); + } + + /** + * Panel color at 10% opacity. + * + * @param colorPanel10 the value + * @return this builder + */ + public Builder colorPanel10(String colorPanel10) { + return set("color_panel_10", Conv.STRING, colorPanel10); + } + + /** + * Support text color on panels. + * + * @param colorOnPanel1 the value + * @return this builder + */ + public Builder colorOnPanel1(String colorOnPanel1) { + return set("color_on_panel_1", Conv.STRING, colorOnPanel1); + } + + /** + * Pill / badge color on panels. + * + * @param colorOnPanel2 the value + * @return this builder + */ + public Builder colorOnPanel2(String colorOnPanel2) { + return set("color_on_panel_2", Conv.STRING, colorOnPanel2); + } + + /** + * Text color on background. + * + * @param colorOnBackground the value + * @return this builder + */ + public Builder colorOnBackground(String colorOnBackground) { + return set("color_on_background", Conv.STRING, colorOnBackground); + } + + /** + * Primary button color. + * + * @param colorButton1 the value + * @return this builder + */ + public Builder colorButton1(String colorButton1) { + return set("color_button_1", Conv.STRING, colorButton1); + } + + /** + * Secondary button color. + * + * @param colorButton2 the value + * @return this builder + */ + public Builder colorButton2(String colorButton2) { + return set("color_button_2", Conv.STRING, colorButton2); + } + + /** + * Primary button text color. + * + * @param colorButtonText1 the value + * @return this builder + */ + public Builder colorButtonText1(String colorButtonText1) { + return set("color_button_text_1", Conv.STRING, colorButtonText1); + } + + /** + * Secondary button text color. + * + * @param colorButtonText2 the value + * @return this builder + */ + public Builder colorButtonText2(String colorButtonText2) { + return set("color_button_text_2", Conv.STRING, colorButtonText2); + } + + /** + * Text color for pills, inputs and selectors. + * + * @param colorPillText the value + * @return this builder + */ + public Builder colorPillText(String colorPillText) { + return set("color_pill_text", Conv.STRING, colorPillText); + } + + /** + * Panel corner radius in pixels. + * + * @param borderRadiusPanel the value + * @return this builder + */ + public Builder borderRadiusPanel(long borderRadiusPanel) { + return set("border_radius_panel", Conv.LONG, borderRadiusPanel); + } + + /** + * Button corner radius in pixels. + * + * @param borderRadiusButtons the value + * @return this builder + */ + public Builder borderRadiusButtons(long borderRadiusButtons) { + return set("border_radius_buttons", Conv.LONG, borderRadiusButtons); + } + + /** + * Google Font family name (e.g. Inter, AR One Sans). + * + * @param fontFamily the value + * @return this builder + */ + public Builder fontFamily(String fontFamily) { + return set("font_family", Conv.STRING, fontFamily); + } + + /** + * Font weight available for the selected family (e.g. regular, 500, 700). + * + * @param fontWeight the value + * @return this builder + */ + public Builder fontWeight(String fontWeight) { + return set("font_weight", Conv.STRING, fontWeight); + } + + /** + * Public name shown in the verification flow. + * + * @param appPublicName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appPublicName(@Nullable String appPublicName) { + return setNullable("app_public_name", Conv.STRING, appPublicName); + } + + /** + * Privacy policy URL shown to the end user. + * + * @param privacyPolicyUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder privacyPolicyUrl(@Nullable String privacyPolicyUrl) { + return setNullable("privacy_policy_url", Conv.STRING, privacyPolicyUrl); + } + + /** + * Skip the initial welcome screen. + * + * @param skipWelcomeScreen the value + * @return this builder + */ + public Builder skipWelcomeScreen(boolean skipWelcomeScreen) { + return set("skip_welcome_screen", Conv.BOOLEAN, skipWelcomeScreen); + } + + /** + * Continue as guest instead of showing the login-with-Didit screen. Cannot be set back to false while a custom domain is configured (400). + * + * @param disableLoginWithDidit the value + * @return this builder + */ + public Builder disableLoginWithDidit(boolean disableLoginWithDidit) { + return set("disable_login_with_didit", Conv.BOOLEAN, disableLoginWithDidit); + } + + /** + * Hide the progress bar during the flow. + * + * @param hideProgressBar the value + * @return this builder + */ + public Builder hideProgressBar(boolean hideProgressBar) { + return set("hide_progress_bar", Conv.BOOLEAN, hideProgressBar); + } + + /** + * Delay (seconds) before redirecting to the callback URL. + * + * @param callbackSeconds the value + * @return this builder + */ + public Builder callbackSeconds(long callbackSeconds) { + return set("callback_seconds", Conv.LONG, callbackSeconds); + } + + /** + * When true, removes the current square logo. + * + * @param deleteLogoSquare the value + * @return this builder + */ + public Builder deleteLogoSquare(boolean deleteLogoSquare) { + return set("delete_logo_square", Conv.BOOLEAN, deleteLogoSquare); + } + + /** + * When true, removes the current rectangular logo. + * + * @param deleteLogoRectangular the value + * @return this builder + */ + public Builder deleteLogoRectangular(boolean deleteLogoRectangular) { + return set("delete_logo_rectangular", Conv.BOOLEAN, deleteLogoRectangular); + } + + /** + * When true, removes the current favicon. + * + * @param deleteFavicon the value + * @return this builder + */ + public Builder deleteFavicon(boolean deleteFavicon) { + return set("delete_favicon", Conv.BOOLEAN, deleteFavicon); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BrandingCustomizationUpdate} + */ + public BrandingCustomizationUpdate build() { + return new BrandingCustomizationUpdate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessDetailItem.java b/src/main/java/me/didit/types/BusinessDetailItem.java new file mode 100644 index 0000000..119ce1a --- /dev/null +++ b/src/main/java/me/didit/types/BusinessDetailItem.java @@ -0,0 +1,501 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Full business detail. Extends BusinessListItem with metadata and updated_at. */ +public final class BusinessDetailItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "display_name", "legal_name", "registration_number", "country_code", "effective_name", "status", "session_count", "approved_count", "declined_count", "in_review_count", "features", "features_list", "last_session_at", "first_session_at", "last_activity_at", "tags", "created_at", "metadata", "updated_at"); + + private BusinessDetailItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessDetailItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessDetailItem fromJson(JsonNode json) { + return new BusinessDetailItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's stable internal UUID for this business. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your unique identifier for this business (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Custom display name set by you + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Official legal name from registry or manual entry + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalName() { + return Json.optional(json, "legal_name", Conv.STRING); + } + + /** + * Company registration or incorporation number + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Best available name: display_name if set, otherwise legal_name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveName() { + return Json.optional(json, "effective_name", Conv.STRING); + } + + /** + * Lifecycle status of the business record (NOT a session status). ACTIVE is the default, FLAGGED marks it for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessListItem.Status::of)); + } + + /** + * Total number of verification sessions for this business + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionCount() { + return Json.optional(json, "session_count", Conv.LONG); + } + + /** + * Number of approved sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approvedCount() { + return Json.optional(json, "approved_count", Conv.LONG); + } + + /** + * Number of declined sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declinedCount() { + return Json.optional(json, "declined_count", Conv.LONG); + } + + /** + * Number of sessions in review + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inReviewCount() { + return Json.optional(json, "in_review_count", Conv.LONG); + } + + /** + * Aggregated per-feature status across all of this business's KYB sessions. Currently the only key is KYB (the registry company check status). Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.OBJECT); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> featuresList() { + return Json.optional(json, "features_list", Conv.list(Conv.model(BusinessListItem.FeaturesList::fromJson))); + } + + /** + * Timestamp of the most recent session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSessionAt() { + return Json.optional(json, "last_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the first session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSessionAt() { + return Json.optional(json, "first_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the most recent activity (status change, session update, etc.) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastActivityAt() { + return Json.optional(json, "last_activity_at", Conv.DATE_TIME); + } + + /** + * Tags assigned to this business + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(BusinessListItem.Tags::fromJson))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * Custom metadata JSON you attached to this business. Defaults to {}. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessDetailItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessDetailItem from) { + super(from); + } + + /** + * Didit's stable internal UUID for this business. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your unique identifier for this business (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Custom display name set by you + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Official legal name from registry or manual entry + * + * @param legalName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalName(@Nullable String legalName) { + return setNullable("legal_name", Conv.STRING, legalName); + } + + /** + * Company registration or incorporation number + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Best available name: display_name if set, otherwise legal_name + * + * @param effectiveName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveName(@Nullable String effectiveName) { + return setNullable("effective_name", Conv.STRING, effectiveName); + } + + /** + * Lifecycle status of the business record (NOT a session status). ACTIVE is the default, FLAGGED marks it for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessListItem.Status status) { + return set("status", Conv.enumeration(BusinessListItem.Status::of), status); + } + + /** + * Total number of verification sessions for this business + * + * @param sessionCount the value + * @return this builder + */ + public Builder sessionCount(long sessionCount) { + return set("session_count", Conv.LONG, sessionCount); + } + + /** + * Number of approved sessions + * + * @param approvedCount the value + * @return this builder + */ + public Builder approvedCount(long approvedCount) { + return set("approved_count", Conv.LONG, approvedCount); + } + + /** + * Number of declined sessions + * + * @param declinedCount the value + * @return this builder + */ + public Builder declinedCount(long declinedCount) { + return set("declined_count", Conv.LONG, declinedCount); + } + + /** + * Number of sessions in review + * + * @param inReviewCount the value + * @return this builder + */ + public Builder inReviewCount(long inReviewCount) { + return set("in_review_count", Conv.LONG, inReviewCount); + } + + /** + * Aggregated per-feature status across all of this business's KYB sessions. Currently the only key is KYB (the registry company check status). Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @param features the value + * @return this builder + */ + public Builder features(Map features) { + return setAny("features", features); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @param featuresList the value + * @return this builder + */ + public Builder featuresList(List featuresList) { + return set("features_list", Conv.list(Conv.model(BusinessListItem.FeaturesList::fromJson)), featuresList); + } + + /** + * Timestamp of the most recent session + * + * @param lastSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSessionAt(@Nullable OffsetDateTime lastSessionAt) { + return setNullable("last_session_at", Conv.DATE_TIME, lastSessionAt); + } + + /** + * Timestamp of the first session + * + * @param firstSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSessionAt(@Nullable OffsetDateTime firstSessionAt) { + return setNullable("first_session_at", Conv.DATE_TIME, firstSessionAt); + } + + /** + * Timestamp of the most recent activity (status change, session update, etc.) + * + * @param lastActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastActivityAt(@Nullable OffsetDateTime lastActivityAt) { + return setNullable("last_activity_at", Conv.DATE_TIME, lastActivityAt); + } + + /** + * Tags assigned to this business + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(BusinessListItem.Tags::fromJson)), tags); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Custom metadata JSON you attached to this business. Defaults to {}. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessDetailItem} + */ + public BusinessDetailItem build() { + return new BusinessDetailItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessListItem.java b/src/main/java/me/didit/types/BusinessListItem.java new file mode 100644 index 0000000..e766077 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessListItem.java @@ -0,0 +1,738 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** A verified business. */ +public final class BusinessListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "display_name", "legal_name", "registration_number", "country_code", "effective_name", "status", "session_count", "approved_count", "declined_count", "in_review_count", "features", "features_list", "last_session_at", "first_session_at", "last_activity_at", "tags", "created_at"); + + private BusinessListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessListItem fromJson(JsonNode json) { + return new BusinessListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's stable internal UUID for this business. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your unique identifier for this business (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Custom display name set by you + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Official legal name from registry or manual entry + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalName() { + return Json.optional(json, "legal_name", Conv.STRING); + } + + /** + * Company registration or incorporation number + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Best available name: display_name if set, otherwise legal_name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveName() { + return Json.optional(json, "effective_name", Conv.STRING); + } + + /** + * Lifecycle status of the business record (NOT a session status). ACTIVE is the default, FLAGGED marks it for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessListItem.Status::of)); + } + + /** + * Total number of verification sessions for this business + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionCount() { + return Json.optional(json, "session_count", Conv.LONG); + } + + /** + * Number of approved sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approvedCount() { + return Json.optional(json, "approved_count", Conv.LONG); + } + + /** + * Number of declined sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declinedCount() { + return Json.optional(json, "declined_count", Conv.LONG); + } + + /** + * Number of sessions in review + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inReviewCount() { + return Json.optional(json, "in_review_count", Conv.LONG); + } + + /** + * Aggregated per-feature status across all of this business's KYB sessions. Currently the only key is KYB (the registry company check status). Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.OBJECT); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> featuresList() { + return Json.optional(json, "features_list", Conv.list(Conv.model(BusinessListItem.FeaturesList::fromJson))); + } + + /** + * Timestamp of the most recent session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSessionAt() { + return Json.optional(json, "last_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the first session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSessionAt() { + return Json.optional(json, "first_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the most recent activity (status change, session update, etc.) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastActivityAt() { + return Json.optional(json, "last_activity_at", Conv.DATE_TIME); + } + + /** + * Tags assigned to this business + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(BusinessListItem.Tags::fromJson))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessListItem from) { + super(from); + } + + /** + * Didit's stable internal UUID for this business. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your unique identifier for this business (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Custom display name set by you + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Official legal name from registry or manual entry + * + * @param legalName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalName(@Nullable String legalName) { + return setNullable("legal_name", Conv.STRING, legalName); + } + + /** + * Company registration or incorporation number + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Best available name: display_name if set, otherwise legal_name + * + * @param effectiveName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveName(@Nullable String effectiveName) { + return setNullable("effective_name", Conv.STRING, effectiveName); + } + + /** + * Lifecycle status of the business record (NOT a session status). ACTIVE is the default, FLAGGED marks it for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessListItem.Status status) { + return set("status", Conv.enumeration(BusinessListItem.Status::of), status); + } + + /** + * Total number of verification sessions for this business + * + * @param sessionCount the value + * @return this builder + */ + public Builder sessionCount(long sessionCount) { + return set("session_count", Conv.LONG, sessionCount); + } + + /** + * Number of approved sessions + * + * @param approvedCount the value + * @return this builder + */ + public Builder approvedCount(long approvedCount) { + return set("approved_count", Conv.LONG, approvedCount); + } + + /** + * Number of declined sessions + * + * @param declinedCount the value + * @return this builder + */ + public Builder declinedCount(long declinedCount) { + return set("declined_count", Conv.LONG, declinedCount); + } + + /** + * Number of sessions in review + * + * @param inReviewCount the value + * @return this builder + */ + public Builder inReviewCount(long inReviewCount) { + return set("in_review_count", Conv.LONG, inReviewCount); + } + + /** + * Aggregated per-feature status across all of this business's KYB sessions. Currently the only key is KYB (the registry company check status). Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @param features the value + * @return this builder + */ + public Builder features(Map features) { + return setAny("features", features); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @param featuresList the value + * @return this builder + */ + public Builder featuresList(List featuresList) { + return set("features_list", Conv.list(Conv.model(BusinessListItem.FeaturesList::fromJson)), featuresList); + } + + /** + * Timestamp of the most recent session + * + * @param lastSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSessionAt(@Nullable OffsetDateTime lastSessionAt) { + return setNullable("last_session_at", Conv.DATE_TIME, lastSessionAt); + } + + /** + * Timestamp of the first session + * + * @param firstSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSessionAt(@Nullable OffsetDateTime firstSessionAt) { + return setNullable("first_session_at", Conv.DATE_TIME, firstSessionAt); + } + + /** + * Timestamp of the most recent activity (status change, session update, etc.) + * + * @param lastActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastActivityAt(@Nullable OffsetDateTime lastActivityAt) { + return setNullable("last_activity_at", Conv.DATE_TIME, lastActivityAt); + } + + /** + * Tags assigned to this business + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(BusinessListItem.Tags::fromJson)), tags); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessListItem} + */ + public BusinessListItem build() { + return new BusinessListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Lifecycle status of the business record (NOT a session status). ACTIVE is the default, FLAGGED marks it for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class FeaturesList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "status"); + + private FeaturesList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FeaturesList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FeaturesList fromJson(JsonNode json) { + return new FeaturesList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FeaturesList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FeaturesList from) { + super(from); + } + + /** + * The feature field. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FeaturesList} + */ + public FeaturesList build() { + return new FeaturesList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Tags extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "color"); + + private Tags(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tags} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tags fromJson(JsonNode json) { + return new Tags(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The color field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional color() { + return Json.optional(json, "color", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tags}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tags from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The color field. + * + * @param color the value + * @return this builder + */ + public Builder color(String color) { + return set("color", Conv.STRING, color); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tags} + */ + public Tags build() { + return new Tags(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/BusinessSessionsListNetworksResponse.java b/src/main/java/me/didit/types/BusinessSessionsListNetworksResponse.java new file mode 100644 index 0000000..f721f55 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessSessionsListNetworksResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class BusinessSessionsListNetworksResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private BusinessSessionsListNetworksResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessSessionsListNetworksResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessSessionsListNetworksResponse fromJson(JsonNode json) { + return new BusinessSessionsListNetworksResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(EntityNetworkMembership::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessSessionsListNetworksResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessSessionsListNetworksResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(EntityNetworkMembership::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessSessionsListNetworksResponse} + */ + public BusinessSessionsListNetworksResponse build() { + return new BusinessSessionsListNetworksResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesBatchDeleteParams.java b/src/main/java/me/didit/types/BusinessesBatchDeleteParams.java new file mode 100644 index 0000000..260a34d --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesBatchDeleteParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code businesses.batch_delete}. */ +public final class BusinessesBatchDeleteParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data_list", "didit_internal_id_list", "delete_all"); + + private BusinessesBatchDeleteParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesBatchDeleteParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesBatchDeleteParams fromJson(JsonNode json) { + return new BusinessesBatchDeleteParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own identifiers to delete, matched exactly as sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> vendorDataList() { + return Json.optional(json, "vendor_data_list", Conv.list(Conv.STRING)); + } + + /** + * Didit's internal UUIDs (didit_internal_id) to delete. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> diditInternalIdList() { + return Json.optional(json, "didit_internal_id_list", Conv.list(Conv.STRING)); + } + + /** + * If true, deletes every business in the application. Cannot be combined with the list selectors. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteAll() { + return Json.optional(json, "delete_all", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesBatchDeleteParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesBatchDeleteParams from) { + super(from); + } + + /** + * Your own identifiers to delete, matched exactly as sent. + * + * @param vendorDataList the value + * @return this builder + */ + public Builder vendorDataList(List vendorDataList) { + return set("vendor_data_list", Conv.list(Conv.STRING), vendorDataList); + } + + /** + * Didit's internal UUIDs (didit_internal_id) to delete. + * + * @param diditInternalIdList the value + * @return this builder + */ + public Builder diditInternalIdList(List diditInternalIdList) { + return set("didit_internal_id_list", Conv.list(Conv.STRING), diditInternalIdList); + } + + /** + * If true, deletes every business in the application. Cannot be combined with the list selectors. + * + * @param deleteAll the value + * @return this builder + */ + public Builder deleteAll(boolean deleteAll) { + return set("delete_all", Conv.BOOLEAN, deleteAll); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesBatchDeleteParams} + */ + public BusinessesBatchDeleteParams build() { + return new BusinessesBatchDeleteParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesBatchDeleteResponse.java b/src/main/java/me/didit/types/BusinessesBatchDeleteResponse.java new file mode 100644 index 0000000..d47539a --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesBatchDeleteResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class BusinessesBatchDeleteResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("deleted"); + + private BusinessesBatchDeleteResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesBatchDeleteResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesBatchDeleteResponse fromJson(JsonNode json) { + return new BusinessesBatchDeleteResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of businesses deleted (excludes vendor_data values that didn't match anything). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleted() { + return Json.optional(json, "deleted", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesBatchDeleteResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesBatchDeleteResponse from) { + super(from); + } + + /** + * Number of businesses deleted (excludes vendor_data values that didn't match anything). + * + * @param deleted the value + * @return this builder + */ + public Builder deleted(long deleted) { + return set("deleted", Conv.LONG, deleted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesBatchDeleteResponse} + */ + public BusinessesBatchDeleteResponse build() { + return new BusinessesBatchDeleteResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesCreateParams.java b/src/main/java/me/didit/types/BusinessesCreateParams.java new file mode 100644 index 0000000..a95e5a5 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesCreateParams.java @@ -0,0 +1,267 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code businesses.create}. */ +public final class BusinessesCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "display_name", "legal_name", "registration_number", "country_code", "status", "metadata"); + + private BusinessesCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesCreateParams fromJson(JsonNode json) { + return new BusinessesCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your unique identifier for this business (free-form string, NOT a UUID). Optional but strongly recommended. When provided, must be unique among non-deleted businesses for the application; matched exactly as sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Friendly display name shown in the console (takes precedence over legal_name for UI display). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Official legal name of the company. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalName() { + return Json.optional(json, "legal_name", Conv.STRING); + } + + /** + * Company registration or incorporation number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Initial lifecycle status. Defaults to ACTIVE. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesCreateParams.Status::of)); + } + + /** + * Arbitrary JSON object you attach to the business. Defaults to {}. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesCreateParams from) { + super(from); + } + + /** + * Your unique identifier for this business (free-form string, NOT a UUID). Optional but strongly recommended. When provided, must be unique among non-deleted businesses for the application; matched exactly as sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Friendly display name shown in the console (takes precedence over legal_name for UI display). + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Official legal name of the company. + * + * @param legalName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalName(@Nullable String legalName) { + return setNullable("legal_name", Conv.STRING, legalName); + } + + /** + * Company registration or incorporation number. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Initial lifecycle status. Defaults to ACTIVE. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesCreateParams.Status status) { + return set("status", Conv.enumeration(BusinessesCreateParams.Status::of), status); + } + + /** + * Arbitrary JSON object you attach to the business. Defaults to {}. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesCreateParams} + */ + public BusinessesCreateParams build() { + return new BusinessesCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Initial lifecycle status. Defaults to ACTIVE. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesListNetworksResponse.java b/src/main/java/me/didit/types/BusinessesListNetworksResponse.java new file mode 100644 index 0000000..6d8793f --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesListNetworksResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class BusinessesListNetworksResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private BusinessesListNetworksResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesListNetworksResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesListNetworksResponse fromJson(JsonNode json) { + return new BusinessesListNetworksResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(EntityNetworkMembership::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesListNetworksResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesListNetworksResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(EntityNetworkMembership::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesListNetworksResponse} + */ + public BusinessesListNetworksResponse build() { + return new BusinessesListNetworksResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesListParams.java b/src/main/java/me/didit/types/BusinessesListParams.java new file mode 100644 index 0000000..146fd27 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code businesses.list}. */ +public final class BusinessesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private BusinessesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesListParams fromJson(JsonNode json) { + return new BusinessesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages small for latency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset of the first record to return. Prefer following the next URL from the previous page over computing this by hand. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesListParams from) { + super(from); + } + + /** + * Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages small for latency. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset of the first record to return. Prefer following the next URL from the previous page over computing this by hand. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesListParams} + */ + public BusinessesListParams build() { + return new BusinessesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesListResponse.java b/src/main/java/me/didit/types/BusinessesListResponse.java new file mode 100644 index 0000000..afc39ed --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class BusinessesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private BusinessesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesListResponse fromJson(JsonNode json) { + return new BusinessesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows โ€” exact up to 100, capped at 100 beyond that for performance. Do not use it to detect the last page; rely on next being null instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(BusinessListItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesListResponse from) { + super(from); + } + + /** + * Number of matching rows โ€” exact up to 100, capped at 100 beyond that for performance. Do not use it to detect the last page; rely on next being null instead. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(BusinessListItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesListResponse} + */ + public BusinessesListResponse build() { + return new BusinessesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesRetrieveOngoingMonitoringJobResponse.java b/src/main/java/me/didit/types/BusinessesRetrieveOngoingMonitoringJobResponse.java new file mode 100644 index 0000000..d1bde79 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesRetrieveOngoingMonitoringJobResponse.java @@ -0,0 +1,782 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class BusinessesRetrieveOngoingMonitoringJobResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private BusinessesRetrieveOngoingMonitoringJobResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesRetrieveOngoingMonitoringJobResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesRetrieveOngoingMonitoringJobResponse fromJson(JsonNode json) { + return new BusinessesRetrieveOngoingMonitoringJobResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesRetrieveOngoingMonitoringJobResponse.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesRetrieveOngoingMonitoringJobResponse.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesRetrieveOngoingMonitoringJobResponse.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesRetrieveOngoingMonitoringJobResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesRetrieveOngoingMonitoringJobResponse from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesRetrieveOngoingMonitoringJobResponse.Status status) { + return set("status", Conv.enumeration(BusinessesRetrieveOngoingMonitoringJobResponse.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesRetrieveOngoingMonitoringJobResponse.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesRetrieveOngoingMonitoringJobResponse.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesRetrieveOngoingMonitoringJobResponse.Estimate estimate) { + return set("estimate", Conv.model(BusinessesRetrieveOngoingMonitoringJobResponse.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesRetrieveOngoingMonitoringJobResponse} + */ + public BusinessesRetrieveOngoingMonitoringJobResponse build() { + return new BusinessesRetrieveOngoingMonitoringJobResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesRetrieveSessionOngoingMonitoringJobResponse.java b/src/main/java/me/didit/types/BusinessesRetrieveSessionOngoingMonitoringJobResponse.java new file mode 100644 index 0000000..ee2218b --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesRetrieveSessionOngoingMonitoringJobResponse.java @@ -0,0 +1,782 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class BusinessesRetrieveSessionOngoingMonitoringJobResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private BusinessesRetrieveSessionOngoingMonitoringJobResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesRetrieveSessionOngoingMonitoringJobResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesRetrieveSessionOngoingMonitoringJobResponse fromJson(JsonNode json) { + return new BusinessesRetrieveSessionOngoingMonitoringJobResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesRetrieveSessionOngoingMonitoringJobResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesRetrieveSessionOngoingMonitoringJobResponse from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Status status) { + return set("status", Conv.enumeration(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Estimate estimate) { + return set("estimate", Conv.model(BusinessesRetrieveSessionOngoingMonitoringJobResponse.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesRetrieveSessionOngoingMonitoringJobResponse} + */ + public BusinessesRetrieveSessionOngoingMonitoringJobResponse build() { + return new BusinessesRetrieveSessionOngoingMonitoringJobResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesSetAmlMonitoringParams.java b/src/main/java/me/didit/types/BusinessesSetAmlMonitoringParams.java new file mode 100644 index 0000000..d81d803 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesSetAmlMonitoringParams.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code businesses.set_aml_monitoring}. */ +public final class BusinessesSetAmlMonitoringParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "estimate_only", "vendor_data_list", "didit_internal_id_list"); + + private BusinessesSetAmlMonitoringParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesSetAmlMonitoringParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesSetAmlMonitoringParams fromJson(JsonNode json) { + return new BusinessesSetAmlMonitoringParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * true to enable monitoring, false to disable it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * When true, returns the cost estimate and performs no writes - no screening, no billing, no job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimateOnly() { + return Json.optional(json, "estimate_only", Conv.BOOLEAN); + } + + /** + * Your own identifiers of the businesses to toggle, matched exactly as sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> vendorDataList() { + return Json.optional(json, "vendor_data_list", Conv.list(Conv.STRING)); + } + + /** + * Didit internal ids of the businesses to toggle - the didit_internal_id returned by the create, get and list endpoints. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> diditInternalIdList() { + return Json.optional(json, "didit_internal_id_list", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesSetAmlMonitoringParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesSetAmlMonitoringParams from) { + super(from); + } + + /** + * true to enable monitoring, false to disable it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * When true, returns the cost estimate and performs no writes - no screening, no billing, no job. + * + * @param estimateOnly the value + * @return this builder + */ + public Builder estimateOnly(boolean estimateOnly) { + return set("estimate_only", Conv.BOOLEAN, estimateOnly); + } + + /** + * Your own identifiers of the businesses to toggle, matched exactly as sent. + * + * @param vendorDataList the value + * @return this builder + */ + public Builder vendorDataList(List vendorDataList) { + return set("vendor_data_list", Conv.list(Conv.STRING), vendorDataList); + } + + /** + * Didit internal ids of the businesses to toggle - the didit_internal_id returned by the create, get and list endpoints. + * + * @param diditInternalIdList the value + * @return this builder + */ + public Builder diditInternalIdList(List diditInternalIdList) { + return set("didit_internal_id_list", Conv.list(Conv.STRING), diditInternalIdList); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesSetAmlMonitoringParams} + * @throws IllegalStateException when a required field is missing + */ + public BusinessesSetAmlMonitoringParams build() { + require("is_enabled", false); + return new BusinessesSetAmlMonitoringParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesSetAmlMonitoringResponse.java b/src/main/java/me/didit/types/BusinessesSetAmlMonitoringResponse.java new file mode 100644 index 0000000..94c1114 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesSetAmlMonitoringResponse.java @@ -0,0 +1,2650 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Response of {@code businesses.set_aml_monitoring}; the shape depends on the HTTP status. + */ +public final class BusinessesSetAmlMonitoringResponse extends MultiStatusResponse { + private BusinessesSetAmlMonitoringResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static BusinessesSetAmlMonitoringResponse fromResponse(int statusCode, JsonNode json) { + return new BusinessesSetAmlMonitoringResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.union(BusinessesSetAmlMonitoringResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 202. + * + * @return true for status 202 + */ + public boolean isAccepted() { + return statusCode() == 202; + } + + /** + * The body of a 202 response. + * + * @return the body, or empty for another status + */ + public Optional asAccepted() { + return isAccepted() ? Optional.of(Conv.model(BusinessesSetAmlMonitoringResponse.Accepted::fromJson).read(json)) : Optional.empty(); + } + + /** + * + *

One of: {@code CostPreview}, {@code Variant2}. Check with the {@code is...} + * methods and read with the {@code as...} methods; the fields every variant has are readable directly. + */ + public static final class Ok extends JsonUnion { + private Ok(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Ok} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Ok fromJson(JsonNode json) { + return new Ok(json.deepCopy()); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unmatched() { + return Json.required(json, "unmatched", Conv.list(Conv.STRING)); + } + + /** + * Wraps a {@code CostPreview} value. + * + * @param value the value + * @return the union + */ + public static Ok ofCostPreview(BusinessesSetAmlMonitoringResponse.Ok.CostPreview value) { + return new Ok(Conv.model(BusinessesSetAmlMonitoringResponse.Ok.CostPreview::fromJson).write(value)); + } + + /** + * Whether this value is a {@code CostPreview}. + * + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @return true when it matches + */ + public boolean isCostPreview() { + return Json.hasFields(json, "users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient", "unmatched"); + } + + /** + * Reads this value as a {@code CostPreview}. + * + * @return the value, or empty when {@link #isCostPreview()} is false + */ + public Optional asCostPreview() { + return isCostPreview() ? Optional.of(Conv.model(BusinessesSetAmlMonitoringResponse.Ok.CostPreview::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static Ok ofVariant2(BusinessesSetAmlMonitoringResponse.Ok.Variant2 value) { + return new Ok(Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * @return true when it matches + */ + public boolean isVariant2() { + return Json.hasFields(json, "job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at", "estimate", "unmatched"); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional asVariant2() { + return isVariant2() ? Optional.of(Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2::fromJson).read(json)) : Optional.empty(); + } + + /** Cost preview. Returned directly when estimate_only is true (nothing is written). */ + public static final class CostPreview extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient", "unmatched"); + + private CostPreview(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CostPreview} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CostPreview fromJson(JsonNode json) { + return new CostPreview(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profiles matched by the selection. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long usersTotal() { + return Json.required(json, "users_total", Conv.LONG); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long alreadyEnabled() { + return Json.required(json, "already_enabled", Conv.LONG); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long withExistingAml() { + return Json.required(json, "with_existing_aml", Conv.LONG); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long needingScreening() { + return Json.required(json, "needing_screening", Conv.LONG); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long skippedNoIdentityData() { + return Json.required(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long skippedBlocked() { + return Json.required(json, "skipped_blocked", Conv.LONG); + } + + /** + * One-time cost of the new screenings. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double estimatedScreeningCostUsd() { + return Json.required(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double estimatedAnnualMonitoringCostUsd() { + return Json.required(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean balanceSufficient() { + return Json.required(json, "balance_sufficient", Conv.BOOLEAN); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unmatched() { + return Json.required(json, "unmatched", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CostPreview}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CostPreview from) { + super(from); + } + + /** + * Profiles matched by the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * One-time cost of the new screenings. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. + * + * @param unmatched the value + * @return this builder + */ + public Builder unmatched(List unmatched) { + return set("unmatched", Conv.list(Conv.STRING), unmatched); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CostPreview} + * @throws IllegalStateException when a required field is missing + */ + public CostPreview build() { + require("users_total", false); + require("already_enabled", false); + require("with_existing_aml", false); + require("needing_screening", false); + require("skipped_no_identity_data", false); + require("skipped_blocked", false); + require("estimated_screening_cost_usd", false); + require("estimated_annual_monitoring_cost_usd", false); + require("balance_sufficient", false); + require("unmatched", false); + return new CostPreview(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Variant2 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at", "estimate", "unmatched"); + + private Variant2(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant2} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant2 fromJson(JsonNode json) { + return new Variant2(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String jobId() { + return Json.required(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public BusinessesSetAmlMonitoringResponse.Ok.Variant2.Status status() { + return Json.required(json, "status", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Status::of)); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * Which profile family the job toggles. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public BusinessesSetAmlMonitoringResponse.Ok.Variant2.TargetType targetType() { + return Json.required(json, "target_type", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Ok.Variant2.TargetType::of)); + } + + /** + * Profiles the job processes. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long total() { + return Json.required(json, "total", Conv.LONG); + } + + /** + * Profiles processed so far. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long processed() { + return Json.required(json, "processed", Conv.LONG); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public BusinessesSetAmlMonitoringResponse.Ok.Variant2.Outcomes outcomes() { + return Json.required(json, "outcomes", Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Outcomes::fromJson)); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Results::fromJson))); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public BusinessesSetAmlMonitoringResponse.Ok.Variant2.Estimate estimate() { + return Json.required(json, "estimate", Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Estimate::fromJson)); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unmatched() { + return Json.required(json, "unmatched", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant2}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant2 from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Status status) { + return set("status", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Status::of), status); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * Which profile family the job toggles. + * + * @param targetType the value + * @return this builder + */ + public Builder targetType(BusinessesSetAmlMonitoringResponse.Ok.Variant2.TargetType targetType) { + return set("target_type", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Ok.Variant2.TargetType::of), targetType); + } + + /** + * Profiles the job processes. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Profiles processed so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Outcomes::fromJson), outcomes); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Results::fromJson)), results); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Estimate estimate) { + return set("estimate", Conv.model(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Estimate::fromJson), estimate); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @param unmatched the value + * @return this builder + */ + public Builder unmatched(List unmatched) { + return set("unmatched", Conv.list(Conv.STRING), unmatched); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant2} + * @throws IllegalStateException when a required field is missing + */ + public Variant2 build() { + require("job_id", false); + require("status", false); + require("is_enabled", false); + require("target_type", false); + require("total", false); + require("processed", false); + require("outcomes", false); + require("results", false); + require("error", true); + require("created_at", false); + require("completed_at", true); + require("estimate", false); + require("unmatched", false); + return new Variant2(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Which profile family the job toggles. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TargetType extends StringEnum { + /** The value {@code "user"}. */ + public static final TargetType USER = new TargetType("user"); + + /** The value {@code "business"}. */ + public static final TargetType BUSINESS = new TargetType("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private TargetType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TargetType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TargetType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening could not be completed; retry later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out while the job was running. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening could not be completed; retry later. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out while the job was running. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "outcome"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit internal id of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your own identifier for the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Results.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Didit internal id of the profile. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your own identifier for the profile. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Results.Outcome outcome) { + return set("outcome", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Ok.Variant2.Results.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "enabled"}. */ + public static final Outcome ENABLED = new Outcome("enabled"); + + /** The value {@code "screened_and_enabled"}. */ + public static final Outcome SCREENED_AND_ENABLED = new Outcome("screened_and_enabled"); + + /** The value {@code "already_enabled"}. */ + public static final Outcome ALREADY_ENABLED = new Outcome("already_enabled"); + + /** The value {@code "disabled"}. */ + public static final Outcome DISABLED = new Outcome("disabled"); + + /** The value {@code "skipped_no_identity_data"}. */ + public static final Outcome SKIPPED_NO_IDENTITY_DATA = new Outcome("skipped_no_identity_data"); + + /** The value {@code "skipped_blocked"}. */ + public static final Outcome SKIPPED_BLOCKED = new Outcome("skipped_blocked"); + + /** The value {@code "skipped_sandbox"}. */ + public static final Outcome SKIPPED_SANDBOX = new Outcome("skipped_sandbox"); + + /** The value {@code "failed_provider"}. */ + public static final Outcome FAILED_PROVIDER = new Outcome("failed_provider"); + + /** The value {@code "failed_insufficient_balance"}. */ + public static final Outcome FAILED_INSUFFICIENT_BALANCE = new Outcome("failed_insufficient_balance"); + + private static final List KNOWN_VALUES = List.of(ENABLED, SCREENED_AND_ENABLED, ALREADY_ENABLED, DISABLED, SKIPPED_NO_IDENTITY_DATA, SKIPPED_BLOCKED, SKIPPED_SANDBOX, FAILED_PROVIDER, FAILED_INSUFFICIENT_BALANCE); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (nothing is written). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profiles matched by the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * One-time cost of the new screenings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Profiles matched by the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * One-time cost of the new screenings. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class Accepted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at", "estimate", "unmatched"); + + private Accepted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Accepted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Accepted fromJson(JsonNode json) { + return new Accepted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Accepted.Status::of)); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * Which profile family the job toggles. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional targetType() { + return Json.optional(json, "target_type", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Accepted.TargetType::of)); + } + + /** + * Profiles the job processes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * Profiles processed so far. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesSetAmlMonitoringResponse.Accepted.Outcomes::fromJson)); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(BusinessesSetAmlMonitoringResponse.Accepted.Results::fromJson))); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesSetAmlMonitoringResponse.Accepted.Estimate::fromJson)); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> unmatched() { + return Json.optional(json, "unmatched", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Accepted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Accepted from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesSetAmlMonitoringResponse.Accepted.Status status) { + return set("status", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Accepted.Status::of), status); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * Which profile family the job toggles. + * + * @param targetType the value + * @return this builder + */ + public Builder targetType(BusinessesSetAmlMonitoringResponse.Accepted.TargetType targetType) { + return set("target_type", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Accepted.TargetType::of), targetType); + } + + /** + * Profiles the job processes. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Profiles processed so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesSetAmlMonitoringResponse.Accepted.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesSetAmlMonitoringResponse.Accepted.Outcomes::fromJson), outcomes); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(BusinessesSetAmlMonitoringResponse.Accepted.Results::fromJson)), results); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesSetAmlMonitoringResponse.Accepted.Estimate estimate) { + return set("estimate", Conv.model(BusinessesSetAmlMonitoringResponse.Accepted.Estimate::fromJson), estimate); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @param unmatched the value + * @return this builder + */ + public Builder unmatched(List unmatched) { + return set("unmatched", Conv.list(Conv.STRING), unmatched); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Accepted} + */ + public Accepted build() { + return new Accepted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Which profile family the job toggles. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TargetType extends StringEnum { + /** The value {@code "user"}. */ + public static final TargetType USER = new TargetType("user"); + + /** The value {@code "business"}. */ + public static final TargetType BUSINESS = new TargetType("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private TargetType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TargetType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TargetType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening could not be completed; retry later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out while the job was running. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening could not be completed; retry later. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out while the job was running. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "outcome"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit internal id of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your own identifier for the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Accepted.Results.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Didit internal id of the profile. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your own identifier for the profile. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(BusinessesSetAmlMonitoringResponse.Accepted.Results.Outcome outcome) { + return set("outcome", Conv.enumeration(BusinessesSetAmlMonitoringResponse.Accepted.Results.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "enabled"}. */ + public static final Outcome ENABLED = new Outcome("enabled"); + + /** The value {@code "screened_and_enabled"}. */ + public static final Outcome SCREENED_AND_ENABLED = new Outcome("screened_and_enabled"); + + /** The value {@code "already_enabled"}. */ + public static final Outcome ALREADY_ENABLED = new Outcome("already_enabled"); + + /** The value {@code "disabled"}. */ + public static final Outcome DISABLED = new Outcome("disabled"); + + /** The value {@code "skipped_no_identity_data"}. */ + public static final Outcome SKIPPED_NO_IDENTITY_DATA = new Outcome("skipped_no_identity_data"); + + /** The value {@code "skipped_blocked"}. */ + public static final Outcome SKIPPED_BLOCKED = new Outcome("skipped_blocked"); + + /** The value {@code "skipped_sandbox"}. */ + public static final Outcome SKIPPED_SANDBOX = new Outcome("skipped_sandbox"); + + /** The value {@code "failed_provider"}. */ + public static final Outcome FAILED_PROVIDER = new Outcome("failed_provider"); + + /** The value {@code "failed_insufficient_balance"}. */ + public static final Outcome FAILED_INSUFFICIENT_BALANCE = new Outcome("failed_insufficient_balance"); + + private static final List KNOWN_VALUES = List.of(ENABLED, SCREENED_AND_ENABLED, ALREADY_ENABLED, DISABLED, SKIPPED_NO_IDENTITY_DATA, SKIPPED_BLOCKED, SKIPPED_SANDBOX, FAILED_PROVIDER, FAILED_INSUFFICIENT_BALANCE); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (nothing is written). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profiles matched by the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * One-time cost of the new screenings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Profiles matched by the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * One-time cost of the new screenings. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesSetOngoingMonitoringParams.java b/src/main/java/me/didit/types/BusinessesSetOngoingMonitoringParams.java new file mode 100644 index 0000000..a2d2945 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesSetOngoingMonitoringParams.java @@ -0,0 +1,262 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code businesses.set_ongoing_monitoring}. */ +public final class BusinessesSetOngoingMonitoringParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "estimate_only", "update_all", "filter_search", "filter_status", "filter_country", "filter_date_from", "filter_date_to", "didit_internal_id_list"); + + private BusinessesSetOngoingMonitoringParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesSetOngoingMonitoringParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesSetOngoingMonitoringParams fromJson(JsonNode json) { + return new BusinessesSetOngoingMonitoringParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * true to enable monitoring, false to disable it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * When true, returns the cost estimate and performs no writes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimateOnly() { + return Json.optional(json, "estimate_only", Conv.BOOLEAN); + } + + /** + * Apply to every entity of the application (scoped by the filter_* params when present). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updateAll() { + return Json.optional(json, "update_all", Conv.BOOLEAN); + } + + /** + * The filter_search field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterSearch() { + return Json.optional(json, "filter_search", Conv.STRING); + } + + /** + * The filter_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> filterStatus() { + return Json.optional(json, "filter_status", Conv.list(Conv.STRING)); + } + + /** + * The filter_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterCountry() { + return Json.optional(json, "filter_country", Conv.STRING); + } + + /** + * The filter_date_from field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterDateFrom() { + return Json.optional(json, "filter_date_from", Conv.DATE); + } + + /** + * The filter_date_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterDateTo() { + return Json.optional(json, "filter_date_to", Conv.DATE); + } + + /** + * Entities to toggle. Required unless update_all is true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> diditInternalIdList() { + return Json.optional(json, "didit_internal_id_list", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesSetOngoingMonitoringParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesSetOngoingMonitoringParams from) { + super(from); + } + + /** + * true to enable monitoring, false to disable it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * When true, returns the cost estimate and performs no writes. + * + * @param estimateOnly the value + * @return this builder + */ + public Builder estimateOnly(boolean estimateOnly) { + return set("estimate_only", Conv.BOOLEAN, estimateOnly); + } + + /** + * Apply to every entity of the application (scoped by the filter_* params when present). + * + * @param updateAll the value + * @return this builder + */ + public Builder updateAll(boolean updateAll) { + return set("update_all", Conv.BOOLEAN, updateAll); + } + + /** + * The filter_search field. + * + * @param filterSearch the value + * @return this builder + */ + public Builder filterSearch(String filterSearch) { + return set("filter_search", Conv.STRING, filterSearch); + } + + /** + * The filter_status field. + * + * @param filterStatus the value + * @return this builder + */ + public Builder filterStatus(List filterStatus) { + return set("filter_status", Conv.list(Conv.STRING), filterStatus); + } + + /** + * The filter_country field. + * + * @param filterCountry the value + * @return this builder + */ + public Builder filterCountry(String filterCountry) { + return set("filter_country", Conv.STRING, filterCountry); + } + + /** + * The filter_date_from field. + * + * @param filterDateFrom the value + * @return this builder + */ + public Builder filterDateFrom(LocalDate filterDateFrom) { + return set("filter_date_from", Conv.DATE, filterDateFrom); + } + + /** + * The filter_date_to field. + * + * @param filterDateTo the value + * @return this builder + */ + public Builder filterDateTo(LocalDate filterDateTo) { + return set("filter_date_to", Conv.DATE, filterDateTo); + } + + /** + * Entities to toggle. Required unless update_all is true. + * + * @param diditInternalIdList the value + * @return this builder + */ + public Builder diditInternalIdList(List diditInternalIdList) { + return set("didit_internal_id_list", Conv.list(Conv.STRING), diditInternalIdList); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesSetOngoingMonitoringParams} + * @throws IllegalStateException when a required field is missing + */ + public BusinessesSetOngoingMonitoringParams build() { + require("is_enabled", false); + return new BusinessesSetOngoingMonitoringParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesSetOngoingMonitoringResponse.java b/src/main/java/me/didit/types/BusinessesSetOngoingMonitoringResponse.java new file mode 100644 index 0000000..b0b4e02 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesSetOngoingMonitoringResponse.java @@ -0,0 +1,1932 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Response of {@code businesses.set_ongoing_monitoring}; the shape depends on the HTTP status. + */ +public final class BusinessesSetOngoingMonitoringResponse extends MultiStatusResponse { + private BusinessesSetOngoingMonitoringResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static BusinessesSetOngoingMonitoringResponse fromResponse(int statusCode, JsonNode json) { + return new BusinessesSetOngoingMonitoringResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.union(BusinessesSetOngoingMonitoringResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 202. + * + * @return true for status 202 + */ + public boolean isAccepted() { + return statusCode() == 202; + } + + /** + * The body of a 202 response. + * + * @return the body, or empty for another status + */ + public Optional asAccepted() { + return isAccepted() ? Optional.of(Conv.model(BusinessesSetOngoingMonitoringResponse.Accepted::fromJson).read(json)) : Optional.empty(); + } + + /** + * + *

One of: {@code CostPreview}, {@code Variant2}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ + public static final class Ok extends JsonUnion { + private Ok(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Ok} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Ok fromJson(JsonNode json) { + return new Ok(json.deepCopy()); + } + + /** + * Wraps a {@code CostPreview} value. + * + * @param value the value + * @return the union + */ + public static Ok ofCostPreview(BusinessesSetOngoingMonitoringResponse.Ok.CostPreview value) { + return new Ok(Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.CostPreview::fromJson).write(value)); + } + + /** + * Whether this value is a {@code CostPreview}. + * + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return true when it matches + */ + public boolean isCostPreview() { + return Json.hasAnyField(json, "users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + } + + /** + * Reads this value as a {@code CostPreview}. + * + * @return the value, or empty when {@link #isCostPreview()} is false + */ + public Optional asCostPreview() { + return isCostPreview() ? Optional.of(Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.CostPreview::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static Ok ofVariant2(BusinessesSetOngoingMonitoringResponse.Ok.Variant2 value) { + return new Ok(Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.Variant2::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * @return true when it matches + */ + public boolean isVariant2() { + return Json.hasAnyField(json, "job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional asVariant2() { + return isVariant2() ? Optional.of(Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.Variant2::fromJson).read(json)) : Optional.empty(); + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class CostPreview extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private CostPreview(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CostPreview} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CostPreview fromJson(JsonNode json) { + return new CostPreview(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CostPreview}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CostPreview from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CostPreview} + */ + public CostPreview build() { + return new CostPreview(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Variant2 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private Variant2(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant2} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant2 fromJson(JsonNode json) { + return new Variant2(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant2}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant2 from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Status status) { + return set("status", Conv.enumeration(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Estimate estimate) { + return set("estimate", Conv.model(BusinessesSetOngoingMonitoringResponse.Ok.Variant2.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant2} + */ + public Variant2 build() { + return new Variant2(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class Accepted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private Accepted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Accepted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Accepted fromJson(JsonNode json) { + return new Accepted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesSetOngoingMonitoringResponse.Accepted.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesSetOngoingMonitoringResponse.Accepted.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesSetOngoingMonitoringResponse.Accepted.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Accepted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Accepted from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesSetOngoingMonitoringResponse.Accepted.Status status) { + return set("status", Conv.enumeration(BusinessesSetOngoingMonitoringResponse.Accepted.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesSetOngoingMonitoringResponse.Accepted.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesSetOngoingMonitoringResponse.Accepted.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesSetOngoingMonitoringResponse.Accepted.Estimate estimate) { + return set("estimate", Conv.model(BusinessesSetOngoingMonitoringResponse.Accepted.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Accepted} + */ + public Accepted build() { + return new Accepted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesSetSessionOngoingMonitoringParams.java b/src/main/java/me/didit/types/BusinessesSetSessionOngoingMonitoringParams.java new file mode 100644 index 0000000..5f33c37 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesSetSessionOngoingMonitoringParams.java @@ -0,0 +1,302 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code businesses.set_session_ongoing_monitoring}. */ +public final class BusinessesSetSessionOngoingMonitoringParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "estimate_only", "update_all", "filter_search", "filter_status", "filter_country", "filter_date_from", "filter_date_to", "session_numbers", "toggle_all", "filter_workflow_id"); + + private BusinessesSetSessionOngoingMonitoringParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesSetSessionOngoingMonitoringParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesSetSessionOngoingMonitoringParams fromJson(JsonNode json) { + return new BusinessesSetSessionOngoingMonitoringParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * true to enable monitoring, false to disable it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * When true, returns the cost estimate and performs no writes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimateOnly() { + return Json.optional(json, "estimate_only", Conv.BOOLEAN); + } + + /** + * Apply to every entity of the application (scoped by the filter_* params when present). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updateAll() { + return Json.optional(json, "update_all", Conv.BOOLEAN); + } + + /** + * The filter_search field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterSearch() { + return Json.optional(json, "filter_search", Conv.STRING); + } + + /** + * The filter_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> filterStatus() { + return Json.optional(json, "filter_status", Conv.list(Conv.STRING)); + } + + /** + * The filter_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterCountry() { + return Json.optional(json, "filter_country", Conv.STRING); + } + + /** + * The filter_date_from field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterDateFrom() { + return Json.optional(json, "filter_date_from", Conv.DATE); + } + + /** + * The filter_date_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterDateTo() { + return Json.optional(json, "filter_date_to", Conv.DATE); + } + + /** + * Business session numbers to toggle. Required unless update_all (or the legacy toggle_all alias) is true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sessionNumbers() { + return Json.optional(json, "session_numbers", Conv.list(Conv.STRING)); + } + + /** + * Legacy alias of update_all. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional toggleAll() { + return Json.optional(json, "toggle_all", Conv.BOOLEAN); + } + + /** + * The filter_workflow_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterWorkflowId() { + return Json.optional(json, "filter_workflow_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesSetSessionOngoingMonitoringParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesSetSessionOngoingMonitoringParams from) { + super(from); + } + + /** + * true to enable monitoring, false to disable it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * When true, returns the cost estimate and performs no writes. + * + * @param estimateOnly the value + * @return this builder + */ + public Builder estimateOnly(boolean estimateOnly) { + return set("estimate_only", Conv.BOOLEAN, estimateOnly); + } + + /** + * Apply to every entity of the application (scoped by the filter_* params when present). + * + * @param updateAll the value + * @return this builder + */ + public Builder updateAll(boolean updateAll) { + return set("update_all", Conv.BOOLEAN, updateAll); + } + + /** + * The filter_search field. + * + * @param filterSearch the value + * @return this builder + */ + public Builder filterSearch(String filterSearch) { + return set("filter_search", Conv.STRING, filterSearch); + } + + /** + * The filter_status field. + * + * @param filterStatus the value + * @return this builder + */ + public Builder filterStatus(List filterStatus) { + return set("filter_status", Conv.list(Conv.STRING), filterStatus); + } + + /** + * The filter_country field. + * + * @param filterCountry the value + * @return this builder + */ + public Builder filterCountry(String filterCountry) { + return set("filter_country", Conv.STRING, filterCountry); + } + + /** + * The filter_date_from field. + * + * @param filterDateFrom the value + * @return this builder + */ + public Builder filterDateFrom(LocalDate filterDateFrom) { + return set("filter_date_from", Conv.DATE, filterDateFrom); + } + + /** + * The filter_date_to field. + * + * @param filterDateTo the value + * @return this builder + */ + public Builder filterDateTo(LocalDate filterDateTo) { + return set("filter_date_to", Conv.DATE, filterDateTo); + } + + /** + * Business session numbers to toggle. Required unless update_all (or the legacy toggle_all alias) is true. + * + * @param sessionNumbers the value + * @return this builder + */ + public Builder sessionNumbers(List sessionNumbers) { + return set("session_numbers", Conv.list(Conv.STRING), sessionNumbers); + } + + /** + * Legacy alias of update_all. + * + * @param toggleAll the value + * @return this builder + */ + public Builder toggleAll(boolean toggleAll) { + return set("toggle_all", Conv.BOOLEAN, toggleAll); + } + + /** + * The filter_workflow_id field. + * + * @param filterWorkflowId the value + * @return this builder + */ + public Builder filterWorkflowId(String filterWorkflowId) { + return set("filter_workflow_id", Conv.STRING, filterWorkflowId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesSetSessionOngoingMonitoringParams} + * @throws IllegalStateException when a required field is missing + */ + public BusinessesSetSessionOngoingMonitoringParams build() { + require("is_enabled", false); + return new BusinessesSetSessionOngoingMonitoringParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesSetSessionOngoingMonitoringResponse.java b/src/main/java/me/didit/types/BusinessesSetSessionOngoingMonitoringResponse.java new file mode 100644 index 0000000..de724bc --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesSetSessionOngoingMonitoringResponse.java @@ -0,0 +1,1932 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Response of {@code businesses.set_session_ongoing_monitoring}; the shape depends on the HTTP status. + */ +public final class BusinessesSetSessionOngoingMonitoringResponse extends MultiStatusResponse { + private BusinessesSetSessionOngoingMonitoringResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static BusinessesSetSessionOngoingMonitoringResponse fromResponse(int statusCode, JsonNode json) { + return new BusinessesSetSessionOngoingMonitoringResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.union(BusinessesSetSessionOngoingMonitoringResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 202. + * + * @return true for status 202 + */ + public boolean isAccepted() { + return statusCode() == 202; + } + + /** + * The body of a 202 response. + * + * @return the body, or empty for another status + */ + public Optional asAccepted() { + return isAccepted() ? Optional.of(Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Accepted::fromJson).read(json)) : Optional.empty(); + } + + /** + * + *

One of: {@code CostPreview}, {@code Variant2}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ + public static final class Ok extends JsonUnion { + private Ok(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Ok} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Ok fromJson(JsonNode json) { + return new Ok(json.deepCopy()); + } + + /** + * Wraps a {@code CostPreview} value. + * + * @param value the value + * @return the union + */ + public static Ok ofCostPreview(BusinessesSetSessionOngoingMonitoringResponse.Ok.CostPreview value) { + return new Ok(Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.CostPreview::fromJson).write(value)); + } + + /** + * Whether this value is a {@code CostPreview}. + * + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return true when it matches + */ + public boolean isCostPreview() { + return Json.hasAnyField(json, "users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + } + + /** + * Reads this value as a {@code CostPreview}. + * + * @return the value, or empty when {@link #isCostPreview()} is false + */ + public Optional asCostPreview() { + return isCostPreview() ? Optional.of(Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.CostPreview::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static Ok ofVariant2(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2 value) { + return new Ok(Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * @return true when it matches + */ + public boolean isVariant2() { + return Json.hasAnyField(json, "job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional asVariant2() { + return isVariant2() ? Optional.of(Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2::fromJson).read(json)) : Optional.empty(); + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class CostPreview extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private CostPreview(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CostPreview} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CostPreview fromJson(JsonNode json) { + return new CostPreview(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CostPreview}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CostPreview from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CostPreview} + */ + public CostPreview build() { + return new CostPreview(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Variant2 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private Variant2(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant2} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant2 fromJson(JsonNode json) { + return new Variant2(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant2}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant2 from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Status status) { + return set("status", Conv.enumeration(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Estimate estimate) { + return set("estimate", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Ok.Variant2.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant2} + */ + public Variant2 build() { + return new Variant2(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class Accepted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private Accepted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Accepted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Accepted fromJson(JsonNode json) { + return new Accepted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Accepted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Accepted from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Status status) { + return set("status", Conv.enumeration(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Outcomes outcomes) { + return set("outcomes", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Estimate estimate) { + return set("estimate", Conv.model(BusinessesSetSessionOngoingMonitoringResponse.Accepted.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Accepted} + */ + public Accepted build() { + return new Accepted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesUpdateParams.java b/src/main/java/me/didit/types/BusinessesUpdateParams.java new file mode 100644 index 0000000..7d72bd4 --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesUpdateParams.java @@ -0,0 +1,247 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code businesses.update}. */ +public final class BusinessesUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("display_name", "legal_name", "registration_number", "country_code", "status", "metadata"); + + private BusinessesUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesUpdateParams fromJson(JsonNode json) { + return new BusinessesUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Friendly display name shown in the console (takes precedence over legal_name for UI display). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Official legal name from registry or manual entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalName() { + return Json.optional(json, "legal_name", Conv.STRING); + } + + /** + * Company registration or incorporation number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Business lifecycle status. Setting BLOCKED automatically adds the vendor_data to the system blocklist; flipping away from BLOCKED removes that blocklist entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(BusinessesUpdateParams.Status::of)); + } + + /** + * Arbitrary JSON object you attach to the business. Fully replaces the existing metadata on update โ€” merge client-side if you only want to add keys. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesUpdateParams from) { + super(from); + } + + /** + * Friendly display name shown in the console (takes precedence over legal_name for UI display). + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Official legal name from registry or manual entry. + * + * @param legalName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalName(@Nullable String legalName) { + return setNullable("legal_name", Conv.STRING, legalName); + } + + /** + * Company registration or incorporation number. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, US). + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Business lifecycle status. Setting BLOCKED automatically adds the vendor_data to the system blocklist; flipping away from BLOCKED removes that blocklist entry. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesUpdateParams.Status status) { + return set("status", Conv.enumeration(BusinessesUpdateParams.Status::of), status); + } + + /** + * Arbitrary JSON object you attach to the business. Fully replaces the existing metadata on update โ€” merge client-side if you only want to add keys. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesUpdateParams} + */ + public BusinessesUpdateParams build() { + return new BusinessesUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Business lifecycle status. Setting BLOCKED automatically adds the vendor_data to the system blocklist; flipping away from BLOCKED removes that blocklist entry. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/BusinessesUpdateStatusParams.java b/src/main/java/me/didit/types/BusinessesUpdateStatusParams.java new file mode 100644 index 0000000..3bf590d --- /dev/null +++ b/src/main/java/me/didit/types/BusinessesUpdateStatusParams.java @@ -0,0 +1,147 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code businesses.update_status}. */ +public final class BusinessesUpdateStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status"); + + private BusinessesUpdateStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BusinessesUpdateStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BusinessesUpdateStatusParams fromJson(JsonNode json) { + return new BusinessesUpdateStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * New lifecycle status. BLOCKED also adds the vendor_data to the system blocklist. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public BusinessesUpdateStatusParams.Status status() { + return Json.required(json, "status", Conv.enumeration(BusinessesUpdateStatusParams.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BusinessesUpdateStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BusinessesUpdateStatusParams from) { + super(from); + } + + /** + * New lifecycle status. BLOCKED also adds the vendor_data to the system blocklist. + * + * @param status the value + * @return this builder + */ + public Builder status(BusinessesUpdateStatusParams.Status status) { + return set("status", Conv.enumeration(BusinessesUpdateStatusParams.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BusinessesUpdateStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public BusinessesUpdateStatusParams build() { + require("status", false); + return new BusinessesUpdateStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * New lifecycle status. BLOCKED also adds the vendor_data to the system blocklist. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseActionActionEnum.java b/src/main/java/me/didit/types/CaseActionActionEnum.java new file mode 100644 index 0000000..0704523 --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionActionEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - set_status - set_status + * - add_tags - add_tags + * - add_note - add_note + * - add_to_blocklist - add_to_blocklist + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseActionActionEnum extends StringEnum { + /** The value {@code "set_status"}. */ + public static final CaseActionActionEnum SET_STATUS = new CaseActionActionEnum("set_status"); + + /** The value {@code "add_tags"}. */ + public static final CaseActionActionEnum ADD_TAGS = new CaseActionActionEnum("add_tags"); + + /** The value {@code "add_note"}. */ + public static final CaseActionActionEnum ADD_NOTE = new CaseActionActionEnum("add_note"); + + /** The value {@code "add_to_blocklist"}. */ + public static final CaseActionActionEnum ADD_TO_BLOCKLIST = new CaseActionActionEnum("add_to_blocklist"); + + private static final List KNOWN_VALUES = List.of(SET_STATUS, ADD_TAGS, ADD_NOTE, ADD_TO_BLOCKLIST); + + private CaseActionActionEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseActionActionEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseActionActionEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseActionCaseActionReceipt.java b/src/main/java/me/didit/types/CaseActionCaseActionReceipt.java new file mode 100644 index 0000000..cbebfcd --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionCaseActionReceipt.java @@ -0,0 +1,289 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseActionCaseActionReceipt extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "client_reference", "action", "status", "result", "error", "actor_email", "attempts", "created_at", "updated_at"); + + private CaseActionCaseActionReceipt(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseActionCaseActionReceipt} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseActionCaseActionReceipt fromJson(JsonNode json) { + return new CaseActionCaseActionReceipt(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The client_reference field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String clientReference() { + return Json.required(json, "client_reference", Conv.STRING); + } + + /** + * The action field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String action() { + return Json.required(json, "action", Conv.STRING); + } + + /** + * - APPLIED - Applied + * - FAILED - Failed + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseActionStatusEnum status() { + return Json.required(json, "status", Conv.enumeration(CaseActionStatusEnum::of)); + } + + /** + * The result field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional result() { + return Json.optional(json, "result", Conv.ANY); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The attempts field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional attempts() { + return Json.optional(json, "attempts", Conv.LONG); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime updatedAt() { + return Json.required(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseActionCaseActionReceipt}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseActionCaseActionReceipt from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The client_reference field. + * + * @param clientReference the value + * @return this builder + */ + public Builder clientReference(String clientReference) { + return set("client_reference", Conv.STRING, clientReference); + } + + /** + * The action field. + * + * @param action the value + * @return this builder + */ + public Builder action(String action) { + return set("action", Conv.STRING, action); + } + + /** + * - APPLIED - Applied + * - FAILED - Failed + * + * @param status the value + * @return this builder + */ + public Builder status(CaseActionStatusEnum status) { + return set("status", Conv.enumeration(CaseActionStatusEnum::of), status); + } + + /** + * The result field. + * + * @param result the value + * @return this builder + */ + public Builder result(@Nullable Object result) { + return setAny("result", result); + } + + /** + * The error field. + * + * @param error the value + * @return this builder + */ + public Builder error(String error) { + return set("error", Conv.STRING, error); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The attempts field. + * + * @param attempts the value + * @return this builder + */ + public Builder attempts(long attempts) { + return set("attempts", Conv.LONG, attempts); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseActionCaseActionReceipt} + * @throws IllegalStateException when a required field is missing + */ + public CaseActionCaseActionReceipt build() { + require("uuid", false); + require("client_reference", false); + require("action", false); + require("status", false); + require("created_at", false); + require("updated_at", false); + return new CaseActionCaseActionReceipt(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseActionCaseActionReceiptPage.java b/src/main/java/me/didit/types/CaseActionCaseActionReceiptPage.java new file mode 100644 index 0000000..c3eba3c --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionCaseActionReceiptPage.java @@ -0,0 +1,143 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseActionCaseActionReceiptPage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next_offset", "results"); + + private CaseActionCaseActionReceiptPage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseActionCaseActionReceiptPage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseActionCaseActionReceiptPage fromJson(JsonNode json) { + return new CaseActionCaseActionReceiptPage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * The next_offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nextOffset() { + return Json.optional(json, "next_offset", Conv.LONG); + } + + /** + * The results field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(CaseActionCaseActionReceipt::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseActionCaseActionReceiptPage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseActionCaseActionReceiptPage from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next_offset field. + * + * @param nextOffset the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nextOffset(@Nullable Long nextOffset) { + return setNullable("next_offset", Conv.LONG, nextOffset); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseActionCaseActionReceipt::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseActionCaseActionReceiptPage} + * @throws IllegalStateException when a required field is missing + */ + public CaseActionCaseActionReceiptPage build() { + require("count", false); + require("next_offset", true); + require("results", false); + return new CaseActionCaseActionReceiptPage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseActionCaseEntityActionRequest.java b/src/main/java/me/didit/types/CaseActionCaseEntityActionRequest.java new file mode 100644 index 0000000..c944897 --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionCaseEntityActionRequest.java @@ -0,0 +1,207 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseActionCaseEntityActionRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("client_reference", "retry", "action", "status", "tags", "note"); + + private CaseActionCaseEntityActionRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseActionCaseEntityActionRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseActionCaseEntityActionRequest fromJson(JsonNode json) { + return new CaseActionCaseEntityActionRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The client_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientReference() { + return Json.optional(json, "client_reference", Conv.STRING); + } + + /** + * The retry field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retry() { + return Json.optional(json, "retry", Conv.BOOLEAN); + } + + /** + * - set_status - set_status + * - add_tags - add_tags + * - add_note - add_note + * - add_to_blocklist - add_to_blocklist + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseActionActionEnum action() { + return Json.required(json, "action", Conv.enumeration(CaseActionActionEnum::of)); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * The note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional note() { + return Json.optional(json, "note", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseActionCaseEntityActionRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseActionCaseEntityActionRequest from) { + super(from); + } + + /** + * The client_reference field. + * + * @param clientReference the value + * @return this builder + */ + public Builder clientReference(String clientReference) { + return set("client_reference", Conv.STRING, clientReference); + } + + /** + * The retry field. + * + * @param retry the value + * @return this builder + */ + public Builder retry(boolean retry) { + return set("retry", Conv.BOOLEAN, retry); + } + + /** + * - set_status - set_status + * - add_tags - add_tags + * - add_note - add_note + * - add_to_blocklist - add_to_blocklist + * + * @param action the value + * @return this builder + */ + public Builder action(CaseActionActionEnum action) { + return set("action", Conv.enumeration(CaseActionActionEnum::of), action); + } + + /** + * The status field. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * The note field. + * + * @param note the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder note(@Nullable String note) { + return setNullable("note", Conv.STRING, note); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseActionCaseEntityActionRequest} + * @throws IllegalStateException when a required field is missing + */ + public CaseActionCaseEntityActionRequest build() { + require("action", false); + return new CaseActionCaseEntityActionRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseActionCaseEntityActionResult.java b/src/main/java/me/didit/types/CaseActionCaseEntityActionResult.java new file mode 100644 index 0000000..c89ad8f --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionCaseEntityActionResult.java @@ -0,0 +1,260 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseActionCaseEntityActionResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("receipt", "entity_type", "entity_uuid", "action", "previous_status", "new_status", "tags_added", "comment_uuid", "blocklisted"); + + private CaseActionCaseEntityActionResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseActionCaseEntityActionResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseActionCaseEntityActionResult fromJson(JsonNode json) { + return new CaseActionCaseEntityActionResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The receipt field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional receipt() { + return Json.optional(json, "receipt", Conv.model(CaseActionCaseActionReceipt::fromJson)); + } + + /** + * - user - user + * - business - business + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(CaseActionEntityTypeEnum::of)); + } + + /** + * The entity_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityUuid() { + return Json.optional(json, "entity_uuid", Conv.STRING); + } + + /** + * The action field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.STRING); + } + + /** + * The previous_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previousStatus() { + return Json.optional(json, "previous_status", Conv.STRING); + } + + /** + * The new_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.STRING); + } + + /** + * The tags_added field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tagsAdded() { + return Json.optional(json, "tags_added", Conv.list(Conv.STRING)); + } + + /** + * The comment_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional commentUuid() { + return Json.optional(json, "comment_uuid", Conv.STRING); + } + + /** + * The blocklisted field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> blocklisted() { + return Json.optional(json, "blocklisted", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseActionCaseEntityActionResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseActionCaseEntityActionResult from) { + super(from); + } + + /** + * The receipt field. + * + * @param receipt the value + * @return this builder + */ + public Builder receipt(CaseActionCaseActionReceipt receipt) { + return set("receipt", Conv.model(CaseActionCaseActionReceipt::fromJson), receipt); + } + + /** + * - user - user + * - business - business + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(CaseActionEntityTypeEnum entityType) { + return set("entity_type", Conv.enumeration(CaseActionEntityTypeEnum::of), entityType); + } + + /** + * The entity_uuid field. + * + * @param entityUuid the value + * @return this builder + */ + public Builder entityUuid(String entityUuid) { + return set("entity_uuid", Conv.STRING, entityUuid); + } + + /** + * The action field. + * + * @param action the value + * @return this builder + */ + public Builder action(String action) { + return set("action", Conv.STRING, action); + } + + /** + * The previous_status field. + * + * @param previousStatus the value + * @return this builder + */ + public Builder previousStatus(String previousStatus) { + return set("previous_status", Conv.STRING, previousStatus); + } + + /** + * The new_status field. + * + * @param newStatus the value + * @return this builder + */ + public Builder newStatus(String newStatus) { + return set("new_status", Conv.STRING, newStatus); + } + + /** + * The tags_added field. + * + * @param tagsAdded the value + * @return this builder + */ + public Builder tagsAdded(List tagsAdded) { + return set("tags_added", Conv.list(Conv.STRING), tagsAdded); + } + + /** + * The comment_uuid field. + * + * @param commentUuid the value + * @return this builder + */ + public Builder commentUuid(String commentUuid) { + return set("comment_uuid", Conv.STRING, commentUuid); + } + + /** + * The blocklisted field. + * + * @param blocklisted the value + * @return this builder + */ + public Builder blocklisted(List blocklisted) { + return set("blocklisted", Conv.list(Conv.STRING), blocklisted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseActionCaseEntityActionResult} + */ + public CaseActionCaseEntityActionResult build() { + return new CaseActionCaseEntityActionResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseActionEntityTypeEnum.java b/src/main/java/me/didit/types/CaseActionEntityTypeEnum.java new file mode 100644 index 0000000..0520086 --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionEntityTypeEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - user - user + * - business - business + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseActionEntityTypeEnum extends StringEnum { + /** The value {@code "user"}. */ + public static final CaseActionEntityTypeEnum USER = new CaseActionEntityTypeEnum("user"); + + /** The value {@code "business"}. */ + public static final CaseActionEntityTypeEnum BUSINESS = new CaseActionEntityTypeEnum("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private CaseActionEntityTypeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseActionEntityTypeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseActionEntityTypeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseActionStatusEnum.java b/src/main/java/me/didit/types/CaseActionStatusEnum.java new file mode 100644 index 0000000..7c2c16f --- /dev/null +++ b/src/main/java/me/didit/types/CaseActionStatusEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - APPLIED - Applied + * - FAILED - Failed + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseActionStatusEnum extends StringEnum { + /** The value {@code "APPLIED"}. */ + public static final CaseActionStatusEnum APPLIED = new CaseActionStatusEnum("APPLIED"); + + /** The value {@code "FAILED"}. */ + public static final CaseActionStatusEnum FAILED = new CaseActionStatusEnum("FAILED"); + + private static final List KNOWN_VALUES = List.of(APPLIED, FAILED); + + private CaseActionStatusEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseActionStatusEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseActionStatusEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseAssignee.java b/src/main/java/me/didit/types/CaseAssignee.java new file mode 100644 index 0000000..ea84236 --- /dev/null +++ b/src/main/java/me/didit/types/CaseAssignee.java @@ -0,0 +1,138 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseAssignee extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "full_name", "email"); + + private CaseAssignee(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseAssignee} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseAssignee fromJson(JsonNode json) { + return new CaseAssignee(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseAssignee}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseAssignee from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The full_name field. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseAssignee} + */ + public CaseAssignee build() { + return new CaseAssignee(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseBlueprintDetail.java b/src/main/java/me/didit/types/CaseBlueprintDetail.java new file mode 100644 index 0000000..b705383 --- /dev/null +++ b/src/main/java/me/didit/types/CaseBlueprintDetail.java @@ -0,0 +1,1921 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseBlueprintDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "description", "assignment_method", "assignee_pool", "max_active_cases", "escalation_enabled", "transfer_enabled", "require_resolution_note", "is_active", "preset_key", "created_at", "escalation_blueprint", "escalation_blueprint_name", "four_eyes_checker_blueprint", "four_eyes_checker_blueprint_name", "content_config", "creation_sources", "receives_escalation_from", "updated_at", "version", "default_deadline_hours"); + + private CaseBlueprintDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseBlueprintDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseBlueprintDetail fromJson(JsonNode json) { + return new CaseBlueprintDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The assignment_method field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignmentMethod() { + return Json.optional(json, "assignment_method", Conv.enumeration(CaseBlueprintDetail.AssignmentMethod::of)); + } + + /** + * The assignee_pool field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> assigneePool() { + return Json.optional(json, "assignee_pool", Conv.list(Conv.STRING)); + } + + /** + * The max_active_cases field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxActiveCases() { + return Json.optional(json, "max_active_cases", Conv.LONG); + } + + /** + * The escalation_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationEnabled() { + return Json.optional(json, "escalation_enabled", Conv.BOOLEAN); + } + + /** + * The transfer_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transferEnabled() { + return Json.optional(json, "transfer_enabled", Conv.BOOLEAN); + } + + /** + * The require_resolution_note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requireResolutionNote() { + return Json.optional(json, "require_resolution_note", Conv.BOOLEAN); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The preset_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional presetKey() { + return Json.optional(json, "preset_key", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The escalation_blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationBlueprint() { + return Json.optional(json, "escalation_blueprint", Conv.STRING); + } + + /** + * The escalation_blueprint_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationBlueprintName() { + return Json.optional(json, "escalation_blueprint_name", Conv.STRING); + } + + /** + * The four_eyes_checker_blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fourEyesCheckerBlueprint() { + return Json.optional(json, "four_eyes_checker_blueprint", Conv.STRING); + } + + /** + * The four_eyes_checker_blueprint_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fourEyesCheckerBlueprintName() { + return Json.optional(json, "four_eyes_checker_blueprint_name", Conv.STRING); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentConfig() { + return Json.optional(json, "content_config", Conv.model(CaseBlueprintDetail.ContentConfig::fromJson)); + } + + /** + * Connectors currently routing new cases into this blueprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> creationSources() { + return Json.optional(json, "creation_sources", Conv.list(Conv.model(CaseBlueprintDetail.CreationSources::fromJson))); + } + + /** + * Other blueprints whose Escalation target points at this one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> receivesEscalationFrom() { + return Json.optional(json, "receives_escalation_from", Conv.list(Conv.model(CaseBlueprintDetail.ReceivesEscalationFrom::fromJson))); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * The version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * The default_deadline_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultDeadlineHours() { + return Json.optional(json, "default_deadline_hours", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseBlueprintDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseBlueprintDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The assignment_method field. + * + * @param assignmentMethod the value + * @return this builder + */ + public Builder assignmentMethod(CaseBlueprintDetail.AssignmentMethod assignmentMethod) { + return set("assignment_method", Conv.enumeration(CaseBlueprintDetail.AssignmentMethod::of), assignmentMethod); + } + + /** + * The assignee_pool field. + * + * @param assigneePool the value + * @return this builder + */ + public Builder assigneePool(List assigneePool) { + return set("assignee_pool", Conv.list(Conv.STRING), assigneePool); + } + + /** + * The max_active_cases field. + * + * @param maxActiveCases the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxActiveCases(@Nullable Long maxActiveCases) { + return setNullable("max_active_cases", Conv.LONG, maxActiveCases); + } + + /** + * The escalation_enabled field. + * + * @param escalationEnabled the value + * @return this builder + */ + public Builder escalationEnabled(boolean escalationEnabled) { + return set("escalation_enabled", Conv.BOOLEAN, escalationEnabled); + } + + /** + * The transfer_enabled field. + * + * @param transferEnabled the value + * @return this builder + */ + public Builder transferEnabled(boolean transferEnabled) { + return set("transfer_enabled", Conv.BOOLEAN, transferEnabled); + } + + /** + * The require_resolution_note field. + * + * @param requireResolutionNote the value + * @return this builder + */ + public Builder requireResolutionNote(boolean requireResolutionNote) { + return set("require_resolution_note", Conv.BOOLEAN, requireResolutionNote); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The preset_key field. + * + * @param presetKey the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder presetKey(@Nullable String presetKey) { + return setNullable("preset_key", Conv.STRING, presetKey); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The escalation_blueprint field. + * + * @param escalationBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder escalationBlueprint(@Nullable String escalationBlueprint) { + return setNullable("escalation_blueprint", Conv.STRING, escalationBlueprint); + } + + /** + * The escalation_blueprint_name field. + * + * @param escalationBlueprintName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder escalationBlueprintName(@Nullable String escalationBlueprintName) { + return setNullable("escalation_blueprint_name", Conv.STRING, escalationBlueprintName); + } + + /** + * The four_eyes_checker_blueprint field. + * + * @param fourEyesCheckerBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fourEyesCheckerBlueprint(@Nullable String fourEyesCheckerBlueprint) { + return setNullable("four_eyes_checker_blueprint", Conv.STRING, fourEyesCheckerBlueprint); + } + + /** + * The four_eyes_checker_blueprint_name field. + * + * @param fourEyesCheckerBlueprintName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fourEyesCheckerBlueprintName(@Nullable String fourEyesCheckerBlueprintName) { + return setNullable("four_eyes_checker_blueprint_name", Conv.STRING, fourEyesCheckerBlueprintName); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @param contentConfig the value + * @return this builder + */ + public Builder contentConfig(CaseBlueprintDetail.ContentConfig contentConfig) { + return set("content_config", Conv.model(CaseBlueprintDetail.ContentConfig::fromJson), contentConfig); + } + + /** + * Connectors currently routing new cases into this blueprint. + * + * @param creationSources the value + * @return this builder + */ + public Builder creationSources(List creationSources) { + return set("creation_sources", Conv.list(Conv.model(CaseBlueprintDetail.CreationSources::fromJson)), creationSources); + } + + /** + * Other blueprints whose Escalation target points at this one. + * + * @param receivesEscalationFrom the value + * @return this builder + */ + public Builder receivesEscalationFrom(List receivesEscalationFrom) { + return set("receives_escalation_from", Conv.list(Conv.model(CaseBlueprintDetail.ReceivesEscalationFrom::fromJson)), receivesEscalationFrom); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The default_deadline_hours field. + * + * @param defaultDeadlineHours the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder defaultDeadlineHours(@Nullable Long defaultDeadlineHours) { + return setNullable("default_deadline_hours", Conv.LONG, defaultDeadlineHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseBlueprintDetail} + */ + public CaseBlueprintDetail build() { + return new CaseBlueprintDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AssignmentMethod extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final AssignmentMethod MANUAL = new AssignmentMethod("MANUAL"); + + /** The value {@code "AUTOMATIC"}. */ + public static final AssignmentMethod AUTOMATIC = new AssignmentMethod("AUTOMATIC"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AUTOMATIC); + + private AssignmentMethod(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AssignmentMethod of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AssignmentMethod::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + */ + public static final class ContentConfig extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("checklist", "aml_control", "identity", "verifications", "reporting", "financial"); + + private ContentConfig(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ContentConfig} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ContentConfig fromJson(JsonNode json) { + return new ContentConfig(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The checklist field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional checklist() { + return Json.optional(json, "checklist", Conv.model(CaseBlueprintDetail.ContentConfig.Checklist::fromJson)); + } + + /** + * The aml_control field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlControl() { + return Json.optional(json, "aml_control", Conv.model(CaseBlueprintDetail.ContentConfig.AmlControl::fromJson)); + } + + /** + * The identity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identity() { + return Json.optional(json, "identity", Conv.model(CaseBlueprintDetail.ContentConfig.Identity::fromJson)); + } + + /** + * The verifications field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifications() { + return Json.optional(json, "verifications", Conv.model(CaseBlueprintDetail.ContentConfig.Verifications::fromJson)); + } + + /** + * The reporting field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reporting() { + return Json.optional(json, "reporting", Conv.model(CaseBlueprintDetail.ContentConfig.Reporting::fromJson)); + } + + /** + * The financial field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional financial() { + return Json.optional(json, "financial", Conv.model(CaseBlueprintDetail.ContentConfig.Financial::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ContentConfig}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ContentConfig from) { + super(from); + } + + /** + * The checklist field. + * + * @param checklist the value + * @return this builder + */ + public Builder checklist(CaseBlueprintDetail.ContentConfig.Checklist checklist) { + return set("checklist", Conv.model(CaseBlueprintDetail.ContentConfig.Checklist::fromJson), checklist); + } + + /** + * The aml_control field. + * + * @param amlControl the value + * @return this builder + */ + public Builder amlControl(CaseBlueprintDetail.ContentConfig.AmlControl amlControl) { + return set("aml_control", Conv.model(CaseBlueprintDetail.ContentConfig.AmlControl::fromJson), amlControl); + } + + /** + * The identity field. + * + * @param identity the value + * @return this builder + */ + public Builder identity(CaseBlueprintDetail.ContentConfig.Identity identity) { + return set("identity", Conv.model(CaseBlueprintDetail.ContentConfig.Identity::fromJson), identity); + } + + /** + * The verifications field. + * + * @param verifications the value + * @return this builder + */ + public Builder verifications(CaseBlueprintDetail.ContentConfig.Verifications verifications) { + return set("verifications", Conv.model(CaseBlueprintDetail.ContentConfig.Verifications::fromJson), verifications); + } + + /** + * The reporting field. + * + * @param reporting the value + * @return this builder + */ + public Builder reporting(CaseBlueprintDetail.ContentConfig.Reporting reporting) { + return set("reporting", Conv.model(CaseBlueprintDetail.ContentConfig.Reporting::fromJson), reporting); + } + + /** + * The financial field. + * + * @param financial the value + * @return this builder + */ + public Builder financial(CaseBlueprintDetail.ContentConfig.Financial financial) { + return set("financial", Conv.model(CaseBlueprintDetail.ContentConfig.Financial::fromJson), financial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ContentConfig} + */ + public ContentConfig build() { + return new ContentConfig(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Checklist extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "optional", "items"); + + private Checklist(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Checklist} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Checklist fromJson(JsonNode json) { + return new Checklist(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * When true, a case can be resolved with incomplete checklist items. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional optional() { + return Json.optional(json, "optional", Conv.BOOLEAN); + } + + /** + * The items field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> items() { + return Json.optional(json, "items", Conv.list(Conv.model(CaseBlueprintDetail.ContentConfig.Checklist.Items::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Checklist}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Checklist from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * When true, a case can be resolved with incomplete checklist items. + * + * @param optional the value + * @return this builder + */ + public Builder optional(boolean optional) { + return set("optional", Conv.BOOLEAN, optional); + } + + /** + * The items field. + * + * @param items the value + * @return this builder + */ + public Builder items(List items) { + return set("items", Conv.list(Conv.model(CaseBlueprintDetail.ContentConfig.Checklist.Items::fromJson)), items); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Checklist} + */ + public Checklist build() { + return new Checklist(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Items extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("label", "order"); + + private Items(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Items} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Items fromJson(JsonNode json) { + return new Items(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The order field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional order() { + return Json.optional(json, "order", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Items}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Items from) { + super(from); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The order field. + * + * @param order the value + * @return this builder + */ + public Builder order(long order) { + return set("order", Conv.LONG, order); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Items} + */ + public Items build() { + return new Items(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class AmlControl extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "financial", "identity"); + + private AmlControl(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AmlControl} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AmlControl fromJson(JsonNode json) { + return new AmlControl(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The financial field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional financial() { + return Json.optional(json, "financial", Conv.BOOLEAN); + } + + /** + * The identity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identity() { + return Json.optional(json, "identity", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AmlControl}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AmlControl from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The financial field. + * + * @param financial the value + * @return this builder + */ + public Builder financial(boolean financial) { + return set("financial", Conv.BOOLEAN, financial); + } + + /** + * The identity field. + * + * @param identity the value + * @return this builder + */ + public Builder identity(boolean identity) { + return set("identity", Conv.BOOLEAN, identity); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AmlControl} + */ + public AmlControl build() { + return new AmlControl(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Identity extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "personal_information", "applicant_tags", "contact_information", "risk_overview", "poi_documents", "poa_documents"); + + private Identity(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Identity} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Identity fromJson(JsonNode json) { + return new Identity(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The personal_information field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalInformation() { + return Json.optional(json, "personal_information", Conv.BOOLEAN); + } + + /** + * The applicant_tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional applicantTags() { + return Json.optional(json, "applicant_tags", Conv.BOOLEAN); + } + + /** + * The contact_information field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contactInformation() { + return Json.optional(json, "contact_information", Conv.BOOLEAN); + } + + /** + * The risk_overview field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskOverview() { + return Json.optional(json, "risk_overview", Conv.BOOLEAN); + } + + /** + * The poi_documents field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poiDocuments() { + return Json.optional(json, "poi_documents", Conv.BOOLEAN); + } + + /** + * The poa_documents field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaDocuments() { + return Json.optional(json, "poa_documents", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Identity}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Identity from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The personal_information field. + * + * @param personalInformation the value + * @return this builder + */ + public Builder personalInformation(boolean personalInformation) { + return set("personal_information", Conv.BOOLEAN, personalInformation); + } + + /** + * The applicant_tags field. + * + * @param applicantTags the value + * @return this builder + */ + public Builder applicantTags(boolean applicantTags) { + return set("applicant_tags", Conv.BOOLEAN, applicantTags); + } + + /** + * The contact_information field. + * + * @param contactInformation the value + * @return this builder + */ + public Builder contactInformation(boolean contactInformation) { + return set("contact_information", Conv.BOOLEAN, contactInformation); + } + + /** + * The risk_overview field. + * + * @param riskOverview the value + * @return this builder + */ + public Builder riskOverview(boolean riskOverview) { + return set("risk_overview", Conv.BOOLEAN, riskOverview); + } + + /** + * The poi_documents field. + * + * @param poiDocuments the value + * @return this builder + */ + public Builder poiDocuments(boolean poiDocuments) { + return set("poi_documents", Conv.BOOLEAN, poiDocuments); + } + + /** + * The poa_documents field. + * + * @param poaDocuments the value + * @return this builder + */ + public Builder poaDocuments(boolean poaDocuments) { + return set("poa_documents", Conv.BOOLEAN, poaDocuments); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Identity} + */ + public Identity build() { + return new Identity(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Verifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "summary"); + + private Verifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Verifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Verifications fromJson(JsonNode json) { + return new Verifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Verifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Verifications from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The summary field. + * + * @param summary the value + * @return this builder + */ + public Builder summary(boolean summary) { + return set("summary", Conv.BOOLEAN, summary); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Verifications} + */ + public Verifications build() { + return new Verifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Reporting extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "fiu_reports"); + + private Reporting(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Reporting} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Reporting fromJson(JsonNode json) { + return new Reporting(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The fiu_reports field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fiuReports() { + return Json.optional(json, "fiu_reports", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Reporting}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Reporting from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The fiu_reports field. + * + * @param fiuReports the value + * @return this builder + */ + public Builder fiuReports(boolean fiuReports) { + return set("fiu_reports", Conv.BOOLEAN, fiuReports); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Reporting} + */ + public Reporting build() { + return new Reporting(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Financial extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "payment_methods", "transactions"); + + private Financial(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Financial} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Financial fromJson(JsonNode json) { + return new Financial(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The payment_methods field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentMethods() { + return Json.optional(json, "payment_methods", Conv.BOOLEAN); + } + + /** + * The transactions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactions() { + return Json.optional(json, "transactions", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Financial}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Financial from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The payment_methods field. + * + * @param paymentMethods the value + * @return this builder + */ + public Builder paymentMethods(boolean paymentMethods) { + return set("payment_methods", Conv.BOOLEAN, paymentMethods); + } + + /** + * The transactions field. + * + * @param transactions the value + * @return this builder + */ + public Builder transactions(boolean transactions) { + return set("transactions", Conv.BOOLEAN, transactions); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Financial} + */ + public Financial build() { + return new Financial(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class CreationSources extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("kind", "id", "name"); + + private CreationSources(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CreationSources} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CreationSources fromJson(JsonNode json) { + return new CreationSources(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The kind field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kind() { + return Json.optional(json, "kind", Conv.enumeration(CaseBlueprintDetail.CreationSources.Kind::of)); + } + + /** + * The id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CreationSources}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CreationSources from) { + super(from); + } + + /** + * The kind field. + * + * @param kind the value + * @return this builder + */ + public Builder kind(CaseBlueprintDetail.CreationSources.Kind kind) { + return set("kind", Conv.enumeration(CaseBlueprintDetail.CreationSources.Kind::of), kind); + } + + /** + * The id field. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CreationSources} + */ + public CreationSources build() { + return new CreationSources(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Kind extends StringEnum { + /** The value {@code "aml"}. */ + public static final Kind AML = new Kind("aml"); + + /** The value {@code "rule"}. */ + public static final Kind RULE = new Kind("rule"); + + /** The value {@code "workflow"}. */ + public static final Kind WORKFLOW = new Kind("workflow"); + + private static final List KNOWN_VALUES = List.of(AML, RULE, WORKFLOW); + + private Kind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Kind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Kind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class ReceivesEscalationFrom extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "name"); + + private ReceivesEscalationFrom(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReceivesEscalationFrom} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReceivesEscalationFrom fromJson(JsonNode json) { + return new ReceivesEscalationFrom(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReceivesEscalationFrom}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReceivesEscalationFrom from) { + super(from); + } + + /** + * The id field. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReceivesEscalationFrom} + */ + public ReceivesEscalationFrom build() { + return new ReceivesEscalationFrom(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CaseBlueprintListItem.java b/src/main/java/me/didit/types/CaseBlueprintListItem.java new file mode 100644 index 0000000..c04628f --- /dev/null +++ b/src/main/java/me/didit/types/CaseBlueprintListItem.java @@ -0,0 +1,403 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseBlueprintListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "description", "assignment_method", "assignee_pool", "max_active_cases", "escalation_enabled", "transfer_enabled", "require_resolution_note", "is_active", "preset_key", "created_at", "version", "default_deadline_hours"); + + private CaseBlueprintListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseBlueprintListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseBlueprintListItem fromJson(JsonNode json) { + return new CaseBlueprintListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The assignment_method field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignmentMethod() { + return Json.optional(json, "assignment_method", Conv.enumeration(CaseBlueprintListItem.AssignmentMethod::of)); + } + + /** + * The assignee_pool field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> assigneePool() { + return Json.optional(json, "assignee_pool", Conv.list(Conv.STRING)); + } + + /** + * The max_active_cases field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxActiveCases() { + return Json.optional(json, "max_active_cases", Conv.LONG); + } + + /** + * The escalation_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationEnabled() { + return Json.optional(json, "escalation_enabled", Conv.BOOLEAN); + } + + /** + * The transfer_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transferEnabled() { + return Json.optional(json, "transfer_enabled", Conv.BOOLEAN); + } + + /** + * The require_resolution_note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requireResolutionNote() { + return Json.optional(json, "require_resolution_note", Conv.BOOLEAN); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The preset_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional presetKey() { + return Json.optional(json, "preset_key", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * The default_deadline_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultDeadlineHours() { + return Json.optional(json, "default_deadline_hours", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseBlueprintListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseBlueprintListItem from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The assignment_method field. + * + * @param assignmentMethod the value + * @return this builder + */ + public Builder assignmentMethod(CaseBlueprintListItem.AssignmentMethod assignmentMethod) { + return set("assignment_method", Conv.enumeration(CaseBlueprintListItem.AssignmentMethod::of), assignmentMethod); + } + + /** + * The assignee_pool field. + * + * @param assigneePool the value + * @return this builder + */ + public Builder assigneePool(List assigneePool) { + return set("assignee_pool", Conv.list(Conv.STRING), assigneePool); + } + + /** + * The max_active_cases field. + * + * @param maxActiveCases the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxActiveCases(@Nullable Long maxActiveCases) { + return setNullable("max_active_cases", Conv.LONG, maxActiveCases); + } + + /** + * The escalation_enabled field. + * + * @param escalationEnabled the value + * @return this builder + */ + public Builder escalationEnabled(boolean escalationEnabled) { + return set("escalation_enabled", Conv.BOOLEAN, escalationEnabled); + } + + /** + * The transfer_enabled field. + * + * @param transferEnabled the value + * @return this builder + */ + public Builder transferEnabled(boolean transferEnabled) { + return set("transfer_enabled", Conv.BOOLEAN, transferEnabled); + } + + /** + * The require_resolution_note field. + * + * @param requireResolutionNote the value + * @return this builder + */ + public Builder requireResolutionNote(boolean requireResolutionNote) { + return set("require_resolution_note", Conv.BOOLEAN, requireResolutionNote); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The preset_key field. + * + * @param presetKey the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder presetKey(@Nullable String presetKey) { + return setNullable("preset_key", Conv.STRING, presetKey); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The default_deadline_hours field. + * + * @param defaultDeadlineHours the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder defaultDeadlineHours(@Nullable Long defaultDeadlineHours) { + return setNullable("default_deadline_hours", Conv.LONG, defaultDeadlineHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseBlueprintListItem} + */ + public CaseBlueprintListItem build() { + return new CaseBlueprintListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AssignmentMethod extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final AssignmentMethod MANUAL = new AssignmentMethod("MANUAL"); + + /** The value {@code "AUTOMATIC"}. */ + public static final AssignmentMethod AUTOMATIC = new AssignmentMethod("AUTOMATIC"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AUTOMATIC); + + private AssignmentMethod(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AssignmentMethod of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AssignmentMethod::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseBlueprintSummary.java b/src/main/java/me/didit/types/CaseBlueprintSummary.java new file mode 100644 index 0000000..6d7a61c --- /dev/null +++ b/src/main/java/me/didit/types/CaseBlueprintSummary.java @@ -0,0 +1,118 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseBlueprintSummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name"); + + private CaseBlueprintSummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseBlueprintSummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseBlueprintSummary fromJson(JsonNode json) { + return new CaseBlueprintSummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseBlueprintSummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseBlueprintSummary from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseBlueprintSummary} + */ + public CaseBlueprintSummary build() { + return new CaseBlueprintSummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseChecklistItem.java b/src/main/java/me/didit/types/CaseChecklistItem.java new file mode 100644 index 0000000..554c255 --- /dev/null +++ b/src/main/java/me/didit/types/CaseChecklistItem.java @@ -0,0 +1,200 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseChecklistItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "label", "is_completed", "completed_by", "completed_at", "order"); + + private CaseChecklistItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseChecklistItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseChecklistItem fromJson(JsonNode json) { + return new CaseChecklistItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The is_completed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isCompleted() { + return Json.optional(json, "is_completed", Conv.BOOLEAN); + } + + /** + * The completed_by field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedBy() { + return Json.optional(json, "completed_by", Conv.STRING); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * The order field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional order() { + return Json.optional(json, "order", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseChecklistItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseChecklistItem from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The is_completed field. + * + * @param isCompleted the value + * @return this builder + */ + public Builder isCompleted(boolean isCompleted) { + return set("is_completed", Conv.BOOLEAN, isCompleted); + } + + /** + * The completed_by field. + * + * @param completedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedBy(@Nullable String completedBy) { + return setNullable("completed_by", Conv.STRING, completedBy); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * The order field. + * + * @param order the value + * @return this builder + */ + public Builder order(long order) { + return set("order", Conv.LONG, order); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseChecklistItem} + */ + public CaseChecklistItem build() { + return new CaseChecklistItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseCollaborationCaseNote.java b/src/main/java/me/didit/types/CaseCollaborationCaseNote.java new file mode 100644 index 0000000..21fd1ef --- /dev/null +++ b/src/main/java/me/didit/types/CaseCollaborationCaseNote.java @@ -0,0 +1,325 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseCollaborationCaseNote extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "comment", "actor_email", "actor_name", "mentioned_emails", "is_internal", "attachments", "tags", "created_at", "reply_to", "is_pinned", "client_reference"); + + private CaseCollaborationCaseNote(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseCollaborationCaseNote} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseCollaborationCaseNote fromJson(JsonNode json) { + return new CaseCollaborationCaseNote(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The comment field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String comment() { + return Json.required(json, "comment", Conv.STRING); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The actor_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorName() { + return Json.optional(json, "actor_name", Conv.STRING); + } + + /** + * The mentioned_emails field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mentionedEmails() { + return Json.optional(json, "mentioned_emails", Conv.ANY); + } + + /** + * The is_internal field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isInternal() { + return Json.optional(json, "is_internal", Conv.BOOLEAN); + } + + /** + * The attachments field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional attachments() { + return Json.optional(json, "attachments", Conv.ANY); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tags() { + return Json.optional(json, "tags", Conv.ANY); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The reply_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional replyTo() { + return Json.optional(json, "reply_to", Conv.model(CaseCollaborationCaseNoteReply::fromJson)); + } + + /** + * The is_pinned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isPinned() { + return Json.optional(json, "is_pinned", Conv.BOOLEAN); + } + + /** + * The client_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientReference() { + return Json.optional(json, "client_reference", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseCollaborationCaseNote}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseCollaborationCaseNote from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The actor_name field. + * + * @param actorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorName(@Nullable String actorName) { + return setNullable("actor_name", Conv.STRING, actorName); + } + + /** + * The mentioned_emails field. + * + * @param mentionedEmails the value + * @return this builder + */ + public Builder mentionedEmails(@Nullable Object mentionedEmails) { + return setAny("mentioned_emails", mentionedEmails); + } + + /** + * The is_internal field. + * + * @param isInternal the value + * @return this builder + */ + public Builder isInternal(boolean isInternal) { + return set("is_internal", Conv.BOOLEAN, isInternal); + } + + /** + * The attachments field. + * + * @param attachments the value + * @return this builder + */ + public Builder attachments(@Nullable Object attachments) { + return setAny("attachments", attachments); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(@Nullable Object tags) { + return setAny("tags", tags); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The reply_to field. + * + * @param replyTo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder replyTo(@Nullable CaseCollaborationCaseNoteReply replyTo) { + return setNullable("reply_to", Conv.model(CaseCollaborationCaseNoteReply::fromJson), replyTo); + } + + /** + * The is_pinned field. + * + * @param isPinned the value + * @return this builder + */ + public Builder isPinned(boolean isPinned) { + return set("is_pinned", Conv.BOOLEAN, isPinned); + } + + /** + * The client_reference field. + * + * @param clientReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder clientReference(@Nullable String clientReference) { + return setNullable("client_reference", Conv.STRING, clientReference); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseCollaborationCaseNote} + * @throws IllegalStateException when a required field is missing + */ + public CaseCollaborationCaseNote build() { + require("uuid", false); + require("comment", false); + require("created_at", false); + require("reply_to", true); + return new CaseCollaborationCaseNote(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseCollaborationCaseNoteCreateRequest.java b/src/main/java/me/didit/types/CaseCollaborationCaseNoteCreateRequest.java new file mode 100644 index 0000000..069399c --- /dev/null +++ b/src/main/java/me/didit/types/CaseCollaborationCaseNoteCreateRequest.java @@ -0,0 +1,221 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseCollaborationCaseNoteCreateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("comment", "reply_to", "client_reference", "mentioned_emails", "is_internal", "attachments", "tags"); + + private CaseCollaborationCaseNoteCreateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseCollaborationCaseNoteCreateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseCollaborationCaseNoteCreateRequest fromJson(JsonNode json) { + return new CaseCollaborationCaseNoteCreateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The comment field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String comment() { + return Json.required(json, "comment", Conv.STRING); + } + + /** + * The reply_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional replyTo() { + return Json.optional(json, "reply_to", Conv.STRING); + } + + /** + * The client_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientReference() { + return Json.optional(json, "client_reference", Conv.STRING); + } + + /** + * The mentioned_emails field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> mentionedEmails() { + return Json.optional(json, "mentioned_emails", Conv.list(Conv.STRING)); + } + + /** + * The is_internal field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isInternal() { + return Json.optional(json, "is_internal", Conv.BOOLEAN); + } + + /** + * The attachments field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> attachments() { + return Json.optional(json, "attachments", Conv.list(Conv.OBJECT)); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseCollaborationCaseNoteCreateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseCollaborationCaseNoteCreateRequest from) { + super(from); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * The reply_to field. + * + * @param replyTo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder replyTo(@Nullable String replyTo) { + return setNullable("reply_to", Conv.STRING, replyTo); + } + + /** + * The client_reference field. + * + * @param clientReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder clientReference(@Nullable String clientReference) { + return setNullable("client_reference", Conv.STRING, clientReference); + } + + /** + * The mentioned_emails field. + * + * @param mentionedEmails the value + * @return this builder + */ + public Builder mentionedEmails(List mentionedEmails) { + return set("mentioned_emails", Conv.list(Conv.STRING), mentionedEmails); + } + + /** + * The is_internal field. + * + * @param isInternal the value + * @return this builder + */ + public Builder isInternal(boolean isInternal) { + return set("is_internal", Conv.BOOLEAN, isInternal); + } + + /** + * The attachments field. + * + * @param attachments the value + * @return this builder + */ + public Builder attachments(List> attachments) { + return setAny("attachments", attachments); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseCollaborationCaseNoteCreateRequest} + * @throws IllegalStateException when a required field is missing + */ + public CaseCollaborationCaseNoteCreateRequest build() { + require("comment", false); + return new CaseCollaborationCaseNoteCreateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseCollaborationCaseNoteReply.java b/src/main/java/me/didit/types/CaseCollaborationCaseNoteReply.java new file mode 100644 index 0000000..d93e011 --- /dev/null +++ b/src/main/java/me/didit/types/CaseCollaborationCaseNoteReply.java @@ -0,0 +1,164 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseCollaborationCaseNoteReply extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "actor_name", "actor_email", "comment"); + + private CaseCollaborationCaseNoteReply(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseCollaborationCaseNoteReply} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseCollaborationCaseNoteReply fromJson(JsonNode json) { + return new CaseCollaborationCaseNoteReply(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The actor_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorName() { + return Json.optional(json, "actor_name", Conv.STRING); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The comment field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String comment() { + return Json.required(json, "comment", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseCollaborationCaseNoteReply}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseCollaborationCaseNoteReply from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The actor_name field. + * + * @param actorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorName(@Nullable String actorName) { + return setNullable("actor_name", Conv.STRING, actorName); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseCollaborationCaseNoteReply} + * @throws IllegalStateException when a required field is missing + */ + public CaseCollaborationCaseNoteReply build() { + require("uuid", false); + require("actor_name", true); + require("actor_email", true); + require("comment", false); + return new CaseCollaborationCaseNoteReply(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseCollaborationPaginatedCaseNoteList.java b/src/main/java/me/didit/types/CaseCollaborationPaginatedCaseNoteList.java new file mode 100644 index 0000000..b766d47 --- /dev/null +++ b/src/main/java/me/didit/types/CaseCollaborationPaginatedCaseNoteList.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseCollaborationPaginatedCaseNoteList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CaseCollaborationPaginatedCaseNoteList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseCollaborationPaginatedCaseNoteList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseCollaborationPaginatedCaseNoteList fromJson(JsonNode json) { + return new CaseCollaborationPaginatedCaseNoteList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(CaseCollaborationCaseNote::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseCollaborationPaginatedCaseNoteList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseCollaborationPaginatedCaseNoteList from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseCollaborationCaseNote::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseCollaborationPaginatedCaseNoteList} + * @throws IllegalStateException when a required field is missing + */ + public CaseCollaborationPaginatedCaseNoteList build() { + require("count", false); + require("results", false); + return new CaseCollaborationPaginatedCaseNoteList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseCollaborationPatchedCaseNoteUpdateRequest.java b/src/main/java/me/didit/types/CaseCollaborationPatchedCaseNoteUpdateRequest.java new file mode 100644 index 0000000..c3903ad --- /dev/null +++ b/src/main/java/me/didit/types/CaseCollaborationPatchedCaseNoteUpdateRequest.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseCollaborationPatchedCaseNoteUpdateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_pinned"); + + private CaseCollaborationPatchedCaseNoteUpdateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseCollaborationPatchedCaseNoteUpdateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseCollaborationPatchedCaseNoteUpdateRequest fromJson(JsonNode json) { + return new CaseCollaborationPatchedCaseNoteUpdateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The is_pinned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isPinned() { + return Json.optional(json, "is_pinned", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseCollaborationPatchedCaseNoteUpdateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseCollaborationPatchedCaseNoteUpdateRequest from) { + super(from); + } + + /** + * The is_pinned field. + * + * @param isPinned the value + * @return this builder + */ + public Builder isPinned(boolean isPinned) { + return set("is_pinned", Conv.BOOLEAN, isPinned); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseCollaborationPatchedCaseNoteUpdateRequest} + */ + public CaseCollaborationPatchedCaseNoteUpdateRequest build() { + return new CaseCollaborationPatchedCaseNoteUpdateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseContentConfig.java b/src/main/java/me/didit/types/CaseContentConfig.java new file mode 100644 index 0000000..bd2ac4d --- /dev/null +++ b/src/main/java/me/didit/types/CaseContentConfig.java @@ -0,0 +1,1096 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + */ +public final class CaseContentConfig extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("checklist", "aml_control", "identity", "verifications", "reporting", "financial"); + + private CaseContentConfig(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseContentConfig} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseContentConfig fromJson(JsonNode json) { + return new CaseContentConfig(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The checklist field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional checklist() { + return Json.optional(json, "checklist", Conv.model(CaseContentConfig.Checklist::fromJson)); + } + + /** + * The aml_control field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlControl() { + return Json.optional(json, "aml_control", Conv.model(CaseContentConfig.AmlControl::fromJson)); + } + + /** + * The identity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identity() { + return Json.optional(json, "identity", Conv.model(CaseContentConfig.Identity::fromJson)); + } + + /** + * The verifications field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifications() { + return Json.optional(json, "verifications", Conv.model(CaseContentConfig.Verifications::fromJson)); + } + + /** + * The reporting field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reporting() { + return Json.optional(json, "reporting", Conv.model(CaseContentConfig.Reporting::fromJson)); + } + + /** + * The financial field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional financial() { + return Json.optional(json, "financial", Conv.model(CaseContentConfig.Financial::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseContentConfig}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseContentConfig from) { + super(from); + } + + /** + * The checklist field. + * + * @param checklist the value + * @return this builder + */ + public Builder checklist(CaseContentConfig.Checklist checklist) { + return set("checklist", Conv.model(CaseContentConfig.Checklist::fromJson), checklist); + } + + /** + * The aml_control field. + * + * @param amlControl the value + * @return this builder + */ + public Builder amlControl(CaseContentConfig.AmlControl amlControl) { + return set("aml_control", Conv.model(CaseContentConfig.AmlControl::fromJson), amlControl); + } + + /** + * The identity field. + * + * @param identity the value + * @return this builder + */ + public Builder identity(CaseContentConfig.Identity identity) { + return set("identity", Conv.model(CaseContentConfig.Identity::fromJson), identity); + } + + /** + * The verifications field. + * + * @param verifications the value + * @return this builder + */ + public Builder verifications(CaseContentConfig.Verifications verifications) { + return set("verifications", Conv.model(CaseContentConfig.Verifications::fromJson), verifications); + } + + /** + * The reporting field. + * + * @param reporting the value + * @return this builder + */ + public Builder reporting(CaseContentConfig.Reporting reporting) { + return set("reporting", Conv.model(CaseContentConfig.Reporting::fromJson), reporting); + } + + /** + * The financial field. + * + * @param financial the value + * @return this builder + */ + public Builder financial(CaseContentConfig.Financial financial) { + return set("financial", Conv.model(CaseContentConfig.Financial::fromJson), financial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseContentConfig} + */ + public CaseContentConfig build() { + return new CaseContentConfig(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Checklist extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "optional", "items"); + + private Checklist(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Checklist} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Checklist fromJson(JsonNode json) { + return new Checklist(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * When true, a case can be resolved with incomplete checklist items. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional optional() { + return Json.optional(json, "optional", Conv.BOOLEAN); + } + + /** + * The items field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> items() { + return Json.optional(json, "items", Conv.list(Conv.model(CaseContentConfig.Checklist.Items::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Checklist}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Checklist from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * When true, a case can be resolved with incomplete checklist items. + * + * @param optional the value + * @return this builder + */ + public Builder optional(boolean optional) { + return set("optional", Conv.BOOLEAN, optional); + } + + /** + * The items field. + * + * @param items the value + * @return this builder + */ + public Builder items(List items) { + return set("items", Conv.list(Conv.model(CaseContentConfig.Checklist.Items::fromJson)), items); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Checklist} + */ + public Checklist build() { + return new Checklist(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Items extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("label", "order"); + + private Items(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Items} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Items fromJson(JsonNode json) { + return new Items(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The order field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional order() { + return Json.optional(json, "order", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Items}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Items from) { + super(from); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The order field. + * + * @param order the value + * @return this builder + */ + public Builder order(long order) { + return set("order", Conv.LONG, order); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Items} + */ + public Items build() { + return new Items(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class AmlControl extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "financial", "identity"); + + private AmlControl(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AmlControl} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AmlControl fromJson(JsonNode json) { + return new AmlControl(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The financial field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional financial() { + return Json.optional(json, "financial", Conv.BOOLEAN); + } + + /** + * The identity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identity() { + return Json.optional(json, "identity", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AmlControl}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AmlControl from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The financial field. + * + * @param financial the value + * @return this builder + */ + public Builder financial(boolean financial) { + return set("financial", Conv.BOOLEAN, financial); + } + + /** + * The identity field. + * + * @param identity the value + * @return this builder + */ + public Builder identity(boolean identity) { + return set("identity", Conv.BOOLEAN, identity); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AmlControl} + */ + public AmlControl build() { + return new AmlControl(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Identity extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "personal_information", "applicant_tags", "contact_information", "risk_overview", "poi_documents", "poa_documents"); + + private Identity(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Identity} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Identity fromJson(JsonNode json) { + return new Identity(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The personal_information field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalInformation() { + return Json.optional(json, "personal_information", Conv.BOOLEAN); + } + + /** + * The applicant_tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional applicantTags() { + return Json.optional(json, "applicant_tags", Conv.BOOLEAN); + } + + /** + * The contact_information field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contactInformation() { + return Json.optional(json, "contact_information", Conv.BOOLEAN); + } + + /** + * The risk_overview field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskOverview() { + return Json.optional(json, "risk_overview", Conv.BOOLEAN); + } + + /** + * The poi_documents field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poiDocuments() { + return Json.optional(json, "poi_documents", Conv.BOOLEAN); + } + + /** + * The poa_documents field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaDocuments() { + return Json.optional(json, "poa_documents", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Identity}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Identity from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The personal_information field. + * + * @param personalInformation the value + * @return this builder + */ + public Builder personalInformation(boolean personalInformation) { + return set("personal_information", Conv.BOOLEAN, personalInformation); + } + + /** + * The applicant_tags field. + * + * @param applicantTags the value + * @return this builder + */ + public Builder applicantTags(boolean applicantTags) { + return set("applicant_tags", Conv.BOOLEAN, applicantTags); + } + + /** + * The contact_information field. + * + * @param contactInformation the value + * @return this builder + */ + public Builder contactInformation(boolean contactInformation) { + return set("contact_information", Conv.BOOLEAN, contactInformation); + } + + /** + * The risk_overview field. + * + * @param riskOverview the value + * @return this builder + */ + public Builder riskOverview(boolean riskOverview) { + return set("risk_overview", Conv.BOOLEAN, riskOverview); + } + + /** + * The poi_documents field. + * + * @param poiDocuments the value + * @return this builder + */ + public Builder poiDocuments(boolean poiDocuments) { + return set("poi_documents", Conv.BOOLEAN, poiDocuments); + } + + /** + * The poa_documents field. + * + * @param poaDocuments the value + * @return this builder + */ + public Builder poaDocuments(boolean poaDocuments) { + return set("poa_documents", Conv.BOOLEAN, poaDocuments); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Identity} + */ + public Identity build() { + return new Identity(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Verifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "summary"); + + private Verifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Verifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Verifications fromJson(JsonNode json) { + return new Verifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Verifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Verifications from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The summary field. + * + * @param summary the value + * @return this builder + */ + public Builder summary(boolean summary) { + return set("summary", Conv.BOOLEAN, summary); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Verifications} + */ + public Verifications build() { + return new Verifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Reporting extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "fiu_reports"); + + private Reporting(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Reporting} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Reporting fromJson(JsonNode json) { + return new Reporting(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The fiu_reports field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fiuReports() { + return Json.optional(json, "fiu_reports", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Reporting}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Reporting from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The fiu_reports field. + * + * @param fiuReports the value + * @return this builder + */ + public Builder fiuReports(boolean fiuReports) { + return set("fiu_reports", Conv.BOOLEAN, fiuReports); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Reporting} + */ + public Reporting build() { + return new Reporting(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Financial extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "payment_methods", "transactions"); + + private Financial(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Financial} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Financial fromJson(JsonNode json) { + return new Financial(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The payment_methods field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentMethods() { + return Json.optional(json, "payment_methods", Conv.BOOLEAN); + } + + /** + * The transactions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactions() { + return Json.optional(json, "transactions", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Financial}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Financial from) { + super(from); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The payment_methods field. + * + * @param paymentMethods the value + * @return this builder + */ + public Builder paymentMethods(boolean paymentMethods) { + return set("payment_methods", Conv.BOOLEAN, paymentMethods); + } + + /** + * The transactions field. + * + * @param transactions the value + * @return this builder + */ + public Builder transactions(boolean transactions) { + return set("transactions", Conv.BOOLEAN, transactions); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Financial} + */ + public Financial build() { + return new Financial(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CaseDetail.java b/src/main/java/me/didit/types/CaseDetail.java new file mode 100644 index 0000000..cd74a17 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDetail.java @@ -0,0 +1,1011 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "case_number", "title", "status", "resolution", "resolution_notes", "priority", "source", "tags", "subject", "assigned_to", "assigned_at", "due_at", "resolved_at", "resolved_by_email", "pending_resolution", "metadata", "blueprint", "notes", "events", "links", "links_count", "notes_count", "checklist_items", "created_at", "updated_at"); + + private CaseDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDetail fromJson(JsonNode json) { + return new CaseDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The case_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseNumber() { + return Json.optional(json, "case_number", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(CaseDetail.Status::of)); + } + + /** + * The resolution field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolution() { + return Json.optional(json, "resolution", Conv.enumeration(CaseDetail.Resolution::of)); + } + + /** + * The resolution_notes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolutionNotes() { + return Json.optional(json, "resolution_notes", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CaseDetail.Priority::of)); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(CaseDetail.Source::of)); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * The single user or business the case is anchored to. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subject() { + return Json.optional(json, "subject", Conv.model(CaseSubject::fromJson)); + } + + /** + * The assigned_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedTo() { + return Json.optional(json, "assigned_to", Conv.model(CaseAssignee::fromJson)); + } + + /** + * The assigned_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedAt() { + return Json.optional(json, "assigned_at", Conv.DATE_TIME); + } + + /** + * The due_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dueAt() { + return Json.optional(json, "due_at", Conv.DATE_TIME); + } + + /** + * The resolved_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolvedAt() { + return Json.optional(json, "resolved_at", Conv.DATE_TIME); + } + + /** + * The resolved_by_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolvedByEmail() { + return Json.optional(json, "resolved_by_email", Conv.STRING); + } + + /** + * Set only while a 4-eyes resolution is staged on the checker blueprint, awaiting approve or reject-approval. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pendingResolution() { + return Json.optional(json, "pending_resolution", Conv.model(CaseDetail.PendingResolution::fromJson)); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.model(CaseBlueprintDetail::fromJson)); + } + + /** + * Newest 50 notes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> notes() { + return Json.optional(json, "notes", Conv.list(Conv.model(CaseNote::fromJson))); + } + + /** + * Newest 100 events. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> events() { + return Json.optional(json, "events", Conv.list(Conv.model(CaseEvent::fromJson))); + } + + /** + * The links field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> links() { + return Json.optional(json, "links", Conv.list(Conv.model(CaseLink::fromJson))); + } + + /** + * The links_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional linksCount() { + return Json.optional(json, "links_count", Conv.LONG); + } + + /** + * The notes_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional notesCount() { + return Json.optional(json, "notes_count", Conv.LONG); + } + + /** + * The checklist_items field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> checklistItems() { + return Json.optional(json, "checklist_items", Conv.list(Conv.model(CaseChecklistItem::fromJson))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The case_number field. + * + * @param caseNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder caseNumber(@Nullable String caseNumber) { + return setNullable("case_number", Conv.STRING, caseNumber); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(CaseDetail.Status status) { + return set("status", Conv.enumeration(CaseDetail.Status::of), status); + } + + /** + * The resolution field. + * + * @param resolution the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolution(CaseDetail.@Nullable Resolution resolution) { + return setNullable("resolution", Conv.enumeration(CaseDetail.Resolution::of), resolution); + } + + /** + * The resolution_notes field. + * + * @param resolutionNotes the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolutionNotes(@Nullable String resolutionNotes) { + return setNullable("resolution_notes", Conv.STRING, resolutionNotes); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(CaseDetail.Priority priority) { + return set("priority", Conv.enumeration(CaseDetail.Priority::of), priority); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(CaseDetail.Source source) { + return set("source", Conv.enumeration(CaseDetail.Source::of), source); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * The single user or business the case is anchored to. + * + * @param subject the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subject(@Nullable CaseSubject subject) { + return setNullable("subject", Conv.model(CaseSubject::fromJson), subject); + } + + /** + * The assigned_to field. + * + * @param assignedTo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assignedTo(@Nullable CaseAssignee assignedTo) { + return setNullable("assigned_to", Conv.model(CaseAssignee::fromJson), assignedTo); + } + + /** + * The assigned_at field. + * + * @param assignedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assignedAt(@Nullable OffsetDateTime assignedAt) { + return setNullable("assigned_at", Conv.DATE_TIME, assignedAt); + } + + /** + * The due_at field. + * + * @param dueAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dueAt(@Nullable OffsetDateTime dueAt) { + return setNullable("due_at", Conv.DATE_TIME, dueAt); + } + + /** + * The resolved_at field. + * + * @param resolvedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolvedAt(@Nullable OffsetDateTime resolvedAt) { + return setNullable("resolved_at", Conv.DATE_TIME, resolvedAt); + } + + /** + * The resolved_by_email field. + * + * @param resolvedByEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolvedByEmail(@Nullable String resolvedByEmail) { + return setNullable("resolved_by_email", Conv.STRING, resolvedByEmail); + } + + /** + * Set only while a 4-eyes resolution is staged on the checker blueprint, awaiting approve or reject-approval. + * + * @param pendingResolution the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder pendingResolution(CaseDetail.@Nullable PendingResolution pendingResolution) { + return setNullable("pending_resolution", Conv.model(CaseDetail.PendingResolution::fromJson), pendingResolution); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The blueprint field. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(CaseBlueprintDetail blueprint) { + return set("blueprint", Conv.model(CaseBlueprintDetail::fromJson), blueprint); + } + + /** + * Newest 50 notes. + * + * @param notes the value + * @return this builder + */ + public Builder notes(List notes) { + return set("notes", Conv.list(Conv.model(CaseNote::fromJson)), notes); + } + + /** + * Newest 100 events. + * + * @param events the value + * @return this builder + */ + public Builder events(List events) { + return set("events", Conv.list(Conv.model(CaseEvent::fromJson)), events); + } + + /** + * The links field. + * + * @param links the value + * @return this builder + */ + public Builder links(List links) { + return set("links", Conv.list(Conv.model(CaseLink::fromJson)), links); + } + + /** + * The links_count field. + * + * @param linksCount the value + * @return this builder + */ + public Builder linksCount(long linksCount) { + return set("links_count", Conv.LONG, linksCount); + } + + /** + * The notes_count field. + * + * @param notesCount the value + * @return this builder + */ + public Builder notesCount(long notesCount) { + return set("notes_count", Conv.LONG, notesCount); + } + + /** + * The checklist_items field. + * + * @param checklistItems the value + * @return this builder + */ + public Builder checklistItems(List checklistItems) { + return set("checklist_items", Conv.list(Conv.model(CaseChecklistItem::fromJson)), checklistItems); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDetail} + */ + public CaseDetail build() { + return new CaseDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final Status OPEN = new Status("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final Status RESOLVED = new Status("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Resolution extends StringEnum { + /** The value {@code "FALSE_POSITIVE"}. */ + public static final Resolution FALSE_POSITIVE = new Resolution("FALSE_POSITIVE"); + + /** The value {@code "VALID_THREAT"}. */ + public static final Resolution VALID_THREAT = new Resolution("VALID_THREAT"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, VALID_THREAT); + + private Resolution(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Resolution of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Resolution::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Priority extends StringEnum { + /** The value {@code "LOW"}. */ + public static final Priority LOW = new Priority("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Priority MEDIUM = new Priority("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Priority HIGH = new Priority("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Priority(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Priority of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Priority::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final Source MANUAL = new Source("MANUAL"); + + /** The value {@code "AML_SCREENING"}. */ + public static final Source AML_SCREENING = new Source("AML_SCREENING"); + + /** The value {@code "TRANSACTION_RULE"}. */ + public static final Source TRANSACTION_RULE = new Source("TRANSACTION_RULE"); + + /** The value {@code "WORKFLOW_BUILDER"}. */ + public static final Source WORKFLOW_BUILDER = new Source("WORKFLOW_BUILDER"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AML_SCREENING, TRANSACTION_RULE, WORKFLOW_BUILDER); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Set only while a 4-eyes resolution is staged on the checker blueprint, awaiting approve or reject-approval. + */ + public static final class PendingResolution extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("resolution", "resolution_notes", "maker_email", "maker_name", "maker_blueprint_id", "staged_at"); + + private PendingResolution(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PendingResolution} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PendingResolution fromJson(JsonNode json) { + return new PendingResolution(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The resolution field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolution() { + return Json.optional(json, "resolution", Conv.enumeration(CaseDetail.PendingResolution.Resolution::of)); + } + + /** + * The resolution_notes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolutionNotes() { + return Json.optional(json, "resolution_notes", Conv.STRING); + } + + /** + * The maker_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional makerEmail() { + return Json.optional(json, "maker_email", Conv.STRING); + } + + /** + * The maker_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional makerName() { + return Json.optional(json, "maker_name", Conv.STRING); + } + + /** + * The maker_blueprint_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional makerBlueprintId() { + return Json.optional(json, "maker_blueprint_id", Conv.STRING); + } + + /** + * The staged_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional stagedAt() { + return Json.optional(json, "staged_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PendingResolution}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PendingResolution from) { + super(from); + } + + /** + * The resolution field. + * + * @param resolution the value + * @return this builder + */ + public Builder resolution(CaseDetail.PendingResolution.Resolution resolution) { + return set("resolution", Conv.enumeration(CaseDetail.PendingResolution.Resolution::of), resolution); + } + + /** + * The resolution_notes field. + * + * @param resolutionNotes the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolutionNotes(@Nullable String resolutionNotes) { + return setNullable("resolution_notes", Conv.STRING, resolutionNotes); + } + + /** + * The maker_email field. + * + * @param makerEmail the value + * @return this builder + */ + public Builder makerEmail(String makerEmail) { + return set("maker_email", Conv.STRING, makerEmail); + } + + /** + * The maker_name field. + * + * @param makerName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder makerName(@Nullable String makerName) { + return setNullable("maker_name", Conv.STRING, makerName); + } + + /** + * The maker_blueprint_id field. + * + * @param makerBlueprintId the value + * @return this builder + */ + public Builder makerBlueprintId(String makerBlueprintId) { + return set("maker_blueprint_id", Conv.STRING, makerBlueprintId); + } + + /** + * The staged_at field. + * + * @param stagedAt the value + * @return this builder + */ + public Builder stagedAt(OffsetDateTime stagedAt) { + return set("staged_at", Conv.DATE_TIME, stagedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PendingResolution} + */ + public PendingResolution build() { + return new PendingResolution(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Resolution extends StringEnum { + /** The value {@code "FALSE_POSITIVE"}. */ + public static final Resolution FALSE_POSITIVE = new Resolution("FALSE_POSITIVE"); + + /** The value {@code "VALID_THREAT"}. */ + public static final Resolution VALID_THREAT = new Resolution("VALID_THREAT"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, VALID_THREAT); + + private Resolution(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Resolution of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Resolution::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateBlankEnum.java b/src/main/java/me/didit/types/CaseDuplicateBlankEnum.java new file mode 100644 index 0000000..0a2fa00 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateBlankEnum.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicateBlankEnum extends StringEnum { + /** The value {@code ""}. */ + public static final CaseDuplicateBlankEnum EMPTY = new CaseDuplicateBlankEnum(""); + + private static final List KNOWN_VALUES = List.of(EMPTY); + + private CaseDuplicateBlankEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicateBlankEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicateBlankEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseDuplicate.java b/src/main/java/me/didit/types/CaseDuplicateCaseDuplicate.java new file mode 100644 index 0000000..9fd2684 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseDuplicate.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseDuplicateCaseDuplicate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "case_number", "title", "status", "priority", "created_at"); + + private CaseDuplicateCaseDuplicate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseDuplicate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseDuplicate fromJson(JsonNode json) { + return new CaseDuplicateCaseDuplicate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The case_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseNumber() { + return Json.optional(json, "case_number", Conv.STRING); + } + + /** + * The title field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String title() { + return Json.required(json, "title", Conv.STRING); + } + + /** + * - OPEN - Open + * - AWAITING_USER - Awaiting user + * - RESOLVED - Resolved + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(CaseDuplicateStatusEnum::of)); + } + + /** + * - LOW - Low + * - MEDIUM - Medium + * - HIGH - High + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CaseDuplicatePriorityEnum::of)); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseDuplicate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseDuplicate from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The case_number field. + * + * @param caseNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder caseNumber(@Nullable String caseNumber) { + return setNullable("case_number", Conv.STRING, caseNumber); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * - OPEN - Open + * - AWAITING_USER - Awaiting user + * - RESOLVED - Resolved + * + * @param status the value + * @return this builder + */ + public Builder status(CaseDuplicateStatusEnum status) { + return set("status", Conv.enumeration(CaseDuplicateStatusEnum::of), status); + } + + /** + * - LOW - Low + * - MEDIUM - Medium + * - HIGH - High + * + * @param priority the value + * @return this builder + */ + public Builder priority(CaseDuplicatePriorityEnum priority) { + return set("priority", Conv.enumeration(CaseDuplicatePriorityEnum::of), priority); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseDuplicate} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseDuplicate build() { + require("uuid", false); + require("title", false); + require("created_at", false); + return new CaseDuplicateCaseDuplicate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseDuplicatePage.java b/src/main/java/me/didit/types/CaseDuplicateCaseDuplicatePage.java new file mode 100644 index 0000000..abd4226 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseDuplicatePage.java @@ -0,0 +1,143 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseDuplicateCaseDuplicatePage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next_offset", "results"); + + private CaseDuplicateCaseDuplicatePage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseDuplicatePage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseDuplicatePage fromJson(JsonNode json) { + return new CaseDuplicateCaseDuplicatePage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * The next_offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nextOffset() { + return Json.optional(json, "next_offset", Conv.LONG); + } + + /** + * The results field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(CaseDuplicateCaseDuplicate::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseDuplicatePage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseDuplicatePage from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next_offset field. + * + * @param nextOffset the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nextOffset(@Nullable Long nextOffset) { + return setNullable("next_offset", Conv.LONG, nextOffset); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseDuplicateCaseDuplicate::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseDuplicatePage} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseDuplicatePage build() { + require("count", false); + require("next_offset", true); + require("results", false); + return new CaseDuplicateCaseDuplicatePage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseDuplicateQueryRequest.java b/src/main/java/me/didit/types/CaseDuplicateCaseDuplicateQueryRequest.java new file mode 100644 index 0000000..074fe00 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseDuplicateQueryRequest.java @@ -0,0 +1,138 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseDuplicateCaseDuplicateQueryRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("subject", "links", "offset"); + + private CaseDuplicateCaseDuplicateQueryRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseDuplicateQueryRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseDuplicateQueryRequest fromJson(JsonNode json) { + return new CaseDuplicateCaseDuplicateQueryRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The subject field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subject() { + return Json.optional(json, "subject", Conv.model(CaseDuplicateCaseSubjectInputRequest::fromJson)); + } + + /** + * The links field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> links() { + return Json.optional(json, "links", Conv.list(Conv.model(CaseDuplicateCaseLinkCreateRequest::fromJson))); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseDuplicateQueryRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseDuplicateQueryRequest from) { + super(from); + } + + /** + * The subject field. + * + * @param subject the value + * @return this builder + */ + public Builder subject(CaseDuplicateCaseSubjectInputRequest subject) { + return set("subject", Conv.model(CaseDuplicateCaseSubjectInputRequest::fromJson), subject); + } + + /** + * The links field. + * + * @param links the value + * @return this builder + */ + public Builder links(List links) { + return set("links", Conv.list(Conv.model(CaseDuplicateCaseLinkCreateRequest::fromJson)), links); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseDuplicateQueryRequest} + */ + public CaseDuplicateCaseDuplicateQueryRequest build() { + return new CaseDuplicateCaseDuplicateQueryRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseFraudSourceContext.java b/src/main/java/me/didit/types/CaseDuplicateCaseFraudSourceContext.java new file mode 100644 index 0000000..8ceee01 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseFraudSourceContext.java @@ -0,0 +1,141 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseDuplicateCaseFraudSourceContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("check_id", "request_id", "source_section"); + + private CaseDuplicateCaseFraudSourceContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseFraudSourceContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseFraudSourceContext fromJson(JsonNode json) { + return new CaseDuplicateCaseFraudSourceContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The check_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String checkId() { + return Json.required(json, "check_id", Conv.STRING); + } + + /** + * The request_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * The source_section field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sourceSection() { + return Json.required(json, "source_section", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseFraudSourceContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseFraudSourceContext from) { + super(from); + } + + /** + * The check_id field. + * + * @param checkId the value + * @return this builder + */ + public Builder checkId(String checkId) { + return set("check_id", Conv.STRING, checkId); + } + + /** + * The request_id field. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The source_section field. + * + * @param sourceSection the value + * @return this builder + */ + public Builder sourceSection(String sourceSection) { + return set("source_section", Conv.STRING, sourceSection); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseFraudSourceContext} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseFraudSourceContext build() { + require("check_id", false); + require("request_id", false); + require("source_section", false); + return new CaseDuplicateCaseFraudSourceContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseFraudSourceContextRequest.java b/src/main/java/me/didit/types/CaseDuplicateCaseFraudSourceContextRequest.java new file mode 100644 index 0000000..a6dd681 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseFraudSourceContextRequest.java @@ -0,0 +1,141 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseDuplicateCaseFraudSourceContextRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("check_id", "request_id", "source_section"); + + private CaseDuplicateCaseFraudSourceContextRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseFraudSourceContextRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseFraudSourceContextRequest fromJson(JsonNode json) { + return new CaseDuplicateCaseFraudSourceContextRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The check_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String checkId() { + return Json.required(json, "check_id", Conv.STRING); + } + + /** + * The request_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * The source_section field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sourceSection() { + return Json.required(json, "source_section", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseFraudSourceContextRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseFraudSourceContextRequest from) { + super(from); + } + + /** + * The check_id field. + * + * @param checkId the value + * @return this builder + */ + public Builder checkId(String checkId) { + return set("check_id", Conv.STRING, checkId); + } + + /** + * The request_id field. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The source_section field. + * + * @param sourceSection the value + * @return this builder + */ + public Builder sourceSection(String sourceSection) { + return set("source_section", Conv.STRING, sourceSection); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseFraudSourceContextRequest} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseFraudSourceContextRequest build() { + require("check_id", false); + require("request_id", false); + require("source_section", false); + return new CaseDuplicateCaseFraudSourceContextRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseLinkCreateRequest.java b/src/main/java/me/didit/types/CaseDuplicateCaseLinkCreateRequest.java new file mode 100644 index 0000000..a0f4445 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseLinkCreateRequest.java @@ -0,0 +1,124 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseDuplicateCaseLinkCreateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entity_type", "entity_uuid"); + + private CaseDuplicateCaseLinkCreateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseLinkCreateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseLinkCreateRequest fromJson(JsonNode json) { + return new CaseDuplicateCaseLinkCreateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - session - Session + * - business_session - Business Session + * - transaction - Transaction + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseDuplicateEntityTypeEnum entityType() { + return Json.required(json, "entity_type", Conv.enumeration(CaseDuplicateEntityTypeEnum::of)); + } + + /** + * The entity_uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String entityUuid() { + return Json.required(json, "entity_uuid", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseLinkCreateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseLinkCreateRequest from) { + super(from); + } + + /** + * - session - Session + * - business_session - Business Session + * - transaction - Transaction + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(CaseDuplicateEntityTypeEnum entityType) { + return set("entity_type", Conv.enumeration(CaseDuplicateEntityTypeEnum::of), entityType); + } + + /** + * The entity_uuid field. + * + * @param entityUuid the value + * @return this builder + */ + public Builder entityUuid(String entityUuid) { + return set("entity_uuid", Conv.STRING, entityUuid); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseLinkCreateRequest} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseLinkCreateRequest build() { + require("entity_type", false); + require("entity_uuid", false); + return new CaseDuplicateCaseLinkCreateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseSubjectInput.java b/src/main/java/me/didit/types/CaseDuplicateCaseSubjectInput.java new file mode 100644 index 0000000..f68f426 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseSubjectInput.java @@ -0,0 +1,122 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseDuplicateCaseSubjectInput extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "uuid"); + + private CaseDuplicateCaseSubjectInput(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseSubjectInput} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseSubjectInput fromJson(JsonNode json) { + return new CaseDuplicateCaseSubjectInput(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - user - user + * - business - business + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseDuplicateTypeEnum type() { + return Json.required(json, "type", Conv.enumeration(CaseDuplicateTypeEnum::of)); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseSubjectInput}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseSubjectInput from) { + super(from); + } + + /** + * - user - user + * - business - business + * + * @param type the value + * @return this builder + */ + public Builder type(CaseDuplicateTypeEnum type) { + return set("type", Conv.enumeration(CaseDuplicateTypeEnum::of), type); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseSubjectInput} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseSubjectInput build() { + require("type", false); + require("uuid", false); + return new CaseDuplicateCaseSubjectInput(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateCaseSubjectInputRequest.java b/src/main/java/me/didit/types/CaseDuplicateCaseSubjectInputRequest.java new file mode 100644 index 0000000..26f3ae0 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateCaseSubjectInputRequest.java @@ -0,0 +1,122 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseDuplicateCaseSubjectInputRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "uuid"); + + private CaseDuplicateCaseSubjectInputRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDuplicateCaseSubjectInputRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDuplicateCaseSubjectInputRequest fromJson(JsonNode json) { + return new CaseDuplicateCaseSubjectInputRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - user - user + * - business - business + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseDuplicateTypeEnum type() { + return Json.required(json, "type", Conv.enumeration(CaseDuplicateTypeEnum::of)); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDuplicateCaseSubjectInputRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDuplicateCaseSubjectInputRequest from) { + super(from); + } + + /** + * - user - user + * - business - business + * + * @param type the value + * @return this builder + */ + public Builder type(CaseDuplicateTypeEnum type) { + return set("type", Conv.enumeration(CaseDuplicateTypeEnum::of), type); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDuplicateCaseSubjectInputRequest} + * @throws IllegalStateException when a required field is missing + */ + public CaseDuplicateCaseSubjectInputRequest build() { + require("type", false); + require("uuid", false); + return new CaseDuplicateCaseSubjectInputRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateEntityTypeEnum.java b/src/main/java/me/didit/types/CaseDuplicateEntityTypeEnum.java new file mode 100644 index 0000000..f1b884b --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateEntityTypeEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - session - Session + * - business_session - Business Session + * - transaction - Transaction + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicateEntityTypeEnum extends StringEnum { + /** The value {@code "session"}. */ + public static final CaseDuplicateEntityTypeEnum SESSION = new CaseDuplicateEntityTypeEnum("session"); + + /** The value {@code "business_session"}. */ + public static final CaseDuplicateEntityTypeEnum BUSINESS_SESSION = new CaseDuplicateEntityTypeEnum("business_session"); + + /** The value {@code "transaction"}. */ + public static final CaseDuplicateEntityTypeEnum TRANSACTION = new CaseDuplicateEntityTypeEnum("transaction"); + + private static final List KNOWN_VALUES = List.of(SESSION, BUSINESS_SESSION, TRANSACTION); + + private CaseDuplicateEntityTypeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicateEntityTypeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicateEntityTypeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicatePriorityEnum.java b/src/main/java/me/didit/types/CaseDuplicatePriorityEnum.java new file mode 100644 index 0000000..c26fc04 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicatePriorityEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - LOW - Low + * - MEDIUM - Medium + * - HIGH - High + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicatePriorityEnum extends StringEnum { + /** The value {@code "LOW"}. */ + public static final CaseDuplicatePriorityEnum LOW = new CaseDuplicatePriorityEnum("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final CaseDuplicatePriorityEnum MEDIUM = new CaseDuplicatePriorityEnum("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final CaseDuplicatePriorityEnum HIGH = new CaseDuplicatePriorityEnum("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private CaseDuplicatePriorityEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicatePriorityEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicatePriorityEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateResolutionEnum.java b/src/main/java/me/didit/types/CaseDuplicateResolutionEnum.java new file mode 100644 index 0000000..a2a7110 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateResolutionEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - FALSE_POSITIVE - False positive + * - VALID_THREAT - Valid threat + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicateResolutionEnum extends StringEnum { + /** The value {@code "FALSE_POSITIVE"}. */ + public static final CaseDuplicateResolutionEnum FALSE_POSITIVE = new CaseDuplicateResolutionEnum("FALSE_POSITIVE"); + + /** The value {@code "VALID_THREAT"}. */ + public static final CaseDuplicateResolutionEnum VALID_THREAT = new CaseDuplicateResolutionEnum("VALID_THREAT"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, VALID_THREAT); + + private CaseDuplicateResolutionEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicateResolutionEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicateResolutionEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateSourceEnum.java b/src/main/java/me/didit/types/CaseDuplicateSourceEnum.java new file mode 100644 index 0000000..8864209 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateSourceEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - MANUAL - Manual + * - AML_SCREENING - AML screening + * - TRANSACTION_RULE - Transaction rule + * - WORKFLOW_BUILDER - Workflow builder + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicateSourceEnum extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final CaseDuplicateSourceEnum MANUAL = new CaseDuplicateSourceEnum("MANUAL"); + + /** The value {@code "AML_SCREENING"}. */ + public static final CaseDuplicateSourceEnum AML_SCREENING = new CaseDuplicateSourceEnum("AML_SCREENING"); + + /** The value {@code "TRANSACTION_RULE"}. */ + public static final CaseDuplicateSourceEnum TRANSACTION_RULE = new CaseDuplicateSourceEnum("TRANSACTION_RULE"); + + /** The value {@code "WORKFLOW_BUILDER"}. */ + public static final CaseDuplicateSourceEnum WORKFLOW_BUILDER = new CaseDuplicateSourceEnum("WORKFLOW_BUILDER"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AML_SCREENING, TRANSACTION_RULE, WORKFLOW_BUILDER); + + private CaseDuplicateSourceEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicateSourceEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicateSourceEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateStatusEnum.java b/src/main/java/me/didit/types/CaseDuplicateStatusEnum.java new file mode 100644 index 0000000..932d95d --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateStatusEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - OPEN - Open + * - AWAITING_USER - Awaiting user + * - RESOLVED - Resolved + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicateStatusEnum extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final CaseDuplicateStatusEnum OPEN = new CaseDuplicateStatusEnum("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final CaseDuplicateStatusEnum AWAITING_USER = new CaseDuplicateStatusEnum("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final CaseDuplicateStatusEnum RESOLVED = new CaseDuplicateStatusEnum("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private CaseDuplicateStatusEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicateStatusEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicateStatusEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseDuplicateTypeEnum.java b/src/main/java/me/didit/types/CaseDuplicateTypeEnum.java new file mode 100644 index 0000000..94eeea9 --- /dev/null +++ b/src/main/java/me/didit/types/CaseDuplicateTypeEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - user - user + * - business - business + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CaseDuplicateTypeEnum extends StringEnum { + /** The value {@code "user"}. */ + public static final CaseDuplicateTypeEnum USER = new CaseDuplicateTypeEnum("user"); + + /** The value {@code "business"}. */ + public static final CaseDuplicateTypeEnum BUSINESS = new CaseDuplicateTypeEnum("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private CaseDuplicateTypeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseDuplicateTypeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseDuplicateTypeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CaseEvent.java b/src/main/java/me/didit/types/CaseEvent.java new file mode 100644 index 0000000..7885e51 --- /dev/null +++ b/src/main/java/me/didit/types/CaseEvent.java @@ -0,0 +1,436 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseEvent extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "event_type", "actor_email", "actor_name", "previous_status", "new_status", "metadata", "created_at"); + + private CaseEvent(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseEvent} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseEvent fromJson(JsonNode json) { + return new CaseEvent(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The event_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional eventType() { + return Json.optional(json, "event_type", Conv.enumeration(CaseEvent.EventType::of)); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The actor_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorName() { + return Json.optional(json, "actor_name", Conv.STRING); + } + + /** + * The previous_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previousStatus() { + return Json.optional(json, "previous_status", Conv.enumeration(CaseEvent.PreviousStatus::of)); + } + + /** + * The new_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.enumeration(CaseEvent.NewStatus::of)); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseEvent}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseEvent from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The event_type field. + * + * @param eventType the value + * @return this builder + */ + public Builder eventType(CaseEvent.EventType eventType) { + return set("event_type", Conv.enumeration(CaseEvent.EventType::of), eventType); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The actor_name field. + * + * @param actorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorName(@Nullable String actorName) { + return setNullable("actor_name", Conv.STRING, actorName); + } + + /** + * The previous_status field. + * + * @param previousStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previousStatus(CaseEvent.@Nullable PreviousStatus previousStatus) { + return setNullable("previous_status", Conv.enumeration(CaseEvent.PreviousStatus::of), previousStatus); + } + + /** + * The new_status field. + * + * @param newStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newStatus(CaseEvent.@Nullable NewStatus newStatus) { + return setNullable("new_status", Conv.enumeration(CaseEvent.NewStatus::of), newStatus); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseEvent} + */ + public CaseEvent build() { + return new CaseEvent(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EventType extends StringEnum { + /** The value {@code "CREATED"}. */ + public static final EventType CREATED = new EventType("CREATED"); + + /** The value {@code "STATUS_CHANGED"}. */ + public static final EventType STATUS_CHANGED = new EventType("STATUS_CHANGED"); + + /** The value {@code "ASSIGNED"}. */ + public static final EventType ASSIGNED = new EventType("ASSIGNED"); + + /** The value {@code "UNASSIGNED"}. */ + public static final EventType UNASSIGNED = new EventType("UNASSIGNED"); + + /** The value {@code "RESOLVED"}. */ + public static final EventType RESOLVED = new EventType("RESOLVED"); + + /** The value {@code "REOPENED"}. */ + public static final EventType REOPENED = new EventType("REOPENED"); + + /** The value {@code "LINK_ADDED"}. */ + public static final EventType LINK_ADDED = new EventType("LINK_ADDED"); + + /** The value {@code "LINK_REMOVED"}. */ + public static final EventType LINK_REMOVED = new EventType("LINK_REMOVED"); + + /** The value {@code "NOTE_ADDED"}. */ + public static final EventType NOTE_ADDED = new EventType("NOTE_ADDED"); + + /** The value {@code "PRIORITY_CHANGED"}. */ + public static final EventType PRIORITY_CHANGED = new EventType("PRIORITY_CHANGED"); + + /** The value {@code "DUE_DATE_CHANGED"}. */ + public static final EventType DUE_DATE_CHANGED = new EventType("DUE_DATE_CHANGED"); + + /** The value {@code "TAG_ADDED"}. */ + public static final EventType TAG_ADDED = new EventType("TAG_ADDED"); + + /** The value {@code "TAG_REMOVED"}. */ + public static final EventType TAG_REMOVED = new EventType("TAG_REMOVED"); + + /** The value {@code "ESCALATED"}. */ + public static final EventType ESCALATED = new EventType("ESCALATED"); + + /** The value {@code "TRANSFERRED"}. */ + public static final EventType TRANSFERRED = new EventType("TRANSFERRED"); + + /** The value {@code "CHECKLIST_COMPLETED"}. */ + public static final EventType CHECKLIST_COMPLETED = new EventType("CHECKLIST_COMPLETED"); + + /** The value {@code "REPORT_CREATED"}. */ + public static final EventType REPORT_CREATED = new EventType("REPORT_CREATED"); + + /** The value {@code "REPORT_FINALIZED"}. */ + public static final EventType REPORT_FINALIZED = new EventType("REPORT_FINALIZED"); + + /** The value {@code "SUBMITTED_FOR_APPROVAL"}. */ + public static final EventType SUBMITTED_FOR_APPROVAL = new EventType("SUBMITTED_FOR_APPROVAL"); + + /** The value {@code "APPROVAL_GRANTED"}. */ + public static final EventType APPROVAL_GRANTED = new EventType("APPROVAL_GRANTED"); + + /** The value {@code "APPROVAL_REJECTED"}. */ + public static final EventType APPROVAL_REJECTED = new EventType("APPROVAL_REJECTED"); + + /** The value {@code "ENTITY_ACTION"}. */ + public static final EventType ENTITY_ACTION = new EventType("ENTITY_ACTION"); + + /** The value {@code "APPROVAL_INVALIDATED"}. */ + public static final EventType APPROVAL_INVALIDATED = new EventType("APPROVAL_INVALIDATED"); + + private static final List KNOWN_VALUES = List.of(CREATED, STATUS_CHANGED, ASSIGNED, UNASSIGNED, RESOLVED, REOPENED, LINK_ADDED, LINK_REMOVED, NOTE_ADDED, PRIORITY_CHANGED, DUE_DATE_CHANGED, TAG_ADDED, TAG_REMOVED, ESCALATED, TRANSFERRED, CHECKLIST_COMPLETED, REPORT_CREATED, REPORT_FINALIZED, SUBMITTED_FOR_APPROVAL, APPROVAL_GRANTED, APPROVAL_REJECTED, ENTITY_ACTION, APPROVAL_INVALIDATED); + + private EventType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EventType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EventType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PreviousStatus extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final PreviousStatus OPEN = new PreviousStatus("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final PreviousStatus AWAITING_USER = new PreviousStatus("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final PreviousStatus RESOLVED = new PreviousStatus("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private PreviousStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PreviousStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PreviousStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final NewStatus OPEN = new NewStatus("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final NewStatus AWAITING_USER = new NewStatus("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final NewStatus RESOLVED = new NewStatus("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseLink.java b/src/main/java/me/didit/types/CaseLink.java new file mode 100644 index 0000000..026abf7 --- /dev/null +++ b/src/main/java/me/didit/types/CaseLink.java @@ -0,0 +1,226 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseLink extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "linked_entity_type", "linked_entity_uuid", "linked_entity_summary", "created_at"); + + private CaseLink(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseLink} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseLink fromJson(JsonNode json) { + return new CaseLink(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The linked_entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional linkedEntityType() { + return Json.optional(json, "linked_entity_type", Conv.enumeration(CaseLink.LinkedEntityType::of)); + } + + /** + * The linked_entity_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional linkedEntityUuid() { + return Json.optional(json, "linked_entity_uuid", Conv.STRING); + } + + /** + * session_id/session_number/status for session and business_session links; uuid/txn_id/status for transaction links. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> linkedEntitySummary() { + return Json.optional(json, "linked_entity_summary", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseLink}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseLink from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The linked_entity_type field. + * + * @param linkedEntityType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder linkedEntityType(CaseLink.@Nullable LinkedEntityType linkedEntityType) { + return setNullable("linked_entity_type", Conv.enumeration(CaseLink.LinkedEntityType::of), linkedEntityType); + } + + /** + * The linked_entity_uuid field. + * + * @param linkedEntityUuid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder linkedEntityUuid(@Nullable String linkedEntityUuid) { + return setNullable("linked_entity_uuid", Conv.STRING, linkedEntityUuid); + } + + /** + * session_id/session_number/status for session and business_session links; uuid/txn_id/status for transaction links. + * + * @param linkedEntitySummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder linkedEntitySummary(@Nullable Map linkedEntitySummary) { + return setAny("linked_entity_summary", linkedEntitySummary); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseLink} + */ + public CaseLink build() { + return new CaseLink(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LinkedEntityType extends StringEnum { + /** The value {@code "session"}. */ + public static final LinkedEntityType SESSION = new LinkedEntityType("session"); + + /** The value {@code "business_session"}. */ + public static final LinkedEntityType BUSINESS_SESSION = new LinkedEntityType("business_session"); + + /** The value {@code "transaction"}. */ + public static final LinkedEntityType TRANSACTION = new LinkedEntityType("transaction"); + + private static final List KNOWN_VALUES = List.of(SESSION, BUSINESS_SESSION, TRANSACTION); + + private LinkedEntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LinkedEntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LinkedEntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseListItem.java b/src/main/java/me/didit/types/CaseListItem.java new file mode 100644 index 0000000..d765ab9 --- /dev/null +++ b/src/main/java/me/didit/types/CaseListItem.java @@ -0,0 +1,741 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "case_number", "title", "status", "resolution", "priority", "source", "tags", "subject", "assigned_to", "assigned_at", "due_at", "resolved_at", "created_by_email", "created_by_name", "blueprint", "links_count", "notes_count", "created_at", "updated_at", "application_id", "application_name", "organization_id", "organization_name"); + + private CaseListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseListItem fromJson(JsonNode json) { + return new CaseListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Auto-assigned, e.g. CS-0001. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseNumber() { + return Json.optional(json, "case_number", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(CaseListItem.Status::of)); + } + + /** + * The resolution field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolution() { + return Json.optional(json, "resolution", Conv.enumeration(CaseListItem.Resolution::of)); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CaseListItem.Priority::of)); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(CaseListItem.Source::of)); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * The single user or business the case is anchored to. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subject() { + return Json.optional(json, "subject", Conv.model(CaseSubject::fromJson)); + } + + /** + * The assigned_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedTo() { + return Json.optional(json, "assigned_to", Conv.model(CaseAssignee::fromJson)); + } + + /** + * The assigned_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedAt() { + return Json.optional(json, "assigned_at", Conv.DATE_TIME); + } + + /** + * The due_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dueAt() { + return Json.optional(json, "due_at", Conv.DATE_TIME); + } + + /** + * The resolved_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolvedAt() { + return Json.optional(json, "resolved_at", Conv.DATE_TIME); + } + + /** + * The created_by_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdByEmail() { + return Json.optional(json, "created_by_email", Conv.STRING); + } + + /** + * The created_by_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdByName() { + return Json.optional(json, "created_by_name", Conv.STRING); + } + + /** + * The blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.model(CaseBlueprintSummary::fromJson)); + } + + /** + * The links_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional linksCount() { + return Json.optional(json, "links_count", Conv.LONG); + } + + /** + * The notes_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional notesCount() { + return Json.optional(json, "notes_count", Conv.LONG); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * The application_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional applicationId() { + return Json.optional(json, "application_id", Conv.STRING); + } + + /** + * The application_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional applicationName() { + return Json.optional(json, "application_name", Conv.STRING); + } + + /** + * The organization_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organizationId() { + return Json.optional(json, "organization_id", Conv.STRING); + } + + /** + * The organization_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organizationName() { + return Json.optional(json, "organization_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseListItem from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Auto-assigned, e.g. CS-0001. + * + * @param caseNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder caseNumber(@Nullable String caseNumber) { + return setNullable("case_number", Conv.STRING, caseNumber); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(CaseListItem.Status status) { + return set("status", Conv.enumeration(CaseListItem.Status::of), status); + } + + /** + * The resolution field. + * + * @param resolution the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolution(CaseListItem.@Nullable Resolution resolution) { + return setNullable("resolution", Conv.enumeration(CaseListItem.Resolution::of), resolution); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(CaseListItem.Priority priority) { + return set("priority", Conv.enumeration(CaseListItem.Priority::of), priority); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(CaseListItem.Source source) { + return set("source", Conv.enumeration(CaseListItem.Source::of), source); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * The single user or business the case is anchored to. + * + * @param subject the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subject(@Nullable CaseSubject subject) { + return setNullable("subject", Conv.model(CaseSubject::fromJson), subject); + } + + /** + * The assigned_to field. + * + * @param assignedTo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assignedTo(@Nullable CaseAssignee assignedTo) { + return setNullable("assigned_to", Conv.model(CaseAssignee::fromJson), assignedTo); + } + + /** + * The assigned_at field. + * + * @param assignedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assignedAt(@Nullable OffsetDateTime assignedAt) { + return setNullable("assigned_at", Conv.DATE_TIME, assignedAt); + } + + /** + * The due_at field. + * + * @param dueAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dueAt(@Nullable OffsetDateTime dueAt) { + return setNullable("due_at", Conv.DATE_TIME, dueAt); + } + + /** + * The resolved_at field. + * + * @param resolvedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder resolvedAt(@Nullable OffsetDateTime resolvedAt) { + return setNullable("resolved_at", Conv.DATE_TIME, resolvedAt); + } + + /** + * The created_by_email field. + * + * @param createdByEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder createdByEmail(@Nullable String createdByEmail) { + return setNullable("created_by_email", Conv.STRING, createdByEmail); + } + + /** + * The created_by_name field. + * + * @param createdByName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder createdByName(@Nullable String createdByName) { + return setNullable("created_by_name", Conv.STRING, createdByName); + } + + /** + * The blueprint field. + * + * @param blueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder blueprint(@Nullable CaseBlueprintSummary blueprint) { + return setNullable("blueprint", Conv.model(CaseBlueprintSummary::fromJson), blueprint); + } + + /** + * The links_count field. + * + * @param linksCount the value + * @return this builder + */ + public Builder linksCount(long linksCount) { + return set("links_count", Conv.LONG, linksCount); + } + + /** + * The notes_count field. + * + * @param notesCount the value + * @return this builder + */ + public Builder notesCount(long notesCount) { + return set("notes_count", Conv.LONG, notesCount); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * The application_id field. + * + * @param applicationId the value + * @return this builder + */ + public Builder applicationId(String applicationId) { + return set("application_id", Conv.STRING, applicationId); + } + + /** + * The application_name field. + * + * @param applicationName the value + * @return this builder + */ + public Builder applicationName(String applicationName) { + return set("application_name", Conv.STRING, applicationName); + } + + /** + * The organization_id field. + * + * @param organizationId the value + * @return this builder + */ + public Builder organizationId(String organizationId) { + return set("organization_id", Conv.STRING, organizationId); + } + + /** + * The organization_name field. + * + * @param organizationName the value + * @return this builder + */ + public Builder organizationName(String organizationName) { + return set("organization_name", Conv.STRING, organizationName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseListItem} + */ + public CaseListItem build() { + return new CaseListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final Status OPEN = new Status("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final Status RESOLVED = new Status("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Resolution extends StringEnum { + /** The value {@code "FALSE_POSITIVE"}. */ + public static final Resolution FALSE_POSITIVE = new Resolution("FALSE_POSITIVE"); + + /** The value {@code "VALID_THREAT"}. */ + public static final Resolution VALID_THREAT = new Resolution("VALID_THREAT"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, VALID_THREAT); + + private Resolution(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Resolution of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Resolution::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Priority extends StringEnum { + /** The value {@code "LOW"}. */ + public static final Priority LOW = new Priority("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Priority MEDIUM = new Priority("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Priority HIGH = new Priority("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Priority(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Priority of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Priority::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final Source MANUAL = new Source("MANUAL"); + + /** The value {@code "AML_SCREENING"}. */ + public static final Source AML_SCREENING = new Source("AML_SCREENING"); + + /** The value {@code "TRANSACTION_RULE"}. */ + public static final Source TRANSACTION_RULE = new Source("TRANSACTION_RULE"); + + /** The value {@code "WORKFLOW_BUILDER"}. */ + public static final Source WORKFLOW_BUILDER = new Source("WORKFLOW_BUILDER"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AML_SCREENING, TRANSACTION_RULE, WORKFLOW_BUILDER); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseNote.java b/src/main/java/me/didit/types/CaseNote.java new file mode 100644 index 0000000..475bc28 --- /dev/null +++ b/src/main/java/me/didit/types/CaseNote.java @@ -0,0 +1,405 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseNote extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "comment", "actor_email", "actor_name", "mentioned_emails", "is_internal", "attachments", "tags", "created_at"); + + private CaseNote(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseNote} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseNote fromJson(JsonNode json) { + return new CaseNote(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The comment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The actor_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorName() { + return Json.optional(json, "actor_name", Conv.STRING); + } + + /** + * The mentioned_emails field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> mentionedEmails() { + return Json.optional(json, "mentioned_emails", Conv.list(Conv.STRING)); + } + + /** + * The is_internal field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isInternal() { + return Json.optional(json, "is_internal", Conv.BOOLEAN); + } + + /** + * The attachments field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> attachments() { + return Json.optional(json, "attachments", Conv.list(Conv.model(CaseNote.Attachments::fromJson))); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseNote}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseNote from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The actor_name field. + * + * @param actorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorName(@Nullable String actorName) { + return setNullable("actor_name", Conv.STRING, actorName); + } + + /** + * The mentioned_emails field. + * + * @param mentionedEmails the value + * @return this builder + */ + public Builder mentionedEmails(List mentionedEmails) { + return set("mentioned_emails", Conv.list(Conv.STRING), mentionedEmails); + } + + /** + * The is_internal field. + * + * @param isInternal the value + * @return this builder + */ + public Builder isInternal(boolean isInternal) { + return set("is_internal", Conv.BOOLEAN, isInternal); + } + + /** + * The attachments field. + * + * @param attachments the value + * @return this builder + */ + public Builder attachments(List attachments) { + return set("attachments", Conv.list(Conv.model(CaseNote.Attachments::fromJson)), attachments); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseNote} + */ + public CaseNote build() { + return new CaseNote(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Attachments extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("s3_key", "filename", "file_size", "url"); + + private Attachments(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Attachments} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Attachments fromJson(JsonNode json) { + return new Attachments(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The s3_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional s3Key() { + return Json.optional(json, "s3_key", Conv.STRING); + } + + /** + * The filename field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filename() { + return Json.optional(json, "filename", Conv.STRING); + } + + /** + * The file_size field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Attachments}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Attachments from) { + super(from); + } + + /** + * The s3_key field. + * + * @param s3Key the value + * @return this builder + */ + public Builder s3Key(String s3Key) { + return set("s3_key", Conv.STRING, s3Key); + } + + /** + * The filename field. + * + * @param filename the value + * @return this builder + */ + public Builder filename(String filename) { + return set("filename", Conv.STRING, filename); + } + + /** + * The file_size field. + * + * @param fileSize the value + * @return this builder + */ + public Builder fileSize(long fileSize) { + return set("file_size", Conv.LONG, fileSize); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Attachments} + */ + public Attachments build() { + return new Attachments(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationAssignmentMethodEnum.java b/src/main/java/me/didit/types/CasePublicationAssignmentMethodEnum.java new file mode 100644 index 0000000..24346f8 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationAssignmentMethodEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - MANUAL - Manual + * - AUTOMATIC - Automatic + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CasePublicationAssignmentMethodEnum extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final CasePublicationAssignmentMethodEnum MANUAL = new CasePublicationAssignmentMethodEnum("MANUAL"); + + /** The value {@code "AUTOMATIC"}. */ + public static final CasePublicationAssignmentMethodEnum AUTOMATIC = new CasePublicationAssignmentMethodEnum("AUTOMATIC"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AUTOMATIC); + + private CasePublicationAssignmentMethodEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CasePublicationAssignmentMethodEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CasePublicationAssignmentMethodEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CasePublicationCaseBlueprint.java b/src/main/java/me/didit/types/CasePublicationCaseBlueprint.java new file mode 100644 index 0000000..f22d33b --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationCaseBlueprint.java @@ -0,0 +1,531 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationCaseBlueprint extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "description", "assignment_method", "assignee_pool", "max_active_cases", "escalation_enabled", "escalation_blueprint", "escalation_blueprint_name", "transfer_enabled", "four_eyes_checker_blueprint", "four_eyes_checker_blueprint_name", "require_resolution_note", "content_config", "version", "default_deadline_hours", "is_active", "preset_key", "creation_sources", "receives_escalation_from", "created_at", "updated_at"); + + private CasePublicationCaseBlueprint(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationCaseBlueprint} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationCaseBlueprint fromJson(JsonNode json) { + return new CasePublicationCaseBlueprint(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * - MANUAL - Manual + * - AUTOMATIC - Automatic + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignmentMethod() { + return Json.optional(json, "assignment_method", Conv.enumeration(CasePublicationAssignmentMethodEnum::of)); + } + + /** + * The assignee_pool field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneePool() { + return Json.optional(json, "assignee_pool", Conv.ANY); + } + + /** + * The max_active_cases field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxActiveCases() { + return Json.optional(json, "max_active_cases", Conv.LONG); + } + + /** + * The escalation_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationEnabled() { + return Json.optional(json, "escalation_enabled", Conv.BOOLEAN); + } + + /** + * The escalation_blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationBlueprint() { + return Json.optional(json, "escalation_blueprint", Conv.STRING); + } + + /** + * The escalation_blueprint_name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String escalationBlueprintName() { + return Json.required(json, "escalation_blueprint_name", Conv.STRING); + } + + /** + * The transfer_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transferEnabled() { + return Json.optional(json, "transfer_enabled", Conv.BOOLEAN); + } + + /** + * The four_eyes_checker_blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fourEyesCheckerBlueprint() { + return Json.optional(json, "four_eyes_checker_blueprint", Conv.STRING); + } + + /** + * The four_eyes_checker_blueprint_name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String fourEyesCheckerBlueprintName() { + return Json.required(json, "four_eyes_checker_blueprint_name", Conv.STRING); + } + + /** + * The require_resolution_note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requireResolutionNote() { + return Json.optional(json, "require_resolution_note", Conv.BOOLEAN); + } + + /** + * The content_config field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentConfig() { + return Json.optional(json, "content_config", Conv.ANY); + } + + /** + * The version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * The default_deadline_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultDeadlineHours() { + return Json.optional(json, "default_deadline_hours", Conv.LONG); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The preset_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional presetKey() { + return Json.optional(json, "preset_key", Conv.STRING); + } + + /** + * The creation_sources field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List> creationSources() { + return Json.required(json, "creation_sources", Conv.list(Conv.OBJECT)); + } + + /** + * The receives_escalation_from field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List> receivesEscalationFrom() { + return Json.required(json, "receives_escalation_from", Conv.list(Conv.OBJECT)); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime updatedAt() { + return Json.required(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationCaseBlueprint}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationCaseBlueprint from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * - MANUAL - Manual + * - AUTOMATIC - Automatic + * + * @param assignmentMethod the value + * @return this builder + */ + public Builder assignmentMethod(CasePublicationAssignmentMethodEnum assignmentMethod) { + return set("assignment_method", Conv.enumeration(CasePublicationAssignmentMethodEnum::of), assignmentMethod); + } + + /** + * The assignee_pool field. + * + * @param assigneePool the value + * @return this builder + */ + public Builder assigneePool(@Nullable Object assigneePool) { + return setAny("assignee_pool", assigneePool); + } + + /** + * The max_active_cases field. + * + * @param maxActiveCases the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxActiveCases(@Nullable Long maxActiveCases) { + return setNullable("max_active_cases", Conv.LONG, maxActiveCases); + } + + /** + * The escalation_enabled field. + * + * @param escalationEnabled the value + * @return this builder + */ + public Builder escalationEnabled(boolean escalationEnabled) { + return set("escalation_enabled", Conv.BOOLEAN, escalationEnabled); + } + + /** + * The escalation_blueprint field. + * + * @param escalationBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder escalationBlueprint(@Nullable String escalationBlueprint) { + return setNullable("escalation_blueprint", Conv.STRING, escalationBlueprint); + } + + /** + * The escalation_blueprint_name field. + * + * @param escalationBlueprintName the value + * @return this builder + */ + public Builder escalationBlueprintName(String escalationBlueprintName) { + return set("escalation_blueprint_name", Conv.STRING, escalationBlueprintName); + } + + /** + * The transfer_enabled field. + * + * @param transferEnabled the value + * @return this builder + */ + public Builder transferEnabled(boolean transferEnabled) { + return set("transfer_enabled", Conv.BOOLEAN, transferEnabled); + } + + /** + * The four_eyes_checker_blueprint field. + * + * @param fourEyesCheckerBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fourEyesCheckerBlueprint(@Nullable String fourEyesCheckerBlueprint) { + return setNullable("four_eyes_checker_blueprint", Conv.STRING, fourEyesCheckerBlueprint); + } + + /** + * The four_eyes_checker_blueprint_name field. + * + * @param fourEyesCheckerBlueprintName the value + * @return this builder + */ + public Builder fourEyesCheckerBlueprintName(String fourEyesCheckerBlueprintName) { + return set("four_eyes_checker_blueprint_name", Conv.STRING, fourEyesCheckerBlueprintName); + } + + /** + * The require_resolution_note field. + * + * @param requireResolutionNote the value + * @return this builder + */ + public Builder requireResolutionNote(boolean requireResolutionNote) { + return set("require_resolution_note", Conv.BOOLEAN, requireResolutionNote); + } + + /** + * The content_config field. + * + * @param contentConfig the value + * @return this builder + */ + public Builder contentConfig(@Nullable Object contentConfig) { + return setAny("content_config", contentConfig); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The default_deadline_hours field. + * + * @param defaultDeadlineHours the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder defaultDeadlineHours(@Nullable Long defaultDeadlineHours) { + return setNullable("default_deadline_hours", Conv.LONG, defaultDeadlineHours); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The preset_key field. + * + * @param presetKey the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder presetKey(@Nullable String presetKey) { + return setNullable("preset_key", Conv.STRING, presetKey); + } + + /** + * The creation_sources field. + * + * @param creationSources the value + * @return this builder + */ + public Builder creationSources(List> creationSources) { + return setAny("creation_sources", creationSources); + } + + /** + * The receives_escalation_from field. + * + * @param receivesEscalationFrom the value + * @return this builder + */ + public Builder receivesEscalationFrom(List> receivesEscalationFrom) { + return setAny("receives_escalation_from", receivesEscalationFrom); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationCaseBlueprint} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationCaseBlueprint build() { + require("uuid", false); + require("name", false); + require("escalation_blueprint_name", false); + require("four_eyes_checker_blueprint_name", false); + require("creation_sources", false); + require("receives_escalation_from", false); + require("created_at", false); + require("updated_at", false); + return new CasePublicationCaseBlueprint(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationPaginatedPolicyRevisionList.java b/src/main/java/me/didit/types/CasePublicationPaginatedPolicyRevisionList.java new file mode 100644 index 0000000..d245cc3 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationPaginatedPolicyRevisionList.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationPaginatedPolicyRevisionList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CasePublicationPaginatedPolicyRevisionList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationPaginatedPolicyRevisionList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationPaginatedPolicyRevisionList fromJson(JsonNode json) { + return new CasePublicationPaginatedPolicyRevisionList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(CasePublicationPolicyRevision::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationPaginatedPolicyRevisionList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationPaginatedPolicyRevisionList from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CasePublicationPolicyRevision::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationPaginatedPolicyRevisionList} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationPaginatedPolicyRevisionList build() { + require("count", false); + require("results", false); + return new CasePublicationPaginatedPolicyRevisionList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationPolicyDraft.java b/src/main/java/me/didit/types/CasePublicationPolicyDraft.java new file mode 100644 index 0000000..e102730 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationPolicyDraft.java @@ -0,0 +1,183 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationPolicyDraft extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("revision", "base_version", "changes", "actor_email", "updated_at"); + + private CasePublicationPolicyDraft(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationPolicyDraft} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationPolicyDraft fromJson(JsonNode json) { + return new CasePublicationPolicyDraft(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The revision field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional revision() { + return Json.optional(json, "revision", Conv.STRING); + } + + /** + * The base_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long baseVersion() { + return Json.required(json, "base_version", Conv.LONG); + } + + /** + * The changes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional changes() { + return Json.optional(json, "changes", Conv.ANY); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The updated_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime updatedAt() { + return Json.required(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationPolicyDraft}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationPolicyDraft from) { + super(from); + } + + /** + * The revision field. + * + * @param revision the value + * @return this builder + */ + public Builder revision(String revision) { + return set("revision", Conv.STRING, revision); + } + + /** + * The base_version field. + * + * @param baseVersion the value + * @return this builder + */ + public Builder baseVersion(long baseVersion) { + return set("base_version", Conv.LONG, baseVersion); + } + + /** + * The changes field. + * + * @param changes the value + * @return this builder + */ + public Builder changes(@Nullable Object changes) { + return setAny("changes", changes); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationPolicyDraft} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationPolicyDraft build() { + require("base_version", false); + require("updated_at", false); + return new CasePublicationPolicyDraft(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationPolicyDraftPreconditionRequest.java b/src/main/java/me/didit/types/CasePublicationPolicyDraftPreconditionRequest.java new file mode 100644 index 0000000..78270c2 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationPolicyDraftPreconditionRequest.java @@ -0,0 +1,122 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationPolicyDraftPreconditionRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("expected_version", "expected_revision"); + + private CasePublicationPolicyDraftPreconditionRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationPolicyDraftPreconditionRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationPolicyDraftPreconditionRequest fromJson(JsonNode json) { + return new CasePublicationPolicyDraftPreconditionRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The expected_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long expectedVersion() { + return Json.required(json, "expected_version", Conv.LONG); + } + + /** + * The expected_revision field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedRevision() { + return Json.optional(json, "expected_revision", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationPolicyDraftPreconditionRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationPolicyDraftPreconditionRequest from) { + super(from); + } + + /** + * The expected_version field. + * + * @param expectedVersion the value + * @return this builder + */ + public Builder expectedVersion(long expectedVersion) { + return set("expected_version", Conv.LONG, expectedVersion); + } + + /** + * The expected_revision field. + * + * @param expectedRevision the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedRevision(@Nullable String expectedRevision) { + return setNullable("expected_revision", Conv.STRING, expectedRevision); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationPolicyDraftPreconditionRequest} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationPolicyDraftPreconditionRequest build() { + require("expected_version", false); + require("expected_revision", true); + return new CasePublicationPolicyDraftPreconditionRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationPolicyDraftResponse.java b/src/main/java/me/didit/types/CasePublicationPolicyDraftResponse.java new file mode 100644 index 0000000..c3ac9f9 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationPolicyDraftResponse.java @@ -0,0 +1,101 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationPolicyDraftResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("draft"); + + private CasePublicationPolicyDraftResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationPolicyDraftResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationPolicyDraftResponse fromJson(JsonNode json) { + return new CasePublicationPolicyDraftResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The draft field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional draft() { + return Json.optional(json, "draft", Conv.model(CasePublicationPolicyDraft::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationPolicyDraftResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationPolicyDraftResponse from) { + super(from); + } + + /** + * The draft field. + * + * @param draft the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder draft(@Nullable CasePublicationPolicyDraft draft) { + return setNullable("draft", Conv.model(CasePublicationPolicyDraft::fromJson), draft); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationPolicyDraftResponse} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationPolicyDraftResponse build() { + require("draft", true); + return new CasePublicationPolicyDraftResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationPolicyDraftWriteRequest.java b/src/main/java/me/didit/types/CasePublicationPolicyDraftWriteRequest.java new file mode 100644 index 0000000..c2e4ee6 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationPolicyDraftWriteRequest.java @@ -0,0 +1,143 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationPolicyDraftWriteRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("expected_version", "expected_revision", "changes"); + + private CasePublicationPolicyDraftWriteRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationPolicyDraftWriteRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationPolicyDraftWriteRequest fromJson(JsonNode json) { + return new CasePublicationPolicyDraftWriteRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The expected_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long expectedVersion() { + return Json.required(json, "expected_version", Conv.LONG); + } + + /** + * The expected_revision field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedRevision() { + return Json.optional(json, "expected_revision", Conv.STRING); + } + + /** + * The changes field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map changes() { + return Json.required(json, "changes", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationPolicyDraftWriteRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationPolicyDraftWriteRequest from) { + super(from); + } + + /** + * The expected_version field. + * + * @param expectedVersion the value + * @return this builder + */ + public Builder expectedVersion(long expectedVersion) { + return set("expected_version", Conv.LONG, expectedVersion); + } + + /** + * The expected_revision field. + * + * @param expectedRevision the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedRevision(@Nullable String expectedRevision) { + return setNullable("expected_revision", Conv.STRING, expectedRevision); + } + + /** + * The changes field. + * + * @param changes the value + * @return this builder + */ + public Builder changes(Map changes) { + return setAny("changes", changes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationPolicyDraftWriteRequest} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationPolicyDraftWriteRequest build() { + require("expected_version", false); + require("expected_revision", true); + require("changes", false); + return new CasePublicationPolicyDraftWriteRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasePublicationPolicyRevision.java b/src/main/java/me/didit/types/CasePublicationPolicyRevision.java new file mode 100644 index 0000000..548ff78 --- /dev/null +++ b/src/main/java/me/didit/types/CasePublicationPolicyRevision.java @@ -0,0 +1,164 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasePublicationPolicyRevision extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("version", "snapshot", "actor_email", "published_at"); + + private CasePublicationPolicyRevision(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasePublicationPolicyRevision} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasePublicationPolicyRevision fromJson(JsonNode json) { + return new CasePublicationPolicyRevision(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long version() { + return Json.required(json, "version", Conv.LONG); + } + + /** + * The snapshot field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public JsonNode snapshot() { + return Json.required(json, "snapshot", Conv.ANY); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The published_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime publishedAt() { + return Json.required(json, "published_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasePublicationPolicyRevision}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasePublicationPolicyRevision from) { + super(from); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The snapshot field. + * + * @param snapshot the value + * @return this builder + */ + public Builder snapshot(@Nullable Object snapshot) { + return setAny("snapshot", snapshot); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The published_at field. + * + * @param publishedAt the value + * @return this builder + */ + public Builder publishedAt(OffsetDateTime publishedAt) { + return set("published_at", Conv.DATE_TIME, publishedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasePublicationPolicyRevision} + * @throws IllegalStateException when a required field is missing + */ + public CasePublicationPolicyRevision build() { + require("version", false); + require("snapshot", false); + require("published_at", false); + return new CasePublicationPolicyRevision(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseReviewTeam.java b/src/main/java/me/didit/types/CaseReviewTeam.java new file mode 100644 index 0000000..df9f163 --- /dev/null +++ b/src/main/java/me/didit/types/CaseReviewTeam.java @@ -0,0 +1,219 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseReviewTeam extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "members", "is_active", "uuid", "created_at", "updated_at"); + + private CaseReviewTeam(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseReviewTeam} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseReviewTeam fromJson(JsonNode json) { + return new CaseReviewTeam(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The members field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> members() { + return Json.optional(json, "members", Conv.list(Conv.model(CaseReviewTeamMember::fromJson))); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseReviewTeam}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseReviewTeam from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The members field. + * + * @param members the value + * @return this builder + */ + public Builder members(List members) { + return set("members", Conv.list(Conv.model(CaseReviewTeamMember::fromJson)), members); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseReviewTeam} + */ + public CaseReviewTeam build() { + return new CaseReviewTeam(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseReviewTeamCreate.java b/src/main/java/me/didit/types/CaseReviewTeamCreate.java new file mode 100644 index 0000000..0075e95 --- /dev/null +++ b/src/main/java/me/didit/types/CaseReviewTeamCreate.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseReviewTeamCreate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "members", "is_active"); + + private CaseReviewTeamCreate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseReviewTeamCreate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseReviewTeamCreate fromJson(JsonNode json) { + return new CaseReviewTeamCreate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The members field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List members() { + return Json.required(json, "members", Conv.list(Conv.model(CaseReviewTeamMember::fromJson))); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseReviewTeamCreate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseReviewTeamCreate from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The members field. + * + * @param members the value + * @return this builder + */ + public Builder members(List members) { + return set("members", Conv.list(Conv.model(CaseReviewTeamMember::fromJson)), members); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseReviewTeamCreate} + * @throws IllegalStateException when a required field is missing + */ + public CaseReviewTeamCreate build() { + require("name", false); + require("members", false); + return new CaseReviewTeamCreate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseReviewTeamMember.java b/src/main/java/me/didit/types/CaseReviewTeamMember.java new file mode 100644 index 0000000..10b1f68 --- /dev/null +++ b/src/main/java/me/didit/types/CaseReviewTeamMember.java @@ -0,0 +1,245 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class CaseReviewTeamMember extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_id", "availability", "capacity", "skills", "available_from", "available_until"); + + private CaseReviewTeamMember(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseReviewTeamMember} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseReviewTeamMember fromJson(JsonNode json) { + return new CaseReviewTeamMember(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The user_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String userId() { + return Json.required(json, "user_id", Conv.STRING); + } + + /** + * The availability field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional availability() { + return Json.optional(json, "availability", Conv.enumeration(CaseReviewTeamMember.Availability::of)); + } + + /** + * The capacity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional capacity() { + return Json.optional(json, "capacity", Conv.LONG); + } + + /** + * The skills field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> skills() { + return Json.optional(json, "skills", Conv.list(Conv.STRING)); + } + + /** + * The available_from field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional availableFrom() { + return Json.optional(json, "available_from", Conv.DATE_TIME); + } + + /** + * The available_until field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional availableUntil() { + return Json.optional(json, "available_until", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseReviewTeamMember}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseReviewTeamMember from) { + super(from); + } + + /** + * The user_id field. + * + * @param userId the value + * @return this builder + */ + public Builder userId(String userId) { + return set("user_id", Conv.STRING, userId); + } + + /** + * The availability field. + * + * @param availability the value + * @return this builder + */ + public Builder availability(CaseReviewTeamMember.Availability availability) { + return set("availability", Conv.enumeration(CaseReviewTeamMember.Availability::of), availability); + } + + /** + * The capacity field. + * + * @param capacity the value + * @return this builder + */ + public Builder capacity(long capacity) { + return set("capacity", Conv.LONG, capacity); + } + + /** + * The skills field. + * + * @param skills the value + * @return this builder + */ + public Builder skills(List skills) { + return set("skills", Conv.list(Conv.STRING), skills); + } + + /** + * The available_from field. + * + * @param availableFrom the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder availableFrom(@Nullable OffsetDateTime availableFrom) { + return setNullable("available_from", Conv.DATE_TIME, availableFrom); + } + + /** + * The available_until field. + * + * @param availableUntil the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder availableUntil(@Nullable OffsetDateTime availableUntil) { + return setNullable("available_until", Conv.DATE_TIME, availableUntil); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseReviewTeamMember} + * @throws IllegalStateException when a required field is missing + */ + public CaseReviewTeamMember build() { + require("user_id", false); + return new CaseReviewTeamMember(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Availability extends StringEnum { + /** The value {@code "available"}. */ + public static final Availability AVAILABLE = new Availability("available"); + + /** The value {@code "unavailable"}. */ + public static final Availability UNAVAILABLE = new Availability("unavailable"); + + private static final List KNOWN_VALUES = List.of(AVAILABLE, UNAVAILABLE); + + private Availability(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Availability of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Availability::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseReviewTeamUpdate.java b/src/main/java/me/didit/types/CaseReviewTeamUpdate.java new file mode 100644 index 0000000..0a40543 --- /dev/null +++ b/src/main/java/me/didit/types/CaseReviewTeamUpdate.java @@ -0,0 +1,158 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CaseReviewTeamUpdate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "members", "is_active"); + + private CaseReviewTeamUpdate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseReviewTeamUpdate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseReviewTeamUpdate fromJson(JsonNode json) { + return new CaseReviewTeamUpdate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The members field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> members() { + return Json.optional(json, "members", Conv.list(Conv.model(CaseReviewTeamMember::fromJson))); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseReviewTeamUpdate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseReviewTeamUpdate from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The members field. + * + * @param members the value + * @return this builder + */ + public Builder members(List members) { + return set("members", Conv.list(Conv.model(CaseReviewTeamMember::fromJson)), members); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseReviewTeamUpdate} + */ + public CaseReviewTeamUpdate build() { + return new CaseReviewTeamUpdate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseRoutingCondition.java b/src/main/java/me/didit/types/CaseRoutingCondition.java new file mode 100644 index 0000000..0e1c8e6 --- /dev/null +++ b/src/main/java/me/didit/types/CaseRoutingCondition.java @@ -0,0 +1,314 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.StringEnum; + +/** + * Source and priority support equals or in with supported values. Tags support contains with one non-empty tag. + */ +public final class CaseRoutingCondition extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("field", "operator", "value"); + + private CaseRoutingCondition(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseRoutingCondition} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseRoutingCondition fromJson(JsonNode json) { + return new CaseRoutingCondition(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The field field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseRoutingCondition.Field field() { + return Json.required(json, "field", Conv.enumeration(CaseRoutingCondition.Field::of)); + } + + /** + * The operator field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseRoutingCondition.Operator operator() { + return Json.required(json, "operator", Conv.enumeration(CaseRoutingCondition.Operator::of)); + } + + /** + * The value field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseRoutingCondition.Value value() { + return Json.required(json, "value", Conv.union(CaseRoutingCondition.Value::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseRoutingCondition}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseRoutingCondition from) { + super(from); + } + + /** + * The field field. + * + * @param field the value + * @return this builder + */ + public Builder field(CaseRoutingCondition.Field field) { + return set("field", Conv.enumeration(CaseRoutingCondition.Field::of), field); + } + + /** + * The operator field. + * + * @param operator the value + * @return this builder + */ + public Builder operator(CaseRoutingCondition.Operator operator) { + return set("operator", Conv.enumeration(CaseRoutingCondition.Operator::of), operator); + } + + /** + * The value field. + * + * @param value the value + * @return this builder + */ + public Builder value(CaseRoutingCondition.Value value) { + return set("value", Conv.union(CaseRoutingCondition.Value::fromJson), value); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseRoutingCondition} + * @throws IllegalStateException when a required field is missing + */ + public CaseRoutingCondition build() { + require("field", false); + require("operator", false); + require("value", false); + return new CaseRoutingCondition(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Field extends StringEnum { + /** The value {@code "source"}. */ + public static final Field SOURCE = new Field("source"); + + /** The value {@code "priority"}. */ + public static final Field PRIORITY = new Field("priority"); + + /** The value {@code "tags"}. */ + public static final Field TAGS = new Field("tags"); + + private static final List KNOWN_VALUES = List.of(SOURCE, PRIORITY, TAGS); + + private Field(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Field of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Field::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Operator extends StringEnum { + /** The value {@code "equals"}. */ + public static final Operator EQUALS = new Operator("equals"); + + /** The value {@code "in"}. */ + public static final Operator IN = new Operator("in"); + + /** The value {@code "contains"}. */ + public static final Operator CONTAINS = new Operator("contains"); + + private static final List KNOWN_VALUES = List.of(EQUALS, IN, CONTAINS); + + private Operator(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Operator of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Operator::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

One of: {@code String}, {@code List}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ + public static final class Value extends JsonUnion { + private Value(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Value} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Value fromJson(JsonNode json) { + return new Value(json.deepCopy()); + } + + /** + * Wraps a {@code String} value. + * + * @param value the value + * @return the union + */ + public static Value ofString(String value) { + return new Value(Conv.STRING.write(value)); + } + + /** + * Whether this value is a {@code String}. + * + * @return true when it matches + */ + public boolean isString() { + return json.isTextual(); + } + + /** + * Reads this value as a {@code String}. + * + * @return the value, or empty when {@link #isString()} is false + */ + public Optional asString() { + return isString() ? Optional.of(Conv.STRING.read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code List} value. + * + * @param value the value + * @return the union + */ + public static Value ofList(List value) { + return new Value(Conv.list(Conv.STRING).write(value)); + } + + /** + * Whether this value is a {@code List}. + * + * @return true when it matches + */ + public boolean isList() { + return json.isArray(); + } + + /** + * Reads this value as a {@code List}. + * + * @return the value, or empty when {@link #isList()} is false + */ + public Optional> asList() { + return isList() ? Optional.of(Conv.list(Conv.STRING).read(json)) : Optional.empty(); + } + } +} diff --git a/src/main/java/me/didit/types/CaseRoutingPreview.java b/src/main/java/me/didit/types/CaseRoutingPreview.java new file mode 100644 index 0000000..04271d3 --- /dev/null +++ b/src/main/java/me/didit/types/CaseRoutingPreview.java @@ -0,0 +1,529 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseRoutingPreview extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("rule_uuid", "rule_name", "rule_version", "blueprint_uuid", "team_uuid", "assignee_user_id", "reason", "candidates", "matched_rules"); + + private CaseRoutingPreview(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseRoutingPreview} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseRoutingPreview fromJson(JsonNode json) { + return new CaseRoutingPreview(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The rule_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleUuid() { + return Json.optional(json, "rule_uuid", Conv.STRING); + } + + /** + * The rule_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleName() { + return Json.optional(json, "rule_name", Conv.STRING); + } + + /** + * The rule_version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleVersion() { + return Json.optional(json, "rule_version", Conv.LONG); + } + + /** + * The blueprint_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprintUuid() { + return Json.optional(json, "blueprint_uuid", Conv.STRING); + } + + /** + * The team_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional teamUuid() { + return Json.optional(json, "team_uuid", Conv.STRING); + } + + /** + * The assignee_user_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeUserId() { + return Json.optional(json, "assignee_user_id", Conv.STRING); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The candidates field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> candidates() { + return Json.optional(json, "candidates", Conv.list(Conv.model(CaseRoutingPreview.Candidates::fromJson))); + } + + /** + * The matched_rules field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matchedRules() { + return Json.optional(json, "matched_rules", Conv.list(Conv.model(CaseRoutingPreview.MatchedRules::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseRoutingPreview}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseRoutingPreview from) { + super(from); + } + + /** + * The rule_uuid field. + * + * @param ruleUuid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ruleUuid(@Nullable String ruleUuid) { + return setNullable("rule_uuid", Conv.STRING, ruleUuid); + } + + /** + * The rule_name field. + * + * @param ruleName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ruleName(@Nullable String ruleName) { + return setNullable("rule_name", Conv.STRING, ruleName); + } + + /** + * The rule_version field. + * + * @param ruleVersion the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ruleVersion(@Nullable Long ruleVersion) { + return setNullable("rule_version", Conv.LONG, ruleVersion); + } + + /** + * The blueprint_uuid field. + * + * @param blueprintUuid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder blueprintUuid(@Nullable String blueprintUuid) { + return setNullable("blueprint_uuid", Conv.STRING, blueprintUuid); + } + + /** + * The team_uuid field. + * + * @param teamUuid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder teamUuid(@Nullable String teamUuid) { + return setNullable("team_uuid", Conv.STRING, teamUuid); + } + + /** + * The assignee_user_id field. + * + * @param assigneeUserId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeUserId(@Nullable String assigneeUserId) { + return setNullable("assignee_user_id", Conv.STRING, assigneeUserId); + } + + /** + * The reason field. + * + * @param reason the value + * @return this builder + */ + public Builder reason(String reason) { + return set("reason", Conv.STRING, reason); + } + + /** + * The candidates field. + * + * @param candidates the value + * @return this builder + */ + public Builder candidates(List candidates) { + return set("candidates", Conv.list(Conv.model(CaseRoutingPreview.Candidates::fromJson)), candidates); + } + + /** + * The matched_rules field. + * + * @param matchedRules the value + * @return this builder + */ + public Builder matchedRules(List matchedRules) { + return set("matched_rules", Conv.list(Conv.model(CaseRoutingPreview.MatchedRules::fromJson)), matchedRules); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseRoutingPreview} + */ + public CaseRoutingPreview build() { + return new CaseRoutingPreview(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Candidates extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_id", "eligible", "active_cases", "reason"); + + private Candidates(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Candidates} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Candidates fromJson(JsonNode json) { + return new Candidates(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The user_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userId() { + return Json.optional(json, "user_id", Conv.STRING); + } + + /** + * The eligible field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional eligible() { + return Json.optional(json, "eligible", Conv.BOOLEAN); + } + + /** + * The active_cases field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activeCases() { + return Json.optional(json, "active_cases", Conv.LONG); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Candidates}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Candidates from) { + super(from); + } + + /** + * The user_id field. + * + * @param userId the value + * @return this builder + */ + public Builder userId(String userId) { + return set("user_id", Conv.STRING, userId); + } + + /** + * The eligible field. + * + * @param eligible the value + * @return this builder + */ + public Builder eligible(boolean eligible) { + return set("eligible", Conv.BOOLEAN, eligible); + } + + /** + * The active_cases field. + * + * @param activeCases the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder activeCases(@Nullable Long activeCases) { + return setNullable("active_cases", Conv.LONG, activeCases); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Candidates} + */ + public Candidates build() { + return new Candidates(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class MatchedRules extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "priority"); + + private MatchedRules(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code MatchedRules} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static MatchedRules fromJson(JsonNode json) { + return new MatchedRules(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link MatchedRules}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(MatchedRules from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(long priority) { + return set("priority", Conv.LONG, priority); + } + + /** + * Builds the value. + * + * @return a new immutable {@code MatchedRules} + */ + public MatchedRules build() { + return new MatchedRules(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CaseRoutingPreviewRequest.java b/src/main/java/me/didit/types/CaseRoutingPreviewRequest.java new file mode 100644 index 0000000..9449591 --- /dev/null +++ b/src/main/java/me/didit/types/CaseRoutingPreviewRequest.java @@ -0,0 +1,274 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class CaseRoutingPreviewRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("source", "priority", "tags", "rule_uuid", "draft"); + + private CaseRoutingPreviewRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseRoutingPreviewRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseRoutingPreviewRequest fromJson(JsonNode json) { + return new CaseRoutingPreviewRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The source field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CaseRoutingPreviewRequest.Source source() { + return Json.required(json, "source", Conv.enumeration(CaseRoutingPreviewRequest.Source::of)); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CaseRoutingPreviewRequest.Priority::of)); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * The rule_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleUuid() { + return Json.optional(json, "rule_uuid", Conv.STRING); + } + + /** + * The draft field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional draft() { + return Json.optional(json, "draft", Conv.model(CaseRoutingRuleCreate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseRoutingPreviewRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseRoutingPreviewRequest from) { + super(from); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(CaseRoutingPreviewRequest.Source source) { + return set("source", Conv.enumeration(CaseRoutingPreviewRequest.Source::of), source); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(CaseRoutingPreviewRequest.Priority priority) { + return set("priority", Conv.enumeration(CaseRoutingPreviewRequest.Priority::of), priority); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * The rule_uuid field. + * + * @param ruleUuid the value + * @return this builder + */ + public Builder ruleUuid(String ruleUuid) { + return set("rule_uuid", Conv.STRING, ruleUuid); + } + + /** + * The draft field. + * + * @param draft the value + * @return this builder + */ + public Builder draft(CaseRoutingRuleCreate draft) { + return set("draft", Conv.model(CaseRoutingRuleCreate::fromJson), draft); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseRoutingPreviewRequest} + * @throws IllegalStateException when a required field is missing + */ + public CaseRoutingPreviewRequest build() { + require("source", false); + return new CaseRoutingPreviewRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final Source MANUAL = new Source("MANUAL"); + + /** The value {@code "AML_SCREENING"}. */ + public static final Source AML_SCREENING = new Source("AML_SCREENING"); + + /** The value {@code "TRANSACTION_RULE"}. */ + public static final Source TRANSACTION_RULE = new Source("TRANSACTION_RULE"); + + /** The value {@code "WORKFLOW_BUILDER"}. */ + public static final Source WORKFLOW_BUILDER = new Source("WORKFLOW_BUILDER"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AML_SCREENING, TRANSACTION_RULE, WORKFLOW_BUILDER); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Priority extends StringEnum { + /** The value {@code "LOW"}. */ + public static final Priority LOW = new Priority("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Priority MEDIUM = new Priority("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Priority HIGH = new Priority("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Priority(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Priority of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Priority::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CaseRoutingRule.java b/src/main/java/me/didit/types/CaseRoutingRule.java new file mode 100644 index 0000000..36a1216 --- /dev/null +++ b/src/main/java/me/didit/types/CaseRoutingRule.java @@ -0,0 +1,360 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseRoutingRule extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "priority", "conditions", "required_skills", "blueprint", "team", "is_active", "uuid", "created_at", "updated_at", "version", "blueprint_name", "team_name"); + + private CaseRoutingRule(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseRoutingRule} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseRoutingRule fromJson(JsonNode json) { + return new CaseRoutingRule(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.LONG); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(CaseRoutingCondition::fromJson))); + } + + /** + * The required_skills field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> requiredSkills() { + return Json.optional(json, "required_skills", Conv.list(Conv.STRING)); + } + + /** + * The blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.STRING); + } + + /** + * The team field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional team() { + return Json.optional(json, "team", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * The version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * The blueprint_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprintName() { + return Json.optional(json, "blueprint_name", Conv.STRING); + } + + /** + * The team_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional teamName() { + return Json.optional(json, "team_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseRoutingRule}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseRoutingRule from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(long priority) { + return set("priority", Conv.LONG, priority); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(CaseRoutingCondition::fromJson)), conditions); + } + + /** + * The required_skills field. + * + * @param requiredSkills the value + * @return this builder + */ + public Builder requiredSkills(List requiredSkills) { + return set("required_skills", Conv.list(Conv.STRING), requiredSkills); + } + + /** + * The blueprint field. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * The team field. + * + * @param team the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder team(@Nullable String team) { + return setNullable("team", Conv.STRING, team); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The blueprint_name field. + * + * @param blueprintName the value + * @return this builder + */ + public Builder blueprintName(String blueprintName) { + return set("blueprint_name", Conv.STRING, blueprintName); + } + + /** + * The team_name field. + * + * @param teamName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder teamName(@Nullable String teamName) { + return setNullable("team_name", Conv.STRING, teamName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseRoutingRule} + */ + public CaseRoutingRule build() { + return new CaseRoutingRule(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseRoutingRuleCreate.java b/src/main/java/me/didit/types/CaseRoutingRuleCreate.java new file mode 100644 index 0000000..155f831 --- /dev/null +++ b/src/main/java/me/didit/types/CaseRoutingRuleCreate.java @@ -0,0 +1,263 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseRoutingRuleCreate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "priority", "conditions", "required_skills", "blueprint", "team", "is_active", "publish"); + + private CaseRoutingRuleCreate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseRoutingRuleCreate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseRoutingRuleCreate fromJson(JsonNode json) { + return new CaseRoutingRuleCreate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.LONG); + } + + /** + * The conditions field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List conditions() { + return Json.required(json, "conditions", Conv.list(Conv.model(CaseRoutingCondition::fromJson))); + } + + /** + * The required_skills field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> requiredSkills() { + return Json.optional(json, "required_skills", Conv.list(Conv.STRING)); + } + + /** + * The blueprint field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String blueprint() { + return Json.required(json, "blueprint", Conv.STRING); + } + + /** + * The team field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional team() { + return Json.optional(json, "team", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Set false to save a never-published draft. The record remains inactive at version 0 until the draft is explicitly published. Omitting this field preserves immediate creation for existing integrations. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publish() { + return Json.optional(json, "publish", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseRoutingRuleCreate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseRoutingRuleCreate from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(long priority) { + return set("priority", Conv.LONG, priority); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(CaseRoutingCondition::fromJson)), conditions); + } + + /** + * The required_skills field. + * + * @param requiredSkills the value + * @return this builder + */ + public Builder requiredSkills(List requiredSkills) { + return set("required_skills", Conv.list(Conv.STRING), requiredSkills); + } + + /** + * The blueprint field. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * The team field. + * + * @param team the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder team(@Nullable String team) { + return setNullable("team", Conv.STRING, team); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Set false to save a never-published draft. The record remains inactive at version 0 until the draft is explicitly published. Omitting this field preserves immediate creation for existing integrations. + * + * @param publish the value + * @return this builder + */ + public Builder publish(boolean publish) { + return set("publish", Conv.BOOLEAN, publish); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseRoutingRuleCreate} + * @throws IllegalStateException when a required field is missing + */ + public CaseRoutingRuleCreate build() { + require("name", false); + require("conditions", false); + require("blueprint", false); + return new CaseRoutingRuleCreate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseRoutingRuleUpdate.java b/src/main/java/me/didit/types/CaseRoutingRuleUpdate.java new file mode 100644 index 0000000..ec68f88 --- /dev/null +++ b/src/main/java/me/didit/types/CaseRoutingRuleUpdate.java @@ -0,0 +1,259 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CaseRoutingRuleUpdate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "priority", "conditions", "required_skills", "blueprint", "team", "is_active", "expected_version"); + + private CaseRoutingRuleUpdate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseRoutingRuleUpdate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseRoutingRuleUpdate fromJson(JsonNode json) { + return new CaseRoutingRuleUpdate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.LONG); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(CaseRoutingCondition::fromJson))); + } + + /** + * The required_skills field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> requiredSkills() { + return Json.optional(json, "required_skills", Conv.list(Conv.STRING)); + } + + /** + * The blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.STRING); + } + + /** + * The team field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional team() { + return Json.optional(json, "team", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Version opened by the editor. When supplied, stale writes return 409 without changing the rule. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedVersion() { + return Json.optional(json, "expected_version", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseRoutingRuleUpdate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseRoutingRuleUpdate from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(long priority) { + return set("priority", Conv.LONG, priority); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(CaseRoutingCondition::fromJson)), conditions); + } + + /** + * The required_skills field. + * + * @param requiredSkills the value + * @return this builder + */ + public Builder requiredSkills(List requiredSkills) { + return set("required_skills", Conv.list(Conv.STRING), requiredSkills); + } + + /** + * The blueprint field. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * The team field. + * + * @param team the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder team(@Nullable String team) { + return setNullable("team", Conv.STRING, team); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Version opened by the editor. When supplied, stale writes return 409 without changing the rule. + * + * @param expectedVersion the value + * @return this builder + */ + public Builder expectedVersion(long expectedVersion) { + return set("expected_version", Conv.LONG, expectedVersion); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseRoutingRuleUpdate} + */ + public CaseRoutingRuleUpdate build() { + return new CaseRoutingRuleUpdate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CaseSubject.java b/src/main/java/me/didit/types/CaseSubject.java new file mode 100644 index 0000000..f784b73 --- /dev/null +++ b/src/main/java/me/didit/types/CaseSubject.java @@ -0,0 +1,203 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** The single user or business the case is anchored to. */ +public final class CaseSubject extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "uuid", "name", "external_id"); + + private CaseSubject(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseSubject} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseSubject fromJson(JsonNode json) { + return new CaseSubject(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.enumeration(CaseSubject.Type::of)); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The subject's vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional externalId() { + return Json.optional(json, "external_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseSubject}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseSubject from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(CaseSubject.Type type) { + return set("type", Conv.enumeration(CaseSubject.Type::of), type); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The subject's vendor_data. + * + * @param externalId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder externalId(@Nullable String externalId) { + return setNullable("external_id", Conv.STRING, externalId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseSubject} + */ + public CaseSubject build() { + return new CaseSubject(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "user"}. */ + public static final Type USER = new Type("user"); + + /** The value {@code "business"}. */ + public static final Type BUSINESS = new Type("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesAssignParams.java b/src/main/java/me/didit/types/CasesAssignParams.java new file mode 100644 index 0000000..8711533 --- /dev/null +++ b/src/main/java/me/didit/types/CasesAssignParams.java @@ -0,0 +1,142 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.assign}. */ +public final class CasesAssignParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("assignee_user_id", "assignee_email", "assignee_name"); + + private CasesAssignParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesAssignParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesAssignParams fromJson(JsonNode json) { + return new CasesAssignParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * null to unassign. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeUserId() { + return Json.optional(json, "assignee_user_id", Conv.STRING); + } + + /** + * The assignee_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeEmail() { + return Json.optional(json, "assignee_email", Conv.STRING); + } + + /** + * The assignee_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeName() { + return Json.optional(json, "assignee_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesAssignParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesAssignParams from) { + super(from); + } + + /** + * null to unassign. + * + * @param assigneeUserId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeUserId(@Nullable String assigneeUserId) { + return setNullable("assignee_user_id", Conv.STRING, assigneeUserId); + } + + /** + * The assignee_email field. + * + * @param assigneeEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeEmail(@Nullable String assigneeEmail) { + return setNullable("assignee_email", Conv.STRING, assigneeEmail); + } + + /** + * The assignee_name field. + * + * @param assigneeName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeName(@Nullable String assigneeName) { + return setNullable("assignee_name", Conv.STRING, assigneeName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesAssignParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesAssignParams build() { + require("assignee_user_id", true); + return new CasesAssignParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsCreateParams.java b/src/main/java/me/didit/types/CasesBlueprintsCreateParams.java new file mode 100644 index 0000000..a78c1c4 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsCreateParams.java @@ -0,0 +1,406 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.blueprints.create}. */ +public final class CasesBlueprintsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "assignee_pool", "assignment_method", "max_active_cases", "escalation_enabled", "escalation_blueprint", "transfer_enabled", "four_eyes_checker_blueprint", "require_resolution_note", "content_config", "is_active", "default_deadline_hours", "publish"); + + private CasesBlueprintsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsCreateParams fromJson(JsonNode json) { + return new CasesBlueprintsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Max 24 characters, e.g. "AML investigation". + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * List of User UUIDs. Empty arrays are rejected with "Pick at least one assignee". + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List assigneePool() { + return Json.required(json, "assignee_pool", Conv.list(Conv.STRING)); + } + + /** + * The assignment_method field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignmentMethod() { + return Json.optional(json, "assignment_method", Conv.enumeration(CasesBlueprintsCreateParams.AssignmentMethod::of)); + } + + /** + * Automatic-mode threshold: "fewer than N cases of this blueprint assigned". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxActiveCases() { + return Json.optional(json, "max_active_cases", Conv.LONG); + } + + /** + * The escalation_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationEnabled() { + return Json.optional(json, "escalation_enabled", Conv.BOOLEAN); + } + + /** + * Target blueprint UUID. Not enforced at save time, but the escalate action fails with 400 until both escalation_enabled and escalation_blueprint are set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationBlueprint() { + return Json.optional(json, "escalation_blueprint", Conv.STRING); + } + + /** + * The transfer_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transferEnabled() { + return Json.optional(json, "transfer_enabled", Conv.BOOLEAN); + } + + /** + * Setting this enables 4-eyes review: resolutions on this blueprint stage on the checker blueprint's queue. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fourEyesCheckerBlueprint() { + return Json.optional(json, "four_eyes_checker_blueprint", Conv.STRING); + } + + /** + * The require_resolution_note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requireResolutionNote() { + return Json.optional(json, "require_resolution_note", Conv.BOOLEAN); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentConfig() { + return Json.optional(json, "content_config", Conv.model(CaseContentConfig::fromJson)); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Default deadline for newly opened cases. Existing case deadlines are unchanged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultDeadlineHours() { + return Json.optional(json, "default_deadline_hours", Conv.LONG); + } + + /** + * Set false to save a never-published draft. The record remains inactive at version 0 until the draft is explicitly published. Omitting this field preserves immediate creation for existing integrations. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publish() { + return Json.optional(json, "publish", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsCreateParams from) { + super(from); + } + + /** + * Max 24 characters, e.g. "AML investigation". + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * List of User UUIDs. Empty arrays are rejected with "Pick at least one assignee". + * + * @param assigneePool the value + * @return this builder + */ + public Builder assigneePool(List assigneePool) { + return set("assignee_pool", Conv.list(Conv.STRING), assigneePool); + } + + /** + * The assignment_method field. + * + * @param assignmentMethod the value + * @return this builder + */ + public Builder assignmentMethod(CasesBlueprintsCreateParams.AssignmentMethod assignmentMethod) { + return set("assignment_method", Conv.enumeration(CasesBlueprintsCreateParams.AssignmentMethod::of), assignmentMethod); + } + + /** + * Automatic-mode threshold: "fewer than N cases of this blueprint assigned". + * + * @param maxActiveCases the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxActiveCases(@Nullable Long maxActiveCases) { + return setNullable("max_active_cases", Conv.LONG, maxActiveCases); + } + + /** + * The escalation_enabled field. + * + * @param escalationEnabled the value + * @return this builder + */ + public Builder escalationEnabled(boolean escalationEnabled) { + return set("escalation_enabled", Conv.BOOLEAN, escalationEnabled); + } + + /** + * Target blueprint UUID. Not enforced at save time, but the escalate action fails with 400 until both escalation_enabled and escalation_blueprint are set. + * + * @param escalationBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder escalationBlueprint(@Nullable String escalationBlueprint) { + return setNullable("escalation_blueprint", Conv.STRING, escalationBlueprint); + } + + /** + * The transfer_enabled field. + * + * @param transferEnabled the value + * @return this builder + */ + public Builder transferEnabled(boolean transferEnabled) { + return set("transfer_enabled", Conv.BOOLEAN, transferEnabled); + } + + /** + * Setting this enables 4-eyes review: resolutions on this blueprint stage on the checker blueprint's queue. + * + * @param fourEyesCheckerBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fourEyesCheckerBlueprint(@Nullable String fourEyesCheckerBlueprint) { + return setNullable("four_eyes_checker_blueprint", Conv.STRING, fourEyesCheckerBlueprint); + } + + /** + * The require_resolution_note field. + * + * @param requireResolutionNote the value + * @return this builder + */ + public Builder requireResolutionNote(boolean requireResolutionNote) { + return set("require_resolution_note", Conv.BOOLEAN, requireResolutionNote); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @param contentConfig the value + * @return this builder + */ + public Builder contentConfig(CaseContentConfig contentConfig) { + return set("content_config", Conv.model(CaseContentConfig::fromJson), contentConfig); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Default deadline for newly opened cases. Existing case deadlines are unchanged. + * + * @param defaultDeadlineHours the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder defaultDeadlineHours(@Nullable Long defaultDeadlineHours) { + return setNullable("default_deadline_hours", Conv.LONG, defaultDeadlineHours); + } + + /** + * Set false to save a never-published draft. The record remains inactive at version 0 until the draft is explicitly published. Omitting this field preserves immediate creation for existing integrations. + * + * @param publish the value + * @return this builder + */ + public Builder publish(boolean publish) { + return set("publish", Conv.BOOLEAN, publish); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesBlueprintsCreateParams build() { + require("name", false); + require("assignee_pool", false); + return new CasesBlueprintsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AssignmentMethod extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final AssignmentMethod MANUAL = new AssignmentMethod("MANUAL"); + + /** The value {@code "AUTOMATIC"}. */ + public static final AssignmentMethod AUTOMATIC = new AssignmentMethod("AUTOMATIC"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AUTOMATIC); + + private AssignmentMethod(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AssignmentMethod of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AssignmentMethod::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsInstallPresetsParams.java b/src/main/java/me/didit/types/CasesBlueprintsInstallPresetsParams.java new file mode 100644 index 0000000..586ae04 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsInstallPresetsParams.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.blueprints.install_presets}. */ +public final class CasesBlueprintsInstallPresetsParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("preset_keys"); + + private CasesBlueprintsInstallPresetsParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsInstallPresetsParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsInstallPresetsParams fromJson(JsonNode json) { + return new CasesBlueprintsInstallPresetsParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Subset of screening_hit, aml_investigation, suspicious_activity, kyc. Omit to install all. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> presetKeys() { + return Json.optional(json, "preset_keys", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsInstallPresetsParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsInstallPresetsParams from) { + super(from); + } + + /** + * Subset of screening_hit, aml_investigation, suspicious_activity, kyc. Omit to install all. + * + * @param presetKeys the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder presetKeys(@Nullable List presetKeys) { + return setNullable("preset_keys", Conv.list(Conv.STRING), presetKeys); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsInstallPresetsParams} + */ + public CasesBlueprintsInstallPresetsParams build() { + return new CasesBlueprintsInstallPresetsParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsInstallPresetsResponse.java b/src/main/java/me/didit/types/CasesBlueprintsInstallPresetsResponse.java new file mode 100644 index 0000000..2da3254 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsInstallPresetsResponse.java @@ -0,0 +1,240 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.MultiStatusResponse; + +/** + * Response of {@code cases.blueprints.install_presets}; the shape depends on the HTTP status. + */ +public final class CasesBlueprintsInstallPresetsResponse extends MultiStatusResponse { + private CasesBlueprintsInstallPresetsResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static CasesBlueprintsInstallPresetsResponse fromResponse(int statusCode, JsonNode json) { + return new CasesBlueprintsInstallPresetsResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.model(CasesBlueprintsInstallPresetsResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 201. + * + * @return true for status 201 + */ + public boolean isCreated() { + return statusCode() == 201; + } + + /** + * The body of a 201 response. + * + * @return the body, or empty for another status + */ + public Optional asCreated() { + return isCreated() ? Optional.of(Conv.model(CasesBlueprintsInstallPresetsResponse.Created::fromJson).read(json)) : Optional.empty(); + } + + public static final class Ok extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("created"); + + private Ok(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Ok} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Ok fromJson(JsonNode json) { + return new Ok(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> created() { + return Json.optional(json, "created", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Ok}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Ok from) { + super(from); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(List created) { + return set("created", Conv.list(Conv.STRING), created); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Ok} + */ + public Ok build() { + return new Ok(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Created extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("created"); + + private Created(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Created} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Created fromJson(JsonNode json) { + return new Created(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> created() { + return Json.optional(json, "created", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Created}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Created from) { + super(from); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(List created) { + return set("created", Conv.list(Conv.STRING), created); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Created} + */ + public Created build() { + return new Created(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsListHistoryParams.java b/src/main/java/me/didit/types/CasesBlueprintsListHistoryParams.java new file mode 100644 index 0000000..878b87b --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsListHistoryParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.blueprints.list_history}. */ +public final class CasesBlueprintsListHistoryParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ordering", "limit", "offset"); + + private CasesBlueprintsListHistoryParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsListHistoryParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsListHistoryParams fromJson(JsonNode json) { + return new CasesBlueprintsListHistoryParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Which field to use when ordering the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + /** + * Number of results to return per page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The initial index from which to return the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsListHistoryParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsListHistoryParams from) { + super(from); + } + + /** + * Which field to use when ordering the results. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Number of results to return per page. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The initial index from which to return the results. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsListHistoryParams} + */ + public CasesBlueprintsListHistoryParams build() { + return new CasesBlueprintsListHistoryParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsListParams.java b/src/main/java/me/didit/types/CasesBlueprintsListParams.java new file mode 100644 index 0000000..2b0f9bd --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.blueprints.list}. */ +public final class CasesBlueprintsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private CasesBlueprintsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsListParams fromJson(JsonNode json) { + return new CasesBlueprintsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsListParams from) { + super(from); + } + + /** + * Page size. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsListParams} + */ + public CasesBlueprintsListParams build() { + return new CasesBlueprintsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsListPresetsResponse.java b/src/main/java/me/didit/types/CasesBlueprintsListPresetsResponse.java new file mode 100644 index 0000000..0ac1e95 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsListPresetsResponse.java @@ -0,0 +1,312 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class CasesBlueprintsListPresetsResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private CasesBlueprintsListPresetsResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsListPresetsResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsListPresetsResponse fromJson(JsonNode json) { + return new CasesBlueprintsListPresetsResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CasesBlueprintsListPresetsResponse.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsListPresetsResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsListPresetsResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CasesBlueprintsListPresetsResponse.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsListPresetsResponse} + */ + public CasesBlueprintsListPresetsResponse build() { + return new CasesBlueprintsListPresetsResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("preset_key", "name", "description", "content_config", "installed"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The preset_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional presetKey() { + return Json.optional(json, "preset_key", Conv.enumeration(CasesBlueprintsListPresetsResponse.Results.PresetKey::of)); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentConfig() { + return Json.optional(json, "content_config", Conv.model(CaseContentConfig::fromJson)); + } + + /** + * The installed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional installed() { + return Json.optional(json, "installed", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * The preset_key field. + * + * @param presetKey the value + * @return this builder + */ + public Builder presetKey(CasesBlueprintsListPresetsResponse.Results.PresetKey presetKey) { + return set("preset_key", Conv.enumeration(CasesBlueprintsListPresetsResponse.Results.PresetKey::of), presetKey); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @param contentConfig the value + * @return this builder + */ + public Builder contentConfig(CaseContentConfig contentConfig) { + return set("content_config", Conv.model(CaseContentConfig::fromJson), contentConfig); + } + + /** + * The installed field. + * + * @param installed the value + * @return this builder + */ + public Builder installed(boolean installed) { + return set("installed", Conv.BOOLEAN, installed); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PresetKey extends StringEnum { + /** The value {@code "screening_hit"}. */ + public static final PresetKey SCREENING_HIT = new PresetKey("screening_hit"); + + /** The value {@code "aml_investigation"}. */ + public static final PresetKey AML_INVESTIGATION = new PresetKey("aml_investigation"); + + /** The value {@code "suspicious_activity"}. */ + public static final PresetKey SUSPICIOUS_ACTIVITY = new PresetKey("suspicious_activity"); + + /** The value {@code "kyc"}. */ + public static final PresetKey KYC = new PresetKey("kyc"); + + private static final List KNOWN_VALUES = List.of(SCREENING_HIT, AML_INVESTIGATION, SUSPICIOUS_ACTIVITY, KYC); + + private PresetKey(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PresetKey of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PresetKey::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsListResponse.java b/src/main/java/me/didit/types/CasesBlueprintsListResponse.java new file mode 100644 index 0000000..3aa9111 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasesBlueprintsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CasesBlueprintsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsListResponse fromJson(JsonNode json) { + return new CasesBlueprintsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CaseBlueprintListItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsListResponse from) { + super(from); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseBlueprintListItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsListResponse} + */ + public CasesBlueprintsListResponse build() { + return new CasesBlueprintsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesBlueprintsUpdateParams.java b/src/main/java/me/didit/types/CasesBlueprintsUpdateParams.java new file mode 100644 index 0000000..0a2c389 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBlueprintsUpdateParams.java @@ -0,0 +1,403 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.blueprints.update}. */ +public final class CasesBlueprintsUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "description", "assignee_pool", "assignment_method", "max_active_cases", "escalation_enabled", "escalation_blueprint", "transfer_enabled", "four_eyes_checker_blueprint", "require_resolution_note", "content_config", "is_active", "default_deadline_hours", "expected_version"); + + private CasesBlueprintsUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBlueprintsUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBlueprintsUpdateParams fromJson(JsonNode json) { + return new CasesBlueprintsUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Max 24 characters, e.g. "AML investigation". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * List of User UUIDs. Empty arrays are rejected with "Pick at least one assignee". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> assigneePool() { + return Json.optional(json, "assignee_pool", Conv.list(Conv.STRING)); + } + + /** + * The assignment_method field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignmentMethod() { + return Json.optional(json, "assignment_method", Conv.enumeration(CasesBlueprintsUpdateParams.AssignmentMethod::of)); + } + + /** + * Automatic-mode threshold: "fewer than N cases of this blueprint assigned". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxActiveCases() { + return Json.optional(json, "max_active_cases", Conv.LONG); + } + + /** + * The escalation_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationEnabled() { + return Json.optional(json, "escalation_enabled", Conv.BOOLEAN); + } + + /** + * Target blueprint UUID. Not enforced at save time, but the escalate action fails with 400 until both escalation_enabled and escalation_blueprint are set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationBlueprint() { + return Json.optional(json, "escalation_blueprint", Conv.STRING); + } + + /** + * The transfer_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transferEnabled() { + return Json.optional(json, "transfer_enabled", Conv.BOOLEAN); + } + + /** + * Setting this enables 4-eyes review: resolutions on this blueprint stage on the checker blueprint's queue. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fourEyesCheckerBlueprint() { + return Json.optional(json, "four_eyes_checker_blueprint", Conv.STRING); + } + + /** + * The require_resolution_note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requireResolutionNote() { + return Json.optional(json, "require_resolution_note", Conv.BOOLEAN); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentConfig() { + return Json.optional(json, "content_config", Conv.model(CaseContentConfig::fromJson)); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Default deadline for newly opened cases. Existing case deadlines are unchanged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultDeadlineHours() { + return Json.optional(json, "default_deadline_hours", Conv.LONG); + } + + /** + * The version opened by the editor. A stale version returns 409 without changing the review policy. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedVersion() { + return Json.optional(json, "expected_version", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBlueprintsUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBlueprintsUpdateParams from) { + super(from); + } + + /** + * Max 24 characters, e.g. "AML investigation". + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * List of User UUIDs. Empty arrays are rejected with "Pick at least one assignee". + * + * @param assigneePool the value + * @return this builder + */ + public Builder assigneePool(List assigneePool) { + return set("assignee_pool", Conv.list(Conv.STRING), assigneePool); + } + + /** + * The assignment_method field. + * + * @param assignmentMethod the value + * @return this builder + */ + public Builder assignmentMethod(CasesBlueprintsUpdateParams.AssignmentMethod assignmentMethod) { + return set("assignment_method", Conv.enumeration(CasesBlueprintsUpdateParams.AssignmentMethod::of), assignmentMethod); + } + + /** + * Automatic-mode threshold: "fewer than N cases of this blueprint assigned". + * + * @param maxActiveCases the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxActiveCases(@Nullable Long maxActiveCases) { + return setNullable("max_active_cases", Conv.LONG, maxActiveCases); + } + + /** + * The escalation_enabled field. + * + * @param escalationEnabled the value + * @return this builder + */ + public Builder escalationEnabled(boolean escalationEnabled) { + return set("escalation_enabled", Conv.BOOLEAN, escalationEnabled); + } + + /** + * Target blueprint UUID. Not enforced at save time, but the escalate action fails with 400 until both escalation_enabled and escalation_blueprint are set. + * + * @param escalationBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder escalationBlueprint(@Nullable String escalationBlueprint) { + return setNullable("escalation_blueprint", Conv.STRING, escalationBlueprint); + } + + /** + * The transfer_enabled field. + * + * @param transferEnabled the value + * @return this builder + */ + public Builder transferEnabled(boolean transferEnabled) { + return set("transfer_enabled", Conv.BOOLEAN, transferEnabled); + } + + /** + * Setting this enables 4-eyes review: resolutions on this blueprint stage on the checker blueprint's queue. + * + * @param fourEyesCheckerBlueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fourEyesCheckerBlueprint(@Nullable String fourEyesCheckerBlueprint) { + return setNullable("four_eyes_checker_blueprint", Conv.STRING, fourEyesCheckerBlueprint); + } + + /** + * The require_resolution_note field. + * + * @param requireResolutionNote the value + * @return this builder + */ + public Builder requireResolutionNote(boolean requireResolutionNote) { + return set("require_resolution_note", Conv.BOOLEAN, requireResolutionNote); + } + + /** + * The six togglable sections that drive which tabs and fields appear on the case page. Unknown sections or keys are rejected. + * + * @param contentConfig the value + * @return this builder + */ + public Builder contentConfig(CaseContentConfig contentConfig) { + return set("content_config", Conv.model(CaseContentConfig::fromJson), contentConfig); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Default deadline for newly opened cases. Existing case deadlines are unchanged. + * + * @param defaultDeadlineHours the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder defaultDeadlineHours(@Nullable Long defaultDeadlineHours) { + return setNullable("default_deadline_hours", Conv.LONG, defaultDeadlineHours); + } + + /** + * The version opened by the editor. A stale version returns 409 without changing the review policy. + * + * @param expectedVersion the value + * @return this builder + */ + public Builder expectedVersion(long expectedVersion) { + return set("expected_version", Conv.LONG, expectedVersion); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBlueprintsUpdateParams} + */ + public CasesBlueprintsUpdateParams build() { + return new CasesBlueprintsUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AssignmentMethod extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final AssignmentMethod MANUAL = new AssignmentMethod("MANUAL"); + + /** The value {@code "AUTOMATIC"}. */ + public static final AssignmentMethod AUTOMATIC = new AssignmentMethod("AUTOMATIC"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AUTOMATIC); + + private AssignmentMethod(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AssignmentMethod of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AssignmentMethod::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesBulkAssignParams.java b/src/main/java/me/didit/types/CasesBulkAssignParams.java new file mode 100644 index 0000000..a266f53 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBulkAssignParams.java @@ -0,0 +1,163 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.bulk_assign}. */ +public final class CasesBulkAssignParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case_uuids", "assignee_user_id", "assignee_email", "assignee_name"); + + private CasesBulkAssignParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBulkAssignParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBulkAssignParams fromJson(JsonNode json) { + return new CasesBulkAssignParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The case_uuids field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List caseUuids() { + return Json.required(json, "case_uuids", Conv.list(Conv.STRING)); + } + + /** + * The assignee_user_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeUserId() { + return Json.optional(json, "assignee_user_id", Conv.STRING); + } + + /** + * The assignee_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeEmail() { + return Json.optional(json, "assignee_email", Conv.STRING); + } + + /** + * The assignee_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigneeName() { + return Json.optional(json, "assignee_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBulkAssignParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBulkAssignParams from) { + super(from); + } + + /** + * The case_uuids field. + * + * @param caseUuids the value + * @return this builder + */ + public Builder caseUuids(List caseUuids) { + return set("case_uuids", Conv.list(Conv.STRING), caseUuids); + } + + /** + * The assignee_user_id field. + * + * @param assigneeUserId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeUserId(@Nullable String assigneeUserId) { + return setNullable("assignee_user_id", Conv.STRING, assigneeUserId); + } + + /** + * The assignee_email field. + * + * @param assigneeEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeEmail(@Nullable String assigneeEmail) { + return setNullable("assignee_email", Conv.STRING, assigneeEmail); + } + + /** + * The assignee_name field. + * + * @param assigneeName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assigneeName(@Nullable String assigneeName) { + return setNullable("assignee_name", Conv.STRING, assigneeName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBulkAssignParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesBulkAssignParams build() { + require("case_uuids", false); + require("assignee_user_id", true); + return new CasesBulkAssignParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesBulkAssignResponse.java b/src/main/java/me/didit/types/CasesBulkAssignResponse.java new file mode 100644 index 0000000..b05216b --- /dev/null +++ b/src/main/java/me/didit/types/CasesBulkAssignResponse.java @@ -0,0 +1,223 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesBulkAssignResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("updated", "failures"); + + private CasesBulkAssignResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBulkAssignResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBulkAssignResponse fromJson(JsonNode json) { + return new CasesBulkAssignResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The updated field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updated() { + return Json.optional(json, "updated", Conv.LONG); + } + + /** + * The failures field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> failures() { + return Json.optional(json, "failures", Conv.list(Conv.model(CasesBulkAssignResponse.Failures::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBulkAssignResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBulkAssignResponse from) { + super(from); + } + + /** + * The updated field. + * + * @param updated the value + * @return this builder + */ + public Builder updated(long updated) { + return set("updated", Conv.LONG, updated); + } + + /** + * The failures field. + * + * @param failures the value + * @return this builder + */ + public Builder failures(List failures) { + return set("failures", Conv.list(Conv.model(CasesBulkAssignResponse.Failures::fromJson)), failures); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBulkAssignResponse} + */ + public CasesBulkAssignResponse build() { + return new CasesBulkAssignResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Failures extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case_uuid", "detail"); + + private Failures(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Failures} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Failures fromJson(JsonNode json) { + return new Failures(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The case_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseUuid() { + return Json.optional(json, "case_uuid", Conv.STRING); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Failures}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Failures from) { + super(from); + } + + /** + * The case_uuid field. + * + * @param caseUuid the value + * @return this builder + */ + public Builder caseUuid(String caseUuid) { + return set("case_uuid", Conv.STRING, caseUuid); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Failures} + */ + public Failures build() { + return new Failures(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesBulkUpdateStatusParams.java b/src/main/java/me/didit/types/CasesBulkUpdateStatusParams.java new file mode 100644 index 0000000..862d6f0 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBulkUpdateStatusParams.java @@ -0,0 +1,252 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.bulk_update_status}. */ +public final class CasesBulkUpdateStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case_uuids", "status", "resolution", "note"); + + private CasesBulkUpdateStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBulkUpdateStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBulkUpdateStatusParams fromJson(JsonNode json) { + return new CasesBulkUpdateStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The case_uuids field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List caseUuids() { + return Json.required(json, "case_uuids", Conv.list(Conv.STRING)); + } + + /** + * The status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CasesBulkUpdateStatusParams.Status status() { + return Json.required(json, "status", Conv.enumeration(CasesBulkUpdateStatusParams.Status::of)); + } + + /** + * Required when status is RESOLVED. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolution() { + return Json.optional(json, "resolution", Conv.enumeration(CasesBulkUpdateStatusParams.Resolution::of)); + } + + /** + * The note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional note() { + return Json.optional(json, "note", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBulkUpdateStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBulkUpdateStatusParams from) { + super(from); + } + + /** + * The case_uuids field. + * + * @param caseUuids the value + * @return this builder + */ + public Builder caseUuids(List caseUuids) { + return set("case_uuids", Conv.list(Conv.STRING), caseUuids); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(CasesBulkUpdateStatusParams.Status status) { + return set("status", Conv.enumeration(CasesBulkUpdateStatusParams.Status::of), status); + } + + /** + * Required when status is RESOLVED. + * + * @param resolution the value + * @return this builder + */ + public Builder resolution(CasesBulkUpdateStatusParams.Resolution resolution) { + return set("resolution", Conv.enumeration(CasesBulkUpdateStatusParams.Resolution::of), resolution); + } + + /** + * The note field. + * + * @param note the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder note(@Nullable String note) { + return setNullable("note", Conv.STRING, note); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBulkUpdateStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesBulkUpdateStatusParams build() { + require("case_uuids", false); + require("status", false); + return new CasesBulkUpdateStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final Status OPEN = new Status("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final Status RESOLVED = new Status("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Required when status is RESOLVED. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Resolution extends StringEnum { + /** The value {@code "FALSE_POSITIVE"}. */ + public static final Resolution FALSE_POSITIVE = new Resolution("FALSE_POSITIVE"); + + /** The value {@code "VALID_THREAT"}. */ + public static final Resolution VALID_THREAT = new Resolution("VALID_THREAT"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, VALID_THREAT); + + private Resolution(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Resolution of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Resolution::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesBulkUpdateStatusResponse.java b/src/main/java/me/didit/types/CasesBulkUpdateStatusResponse.java new file mode 100644 index 0000000..e3c1063 --- /dev/null +++ b/src/main/java/me/didit/types/CasesBulkUpdateStatusResponse.java @@ -0,0 +1,223 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesBulkUpdateStatusResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("updated", "failures"); + + private CasesBulkUpdateStatusResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesBulkUpdateStatusResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesBulkUpdateStatusResponse fromJson(JsonNode json) { + return new CasesBulkUpdateStatusResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The updated field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updated() { + return Json.optional(json, "updated", Conv.LONG); + } + + /** + * The failures field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> failures() { + return Json.optional(json, "failures", Conv.list(Conv.model(CasesBulkUpdateStatusResponse.Failures::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesBulkUpdateStatusResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesBulkUpdateStatusResponse from) { + super(from); + } + + /** + * The updated field. + * + * @param updated the value + * @return this builder + */ + public Builder updated(long updated) { + return set("updated", Conv.LONG, updated); + } + + /** + * The failures field. + * + * @param failures the value + * @return this builder + */ + public Builder failures(List failures) { + return set("failures", Conv.list(Conv.model(CasesBulkUpdateStatusResponse.Failures::fromJson)), failures); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesBulkUpdateStatusResponse} + */ + public CasesBulkUpdateStatusResponse build() { + return new CasesBulkUpdateStatusResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Failures extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case_uuid", "detail"); + + private Failures(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Failures} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Failures fromJson(JsonNode json) { + return new Failures(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The case_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseUuid() { + return Json.optional(json, "case_uuid", Conv.STRING); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Failures}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Failures from) { + super(from); + } + + /** + * The case_uuid field. + * + * @param caseUuid the value + * @return this builder + */ + public Builder caseUuid(String caseUuid) { + return set("case_uuid", Conv.STRING, caseUuid); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Failures} + */ + public Failures build() { + return new Failures(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesChecklistToggleItemParams.java b/src/main/java/me/didit/types/CasesChecklistToggleItemParams.java new file mode 100644 index 0000000..8dbaa8c --- /dev/null +++ b/src/main/java/me/didit/types/CasesChecklistToggleItemParams.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.checklist.toggle_item}. */ +public final class CasesChecklistToggleItemParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_completed"); + + private CasesChecklistToggleItemParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesChecklistToggleItemParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesChecklistToggleItemParams fromJson(JsonNode json) { + return new CasesChecklistToggleItemParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The is_completed field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isCompleted() { + return Json.required(json, "is_completed", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesChecklistToggleItemParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesChecklistToggleItemParams from) { + super(from); + } + + /** + * The is_completed field. + * + * @param isCompleted the value + * @return this builder + */ + public Builder isCompleted(boolean isCompleted) { + return set("is_completed", Conv.BOOLEAN, isCompleted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesChecklistToggleItemParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesChecklistToggleItemParams build() { + require("is_completed", false); + return new CasesChecklistToggleItemParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesCreateParams.java b/src/main/java/me/didit/types/CasesCreateParams.java new file mode 100644 index 0000000..b0ae3f4 --- /dev/null +++ b/src/main/java/me/didit/types/CasesCreateParams.java @@ -0,0 +1,497 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.create}. */ +public final class CasesCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "blueprint", "priority", "due_at", "tags", "subject", "links", "assigned_to", "review_duplicates", "separate_incident_reason", "source_context"); + + private CasesCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesCreateParams fromJson(JsonNode json) { + return new CasesCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The title field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String title() { + return Json.required(json, "title", Conv.STRING); + } + + /** + * CaseBlueprint UUID. Omit for no blueprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CasesCreateParams.Priority::of)); + } + + /** + * The due_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dueAt() { + return Json.optional(json, "due_at", Conv.DATE_TIME); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * Required unless links is provided; the case's exactly-one subject. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subject() { + return Json.optional(json, "subject", Conv.model(CasesCreateParams.Subject::fromJson)); + } + + /** + * Sessions/business sessions/transactions to attach on creation, e.g. [{"entity_type": "transaction", "entity_uuid": "..."}]. When subject is omitted, the subject is derived from the first link's owner. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> links() { + return Json.optional(json, "links", Conv.list(Conv.OBJECT)); + } + + /** + * User UUID to assign immediately. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedTo() { + return Json.optional(json, "assigned_to", Conv.STRING); + } + + /** + * Recheck existing investigations before creating the case. When true, a subject with existing cases requires a nonblank separate_incident_reason. The console always enables this protection. Omitting it preserves existing API behavior. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewDuplicates() { + return Json.optional(json, "review_duplicates", Conv.BOOLEAN); + } + + /** + * The separate_incident_reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional separateIncidentReason() { + return Json.optional(json, "separate_incident_reason", Conv.STRING); + } + + /** + * The source_context field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceContext() { + return Json.optional(json, "source_context", Conv.model(CaseDuplicateCaseFraudSourceContextRequest::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesCreateParams from) { + super(from); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * CaseBlueprint UUID. Omit for no blueprint. + * + * @param blueprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder blueprint(@Nullable String blueprint) { + return setNullable("blueprint", Conv.STRING, blueprint); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(CasesCreateParams.Priority priority) { + return set("priority", Conv.enumeration(CasesCreateParams.Priority::of), priority); + } + + /** + * The due_at field. + * + * @param dueAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dueAt(@Nullable OffsetDateTime dueAt) { + return setNullable("due_at", Conv.DATE_TIME, dueAt); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * Required unless links is provided; the case's exactly-one subject. + * + * @param subject the value + * @return this builder + */ + public Builder subject(CasesCreateParams.Subject subject) { + return set("subject", Conv.model(CasesCreateParams.Subject::fromJson), subject); + } + + /** + * Sessions/business sessions/transactions to attach on creation, e.g. [{"entity_type": "transaction", "entity_uuid": "..."}]. When subject is omitted, the subject is derived from the first link's owner. + * + * @param links the value + * @return this builder + */ + public Builder links(List> links) { + return setAny("links", links); + } + + /** + * User UUID to assign immediately. + * + * @param assignedTo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assignedTo(@Nullable String assignedTo) { + return setNullable("assigned_to", Conv.STRING, assignedTo); + } + + /** + * Recheck existing investigations before creating the case. When true, a subject with existing cases requires a nonblank separate_incident_reason. The console always enables this protection. Omitting it preserves existing API behavior. + * + * @param reviewDuplicates the value + * @return this builder + */ + public Builder reviewDuplicates(boolean reviewDuplicates) { + return set("review_duplicates", Conv.BOOLEAN, reviewDuplicates); + } + + /** + * The separate_incident_reason field. + * + * @param separateIncidentReason the value + * @return this builder + */ + public Builder separateIncidentReason(String separateIncidentReason) { + return set("separate_incident_reason", Conv.STRING, separateIncidentReason); + } + + /** + * The source_context field. + * + * @param sourceContext the value + * @return this builder + */ + public Builder sourceContext(CaseDuplicateCaseFraudSourceContextRequest sourceContext) { + return set("source_context", Conv.model(CaseDuplicateCaseFraudSourceContextRequest::fromJson), sourceContext); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesCreateParams build() { + require("title", false); + return new CasesCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Priority extends StringEnum { + /** The value {@code "LOW"}. */ + public static final Priority LOW = new Priority("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Priority MEDIUM = new Priority("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Priority HIGH = new Priority("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Priority(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Priority of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Priority::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Required unless links is provided; the case's exactly-one subject. */ + public static final class Subject extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "uuid"); + + private Subject(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Subject} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Subject fromJson(JsonNode json) { + return new Subject(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.enumeration(CasesCreateParams.Subject.Type::of)); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Subject}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Subject from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(CasesCreateParams.Subject.Type type) { + return set("type", Conv.enumeration(CasesCreateParams.Subject.Type::of), type); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Subject} + */ + public Subject build() { + return new Subject(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "user"}. */ + public static final Type USER = new Type("user"); + + /** The value {@code "business"}. */ + public static final Type BUSINESS = new Type("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesLinksCreateParams.java b/src/main/java/me/didit/types/CasesLinksCreateParams.java new file mode 100644 index 0000000..735b379 --- /dev/null +++ b/src/main/java/me/didit/types/CasesLinksCreateParams.java @@ -0,0 +1,167 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code cases.links.create}. */ +public final class CasesLinksCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entity_type", "entity_uuid"); + + private CasesLinksCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesLinksCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesLinksCreateParams fromJson(JsonNode json) { + return new CasesLinksCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The entity_type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CasesLinksCreateParams.EntityType entityType() { + return Json.required(json, "entity_type", Conv.enumeration(CasesLinksCreateParams.EntityType::of)); + } + + /** + * The entity_uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String entityUuid() { + return Json.required(json, "entity_uuid", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesLinksCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesLinksCreateParams from) { + super(from); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(CasesLinksCreateParams.EntityType entityType) { + return set("entity_type", Conv.enumeration(CasesLinksCreateParams.EntityType::of), entityType); + } + + /** + * The entity_uuid field. + * + * @param entityUuid the value + * @return this builder + */ + public Builder entityUuid(String entityUuid) { + return set("entity_uuid", Conv.STRING, entityUuid); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesLinksCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesLinksCreateParams build() { + require("entity_type", false); + require("entity_uuid", false); + return new CasesLinksCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "session"}. */ + public static final EntityType SESSION = new EntityType("session"); + + /** The value {@code "business_session"}. */ + public static final EntityType BUSINESS_SESSION = new EntityType("business_session"); + + /** The value {@code "transaction"}. */ + public static final EntityType TRANSACTION = new EntityType("transaction"); + + private static final List KNOWN_VALUES = List.of(SESSION, BUSINESS_SESSION, TRANSACTION); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesListActionReceiptsParams.java b/src/main/java/me/didit/types/CasesListActionReceiptsParams.java new file mode 100644 index 0000000..bc13ab5 --- /dev/null +++ b/src/main/java/me/didit/types/CasesListActionReceiptsParams.java @@ -0,0 +1,99 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.list_action_receipts}. */ +public final class CasesListActionReceiptsParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("offset"); + + private CasesListActionReceiptsParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesListActionReceiptsParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesListActionReceiptsParams fromJson(JsonNode json) { + return new CasesListActionReceiptsParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesListActionReceiptsParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesListActionReceiptsParams from) { + super(from); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesListActionReceiptsParams} + */ + public CasesListActionReceiptsParams build() { + return new CasesListActionReceiptsParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesListEventsParams.java b/src/main/java/me/didit/types/CasesListEventsParams.java new file mode 100644 index 0000000..5476db5 --- /dev/null +++ b/src/main/java/me/didit/types/CasesListEventsParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.list_events}. */ +public final class CasesListEventsParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private CasesListEventsParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesListEventsParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesListEventsParams fromJson(JsonNode json) { + return new CasesListEventsParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesListEventsParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesListEventsParams from) { + super(from); + } + + /** + * Page size. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesListEventsParams} + */ + public CasesListEventsParams build() { + return new CasesListEventsParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesListEventsResponse.java b/src/main/java/me/didit/types/CasesListEventsResponse.java new file mode 100644 index 0000000..47f82ef --- /dev/null +++ b/src/main/java/me/didit/types/CasesListEventsResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasesListEventsResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CasesListEventsResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesListEventsResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesListEventsResponse fromJson(JsonNode json) { + return new CasesListEventsResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows. Exact up to 100, capped at 100 beyond that for performance. Rely on next being null to detect the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CaseEvent::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesListEventsResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesListEventsResponse from) { + super(from); + } + + /** + * Number of matching rows. Exact up to 100, capped at 100 beyond that for performance. Rely on next being null to detect the last page. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseEvent::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesListEventsResponse} + */ + public CasesListEventsResponse build() { + return new CasesListEventsResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesListParams.java b/src/main/java/me/didit/types/CasesListParams.java new file mode 100644 index 0000000..3e460f0 --- /dev/null +++ b/src/main/java/me/didit/types/CasesListParams.java @@ -0,0 +1,430 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code cases.list}. */ +public final class CasesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset", "status__in", "priority", "source__in", "blueprint", "assigned_to", "unassigned", "tag", "search", "date_from", "date_to", "due_before", "overdue", "ordering"); + + private CasesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesListParams fromJson(JsonNode json) { + return new CasesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. Defaults to 50. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset of the first record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + /** + * Comma-separated statuses to include, e.g. OPEN,AWAITING_USER. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional statusIn() { + return Json.optional(json, "status__in", Conv.STRING); + } + + /** + * Comma-separated priorities to include. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.STRING); + } + + /** + * Comma-separated sources to include. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceIn() { + return Json.optional(json, "source__in", Conv.STRING); + } + + /** + * Filter to cases on this blueprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.STRING); + } + + /** + * Filter to cases assigned to this user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedTo() { + return Json.optional(json, "assigned_to", Conv.STRING); + } + + /** + * true for unassigned cases, false for assigned cases. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unassigned() { + return Json.optional(json, "unassigned", Conv.BOOLEAN); + } + + /** + * Filter to cases carrying this exact tag. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tag() { + return Json.optional(json, "tag", Conv.STRING); + } + + /** + * Matches title, case_number, tag, subject name/UUID/external ID, linked session UUID, or linked transaction UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional search() { + return Json.optional(json, "search", Conv.STRING); + } + + /** + * Created-at lower bound (inclusive). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateFrom() { + return Json.optional(json, "date_from", Conv.DATE); + } + + /** + * Created-at upper bound (inclusive). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateTo() { + return Json.optional(json, "date_to", Conv.DATE); + } + + /** + * due_at upper bound. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dueBefore() { + return Json.optional(json, "due_before", Conv.DATE_TIME); + } + + /** + * true to return only overdue open/awaiting-user cases. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overdue() { + return Json.optional(json, "overdue", Conv.BOOLEAN); + } + + /** + * Sort order. due_at sorts nulls last. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.enumeration(CasesListParams.Ordering::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesListParams from) { + super(from); + } + + /** + * Page size. Defaults to 50. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset of the first record. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Comma-separated statuses to include, e.g. OPEN,AWAITING_USER. + * + * @param statusIn the value + * @return this builder + */ + public Builder statusIn(String statusIn) { + return set("status__in", Conv.STRING, statusIn); + } + + /** + * Comma-separated priorities to include. + * + * @param priority the value + * @return this builder + */ + public Builder priority(String priority) { + return set("priority", Conv.STRING, priority); + } + + /** + * Comma-separated sources to include. + * + * @param sourceIn the value + * @return this builder + */ + public Builder sourceIn(String sourceIn) { + return set("source__in", Conv.STRING, sourceIn); + } + + /** + * Filter to cases on this blueprint. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * Filter to cases assigned to this user. + * + * @param assignedTo the value + * @return this builder + */ + public Builder assignedTo(String assignedTo) { + return set("assigned_to", Conv.STRING, assignedTo); + } + + /** + * true for unassigned cases, false for assigned cases. + * + * @param unassigned the value + * @return this builder + */ + public Builder unassigned(boolean unassigned) { + return set("unassigned", Conv.BOOLEAN, unassigned); + } + + /** + * Filter to cases carrying this exact tag. + * + * @param tag the value + * @return this builder + */ + public Builder tag(String tag) { + return set("tag", Conv.STRING, tag); + } + + /** + * Matches title, case_number, tag, subject name/UUID/external ID, linked session UUID, or linked transaction UUID. + * + * @param search the value + * @return this builder + */ + public Builder search(String search) { + return set("search", Conv.STRING, search); + } + + /** + * Created-at lower bound (inclusive). + * + * @param dateFrom the value + * @return this builder + */ + public Builder dateFrom(LocalDate dateFrom) { + return set("date_from", Conv.DATE, dateFrom); + } + + /** + * Created-at upper bound (inclusive). + * + * @param dateTo the value + * @return this builder + */ + public Builder dateTo(LocalDate dateTo) { + return set("date_to", Conv.DATE, dateTo); + } + + /** + * due_at upper bound. + * + * @param dueBefore the value + * @return this builder + */ + public Builder dueBefore(OffsetDateTime dueBefore) { + return set("due_before", Conv.DATE_TIME, dueBefore); + } + + /** + * true to return only overdue open/awaiting-user cases. + * + * @param overdue the value + * @return this builder + */ + public Builder overdue(boolean overdue) { + return set("overdue", Conv.BOOLEAN, overdue); + } + + /** + * Sort order. due_at sorts nulls last. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(CasesListParams.Ordering ordering) { + return set("ordering", Conv.enumeration(CasesListParams.Ordering::of), ordering); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesListParams} + */ + public CasesListParams build() { + return new CasesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Ordering extends StringEnum { + /** The value {@code "created_at"}. */ + public static final Ordering CREATED_AT = new Ordering("created_at"); + + /** The value {@code "-created_at"}. */ + public static final Ordering CREATED_AT_2 = new Ordering("-created_at"); + + /** The value {@code "due_at"}. */ + public static final Ordering DUE_AT = new Ordering("due_at"); + + /** The value {@code "-due_at"}. */ + public static final Ordering DUE_AT_2 = new Ordering("-due_at"); + + private static final List KNOWN_VALUES = List.of(CREATED_AT, CREATED_AT_2, DUE_AT, DUE_AT_2); + + private Ordering(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Ordering of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Ordering::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesListResponse.java b/src/main/java/me/didit/types/CasesListResponse.java new file mode 100644 index 0000000..cb6bbaf --- /dev/null +++ b/src/main/java/me/didit/types/CasesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CasesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesListResponse fromJson(JsonNode json) { + return new CasesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows. Exact up to 100, capped at 100 beyond that for performance. Rely on next being null to detect the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CaseListItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesListResponse from) { + super(from); + } + + /** + * Number of matching rows. Exact up to 100, capped at 100 beyond that for performance. Rely on next being null to detect the last page. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseListItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesListResponse} + */ + public CasesListResponse build() { + return new CasesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesListReviewersResponse.java b/src/main/java/me/didit/types/CasesListReviewersResponse.java new file mode 100644 index 0000000..533274d --- /dev/null +++ b/src/main/java/me/didit/types/CasesListReviewersResponse.java @@ -0,0 +1,223 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesListReviewersResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private CasesListReviewersResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesListReviewersResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesListReviewersResponse fromJson(JsonNode json) { + return new CasesListReviewersResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CasesListReviewersResponse.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesListReviewersResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesListReviewersResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CasesListReviewersResponse.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesListReviewersResponse} + */ + public CasesListReviewersResponse build() { + return new CasesListReviewersResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_id", "email", "name"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The user_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userId() { + return Json.optional(json, "user_id", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * The user_id field. + * + * @param userId the value + * @return this builder + */ + public Builder userId(String userId) { + return set("user_id", Conv.STRING, userId); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesNotesCreateAttachmentUploadParams.java b/src/main/java/me/didit/types/CasesNotesCreateAttachmentUploadParams.java new file mode 100644 index 0000000..7ef857c --- /dev/null +++ b/src/main/java/me/didit/types/CasesNotesCreateAttachmentUploadParams.java @@ -0,0 +1,110 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.notes.create_attachment_upload}. */ +public final class CasesNotesCreateAttachmentUploadParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("file"); + + private CasesNotesCreateAttachmentUploadParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesNotesCreateAttachmentUploadParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesNotesCreateAttachmentUploadParams fromJson(JsonNode json) { + return new CasesNotesCreateAttachmentUploadParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The file field. + * + * @return the file to upload, if set + */ + public Optional file() { + return file("file"); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesNotesCreateAttachmentUploadParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesNotesCreateAttachmentUploadParams from) { + super(from); + } + + /** + * The file field. + * + * @param file the value + * @return this builder + */ + public Builder file(FileUpload file) { + return setFile("file", file); + } + + /** + * Uploads the file at {@code path} as {@code file}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder file(Path path) { + return setFile("file", FileUpload.of(path)); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesNotesCreateAttachmentUploadParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesNotesCreateAttachmentUploadParams build() { + requireFile("file"); + return new CasesNotesCreateAttachmentUploadParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesNotesCreateAttachmentUploadResponse.java b/src/main/java/me/didit/types/CasesNotesCreateAttachmentUploadResponse.java new file mode 100644 index 0000000..4ae8fa8 --- /dev/null +++ b/src/main/java/me/didit/types/CasesNotesCreateAttachmentUploadResponse.java @@ -0,0 +1,158 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesNotesCreateAttachmentUploadResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("s3_key", "url", "filename", "file_size"); + + private CasesNotesCreateAttachmentUploadResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesNotesCreateAttachmentUploadResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesNotesCreateAttachmentUploadResponse fromJson(JsonNode json) { + return new CasesNotesCreateAttachmentUploadResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The s3_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional s3Key() { + return Json.optional(json, "s3_key", Conv.STRING); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The filename field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filename() { + return Json.optional(json, "filename", Conv.STRING); + } + + /** + * The file_size field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesNotesCreateAttachmentUploadResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesNotesCreateAttachmentUploadResponse from) { + super(from); + } + + /** + * The s3_key field. + * + * @param s3Key the value + * @return this builder + */ + public Builder s3Key(String s3Key) { + return set("s3_key", Conv.STRING, s3Key); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The filename field. + * + * @param filename the value + * @return this builder + */ + public Builder filename(String filename) { + return set("filename", Conv.STRING, filename); + } + + /** + * The file_size field. + * + * @param fileSize the value + * @return this builder + */ + public Builder fileSize(long fileSize) { + return set("file_size", Conv.LONG, fileSize); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesNotesCreateAttachmentUploadResponse} + */ + public CasesNotesCreateAttachmentUploadResponse build() { + return new CasesNotesCreateAttachmentUploadResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesNotesListParams.java b/src/main/java/me/didit/types/CasesNotesListParams.java new file mode 100644 index 0000000..085e1a7 --- /dev/null +++ b/src/main/java/me/didit/types/CasesNotesListParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.notes.list}. */ +public final class CasesNotesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ordering", "limit", "offset"); + + private CasesNotesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesNotesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesNotesListParams fromJson(JsonNode json) { + return new CasesNotesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Which field to use when ordering the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + /** + * Number of results to return per page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The initial index from which to return the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesNotesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesNotesListParams from) { + super(from); + } + + /** + * Which field to use when ordering the results. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Number of results to return per page. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The initial index from which to return the results. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesNotesListParams} + */ + public CasesNotesListParams build() { + return new CasesNotesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesNotesRetrieveAttachmentUrlParams.java b/src/main/java/me/didit/types/CasesNotesRetrieveAttachmentUrlParams.java new file mode 100644 index 0000000..a5992cf --- /dev/null +++ b/src/main/java/me/didit/types/CasesNotesRetrieveAttachmentUrlParams.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.notes.retrieve_attachment_url}. */ +public final class CasesNotesRetrieveAttachmentUrlParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("s3_key"); + + private CasesNotesRetrieveAttachmentUrlParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesNotesRetrieveAttachmentUrlParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesNotesRetrieveAttachmentUrlParams fromJson(JsonNode json) { + return new CasesNotesRetrieveAttachmentUrlParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The attachment's s3_key, as returned by upload or listed on the note. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String s3Key() { + return Json.required(json, "s3_key", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesNotesRetrieveAttachmentUrlParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesNotesRetrieveAttachmentUrlParams from) { + super(from); + } + + /** + * The attachment's s3_key, as returned by upload or listed on the note. + * + * @param s3Key the value + * @return this builder + */ + public Builder s3Key(String s3Key) { + return set("s3_key", Conv.STRING, s3Key); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesNotesRetrieveAttachmentUrlParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesNotesRetrieveAttachmentUrlParams build() { + require("s3_key", false); + return new CasesNotesRetrieveAttachmentUrlParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesNotesRetrieveAttachmentUrlResponse.java b/src/main/java/me/didit/types/CasesNotesRetrieveAttachmentUrlResponse.java new file mode 100644 index 0000000..b4cb801 --- /dev/null +++ b/src/main/java/me/didit/types/CasesNotesRetrieveAttachmentUrlResponse.java @@ -0,0 +1,138 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesNotesRetrieveAttachmentUrlResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("s3_key", "url", "filename"); + + private CasesNotesRetrieveAttachmentUrlResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesNotesRetrieveAttachmentUrlResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesNotesRetrieveAttachmentUrlResponse fromJson(JsonNode json) { + return new CasesNotesRetrieveAttachmentUrlResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The s3_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional s3Key() { + return Json.optional(json, "s3_key", Conv.STRING); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The filename field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filename() { + return Json.optional(json, "filename", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesNotesRetrieveAttachmentUrlResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesNotesRetrieveAttachmentUrlResponse from) { + super(from); + } + + /** + * The s3_key field. + * + * @param s3Key the value + * @return this builder + */ + public Builder s3Key(String s3Key) { + return set("s3_key", Conv.STRING, s3Key); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The filename field. + * + * @param filename the value + * @return this builder + */ + public Builder filename(String filename) { + return set("filename", Conv.STRING, filename); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesNotesRetrieveAttachmentUrlResponse} + */ + public CasesNotesRetrieveAttachmentUrlResponse build() { + return new CasesNotesRetrieveAttachmentUrlResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesPrintResponse.java b/src/main/java/me/didit/types/CasesPrintResponse.java new file mode 100644 index 0000000..49b8ae3 --- /dev/null +++ b/src/main/java/me/didit/types/CasesPrintResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesPrintResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("url"); + + private CasesPrintResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesPrintResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesPrintResponse fromJson(JsonNode json) { + return new CasesPrintResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesPrintResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesPrintResponse from) { + super(from); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesPrintResponse} + */ + public CasesPrintResponse build() { + return new CasesPrintResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesRegulatoryReportsCreateParams.java b/src/main/java/me/didit/types/CasesRegulatoryReportsCreateParams.java new file mode 100644 index 0000000..a33842a --- /dev/null +++ b/src/main/java/me/didit/types/CasesRegulatoryReportsCreateParams.java @@ -0,0 +1,750 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.regulatory_reports.create}. */ +public final class CasesRegulatoryReportsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("report_type", "jurisdiction", "template", "transactions", "rentity_id", "rentity_branch", "submission_code", "entity_reference", "fiu_ref_number", "currency_code_local", "submission_date", "reporting_person", "location", "reason", "action", "activity", "narrative", "report_indicators", "included_fields"); + + private CasesRegulatoryReportsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRegulatoryReportsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRegulatoryReportsCreateParams fromJson(JsonNode json) { + return new CasesRegulatoryReportsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Required unless a template is given; the template's report_type is used otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportType() { + return Json.optional(json, "report_type", Conv.enumeration(CasesRegulatoryReportsCreateParams.ReportType::of)); + } + + /** + * Required unless a template is given. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * Report template UUID; its field_config seeds the draft before case-derived data is merged in. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional template() { + return Json.optional(json, "template", Conv.STRING); + } + + /** + * Transactions to attach; defaults to the case's linked transactions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> transactions() { + return Json.optional(json, "transactions", Conv.list(Conv.STRING)); + } + + /** + * The rentity_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityId() { + return Json.optional(json, "rentity_id", Conv.STRING); + } + + /** + * The rentity_branch field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityBranch() { + return Json.optional(json, "rentity_branch", Conv.STRING); + } + + /** + * The submission_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionCode() { + return Json.optional(json, "submission_code", Conv.enumeration(CasesRegulatoryReportsCreateParams.SubmissionCode::of)); + } + + /** + * The entity_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityReference() { + return Json.optional(json, "entity_reference", Conv.STRING); + } + + /** + * The fiu_ref_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fiuRefNumber() { + return Json.optional(json, "fiu_ref_number", Conv.STRING); + } + + /** + * The currency_code_local field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currencyCodeLocal() { + return Json.optional(json, "currency_code_local", Conv.STRING); + } + + /** + * The submission_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionDate() { + return Json.optional(json, "submission_date", Conv.DATE_TIME); + } + + /** + * The reporting_person field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportingPerson() { + return Json.optional(json, "reporting_person", Conv.OBJECT); + } + + /** + * The location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> location() { + return Json.optional(json, "location", Conv.OBJECT); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The action field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.STRING); + } + + /** + * The activity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activity() { + return Json.optional(json, "activity", Conv.STRING); + } + + /** + * The narrative field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional narrative() { + return Json.optional(json, "narrative", Conv.model(CasesRegulatoryReportsCreateParams.Narrative::fromJson)); + } + + /** + * The report_indicators field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportIndicators() { + return Json.optional(json, "report_indicators", Conv.list(Conv.STRING)); + } + + /** + * The included_fields field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> includedFields() { + return Json.optional(json, "included_fields", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRegulatoryReportsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRegulatoryReportsCreateParams from) { + super(from); + } + + /** + * Required unless a template is given; the template's report_type is used otherwise. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(CasesRegulatoryReportsCreateParams.ReportType reportType) { + return set("report_type", Conv.enumeration(CasesRegulatoryReportsCreateParams.ReportType::of), reportType); + } + + /** + * Required unless a template is given. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * Report template UUID; its field_config seeds the draft before case-derived data is merged in. + * + * @param template the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder template(@Nullable String template) { + return setNullable("template", Conv.STRING, template); + } + + /** + * Transactions to attach; defaults to the case's linked transactions. + * + * @param transactions the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder transactions(@Nullable List transactions) { + return setNullable("transactions", Conv.list(Conv.STRING), transactions); + } + + /** + * The rentity_id field. + * + * @param rentityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityId(@Nullable String rentityId) { + return setNullable("rentity_id", Conv.STRING, rentityId); + } + + /** + * The rentity_branch field. + * + * @param rentityBranch the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityBranch(@Nullable String rentityBranch) { + return setNullable("rentity_branch", Conv.STRING, rentityBranch); + } + + /** + * The submission_code field. + * + * @param submissionCode the value + * @return this builder + */ + public Builder submissionCode(CasesRegulatoryReportsCreateParams.SubmissionCode submissionCode) { + return set("submission_code", Conv.enumeration(CasesRegulatoryReportsCreateParams.SubmissionCode::of), submissionCode); + } + + /** + * The entity_reference field. + * + * @param entityReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityReference(@Nullable String entityReference) { + return setNullable("entity_reference", Conv.STRING, entityReference); + } + + /** + * The fiu_ref_number field. + * + * @param fiuRefNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fiuRefNumber(@Nullable String fiuRefNumber) { + return setNullable("fiu_ref_number", Conv.STRING, fiuRefNumber); + } + + /** + * The currency_code_local field. + * + * @param currencyCodeLocal the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currencyCodeLocal(@Nullable String currencyCodeLocal) { + return setNullable("currency_code_local", Conv.STRING, currencyCodeLocal); + } + + /** + * The submission_date field. + * + * @param submissionDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder submissionDate(@Nullable OffsetDateTime submissionDate) { + return setNullable("submission_date", Conv.DATE_TIME, submissionDate); + } + + /** + * The reporting_person field. + * + * @param reportingPerson the value + * @return this builder + */ + public Builder reportingPerson(Map reportingPerson) { + return setAny("reporting_person", reportingPerson); + } + + /** + * The location field. + * + * @param location the value + * @return this builder + */ + public Builder location(Map location) { + return setAny("location", location); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The action field. + * + * @param action the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder action(@Nullable String action) { + return setNullable("action", Conv.STRING, action); + } + + /** + * The activity field. + * + * @param activity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder activity(@Nullable String activity) { + return setNullable("activity", Conv.STRING, activity); + } + + /** + * The narrative field. + * + * @param narrative the value + * @return this builder + */ + public Builder narrative(CasesRegulatoryReportsCreateParams.Narrative narrative) { + return set("narrative", Conv.model(CasesRegulatoryReportsCreateParams.Narrative::fromJson), narrative); + } + + /** + * The report_indicators field. + * + * @param reportIndicators the value + * @return this builder + */ + public Builder reportIndicators(List reportIndicators) { + return set("report_indicators", Conv.list(Conv.STRING), reportIndicators); + } + + /** + * The included_fields field. + * + * @param includedFields the value + * @return this builder + */ + public Builder includedFields(List includedFields) { + return set("included_fields", Conv.list(Conv.STRING), includedFields); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRegulatoryReportsCreateParams} + */ + public CasesRegulatoryReportsCreateParams build() { + return new CasesRegulatoryReportsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Required unless a template is given; the template's report_type is used otherwise. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SubmissionCode extends StringEnum { + /** The value {@code "E"}. */ + public static final SubmissionCode E = new SubmissionCode("E"); + + /** The value {@code "M"}. */ + public static final SubmissionCode M = new SubmissionCode("M"); + + private static final List KNOWN_VALUES = List.of(E, M); + + private SubmissionCode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SubmissionCode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SubmissionCode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Narrative extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("who", "what", "when", "where", "why", "how"); + + private Narrative(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Narrative} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Narrative fromJson(JsonNode json) { + return new Narrative(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The who field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional who() { + return Json.optional(json, "who", Conv.STRING); + } + + /** + * The what field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional what() { + return Json.optional(json, "what", Conv.STRING); + } + + /** + * The when field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional when_() { + return Json.optional(json, "when", Conv.STRING); + } + + /** + * The where field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional where() { + return Json.optional(json, "where", Conv.STRING); + } + + /** + * The why field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional why() { + return Json.optional(json, "why", Conv.STRING); + } + + /** + * The how field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional how() { + return Json.optional(json, "how", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Narrative}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Narrative from) { + super(from); + } + + /** + * The who field. + * + * @param who the value + * @return this builder + */ + public Builder who(String who) { + return set("who", Conv.STRING, who); + } + + /** + * The what field. + * + * @param what the value + * @return this builder + */ + public Builder what(String what) { + return set("what", Conv.STRING, what); + } + + /** + * The when field. + * + * @param when_ the value + * @return this builder + */ + public Builder when_(String when_) { + return set("when", Conv.STRING, when_); + } + + /** + * The where field. + * + * @param where the value + * @return this builder + */ + public Builder where(String where) { + return set("where", Conv.STRING, where); + } + + /** + * The why field. + * + * @param why the value + * @return this builder + */ + public Builder why(String why) { + return set("why", Conv.STRING, why); + } + + /** + * The how field. + * + * @param how the value + * @return this builder + */ + public Builder how(String how) { + return set("how", Conv.STRING, how); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Narrative} + */ + public Narrative build() { + return new Narrative(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesRegulatoryReportsListParams.java b/src/main/java/me/didit/types/CasesRegulatoryReportsListParams.java new file mode 100644 index 0000000..7bc861a --- /dev/null +++ b/src/main/java/me/didit/types/CasesRegulatoryReportsListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.regulatory_reports.list}. */ +public final class CasesRegulatoryReportsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private CasesRegulatoryReportsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRegulatoryReportsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRegulatoryReportsListParams fromJson(JsonNode json) { + return new CasesRegulatoryReportsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRegulatoryReportsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRegulatoryReportsListParams from) { + super(from); + } + + /** + * Page size. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRegulatoryReportsListParams} + */ + public CasesRegulatoryReportsListParams build() { + return new CasesRegulatoryReportsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesRegulatoryReportsListResponse.java b/src/main/java/me/didit/types/CasesRegulatoryReportsListResponse.java new file mode 100644 index 0000000..a773093 --- /dev/null +++ b/src/main/java/me/didit/types/CasesRegulatoryReportsListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasesRegulatoryReportsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CasesRegulatoryReportsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRegulatoryReportsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRegulatoryReportsListResponse fromJson(JsonNode json) { + return new CasesRegulatoryReportsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(RegulatoryReportDetail::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRegulatoryReportsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRegulatoryReportsListResponse from) { + super(from); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(RegulatoryReportDetail::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRegulatoryReportsListResponse} + */ + public CasesRegulatoryReportsListResponse build() { + return new CasesRegulatoryReportsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesRejectResolutionParams.java b/src/main/java/me/didit/types/CasesRejectResolutionParams.java new file mode 100644 index 0000000..e580098 --- /dev/null +++ b/src/main/java/me/didit/types/CasesRejectResolutionParams.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.reject_resolution}. */ +public final class CasesRejectResolutionParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("notes"); + + private CasesRejectResolutionParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRejectResolutionParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRejectResolutionParams fromJson(JsonNode json) { + return new CasesRejectResolutionParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The notes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional notes() { + return Json.optional(json, "notes", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRejectResolutionParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRejectResolutionParams from) { + super(from); + } + + /** + * The notes field. + * + * @param notes the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder notes(@Nullable String notes) { + return setNullable("notes", Conv.STRING, notes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRejectResolutionParams} + */ + public CasesRejectResolutionParams build() { + return new CasesRejectResolutionParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesRequestsListParams.java b/src/main/java/me/didit/types/CasesRequestsListParams.java new file mode 100644 index 0000000..5acbf90 --- /dev/null +++ b/src/main/java/me/didit/types/CasesRequestsListParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.requests.list}. */ +public final class CasesRequestsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ordering", "limit", "offset"); + + private CasesRequestsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRequestsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRequestsListParams fromJson(JsonNode json) { + return new CasesRequestsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Which field to use when ordering the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + /** + * Number of results to return per page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The initial index from which to return the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRequestsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRequestsListParams from) { + super(from); + } + + /** + * Which field to use when ordering the results. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Number of results to return per page. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The initial index from which to return the results. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRequestsListParams} + */ + public CasesRequestsListParams build() { + return new CasesRequestsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesResolveParams.java b/src/main/java/me/didit/types/CasesResolveParams.java new file mode 100644 index 0000000..44300bd --- /dev/null +++ b/src/main/java/me/didit/types/CasesResolveParams.java @@ -0,0 +1,165 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.resolve}. */ +public final class CasesResolveParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("resolution", "note"); + + private CasesResolveParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesResolveParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesResolveParams fromJson(JsonNode json) { + return new CasesResolveParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The resolution field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CasesResolveParams.Resolution resolution() { + return Json.required(json, "resolution", Conv.enumeration(CasesResolveParams.Resolution::of)); + } + + /** + * Required when the blueprint sets require_resolution_note. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional note() { + return Json.optional(json, "note", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesResolveParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesResolveParams from) { + super(from); + } + + /** + * The resolution field. + * + * @param resolution the value + * @return this builder + */ + public Builder resolution(CasesResolveParams.Resolution resolution) { + return set("resolution", Conv.enumeration(CasesResolveParams.Resolution::of), resolution); + } + + /** + * Required when the blueprint sets require_resolution_note. + * + * @param note the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder note(@Nullable String note) { + return setNullable("note", Conv.STRING, note); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesResolveParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesResolveParams build() { + require("resolution", false); + return new CasesResolveParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Resolution extends StringEnum { + /** The value {@code "FALSE_POSITIVE"}. */ + public static final Resolution FALSE_POSITIVE = new Resolution("FALSE_POSITIVE"); + + /** The value {@code "VALID_THREAT"}. */ + public static final Resolution VALID_THREAT = new Resolution("VALID_THREAT"); + + private static final List KNOWN_VALUES = List.of(FALSE_POSITIVE, VALID_THREAT); + + private Resolution(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Resolution of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Resolution::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesRetrieveStatisticsParams.java b/src/main/java/me/didit/types/CasesRetrieveStatisticsParams.java new file mode 100644 index 0000000..31e1b98 --- /dev/null +++ b/src/main/java/me/didit/types/CasesRetrieveStatisticsParams.java @@ -0,0 +1,359 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code cases.retrieve_statistics}. */ +public final class CasesRetrieveStatisticsParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("date_from", "date_to", "blueprint", "assigned_to", "priority", "source", "status"); + + private CasesRetrieveStatisticsParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRetrieveStatisticsParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRetrieveStatisticsParams fromJson(JsonNode json) { + return new CasesRetrieveStatisticsParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Range start (inclusive). Defaults to 30 days ago. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateFrom() { + return Json.optional(json, "date_from", Conv.DATE); + } + + /** + * Range end (inclusive). Defaults to today. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateTo() { + return Json.optional(json, "date_to", Conv.DATE); + } + + /** + * Filter by the current blueprint UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.STRING); + } + + /** + * Filter by the current assigned reviewer user UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedTo() { + return Json.optional(json, "assigned_to", Conv.STRING); + } + + /** + * Filter by current case priority. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CasesRetrieveStatisticsParams.Priority::of)); + } + + /** + * Filter by case creation source. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(CasesRetrieveStatisticsParams.Source::of)); + } + + /** + * Filter by current case status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(CasesRetrieveStatisticsParams.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRetrieveStatisticsParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRetrieveStatisticsParams from) { + super(from); + } + + /** + * Range start (inclusive). Defaults to 30 days ago. + * + * @param dateFrom the value + * @return this builder + */ + public Builder dateFrom(LocalDate dateFrom) { + return set("date_from", Conv.DATE, dateFrom); + } + + /** + * Range end (inclusive). Defaults to today. + * + * @param dateTo the value + * @return this builder + */ + public Builder dateTo(LocalDate dateTo) { + return set("date_to", Conv.DATE, dateTo); + } + + /** + * Filter by the current blueprint UUID. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * Filter by the current assigned reviewer user UUID. + * + * @param assignedTo the value + * @return this builder + */ + public Builder assignedTo(String assignedTo) { + return set("assigned_to", Conv.STRING, assignedTo); + } + + /** + * Filter by current case priority. + * + * @param priority the value + * @return this builder + */ + public Builder priority(CasesRetrieveStatisticsParams.Priority priority) { + return set("priority", Conv.enumeration(CasesRetrieveStatisticsParams.Priority::of), priority); + } + + /** + * Filter by case creation source. + * + * @param source the value + * @return this builder + */ + public Builder source(CasesRetrieveStatisticsParams.Source source) { + return set("source", Conv.enumeration(CasesRetrieveStatisticsParams.Source::of), source); + } + + /** + * Filter by current case status. + * + * @param status the value + * @return this builder + */ + public Builder status(CasesRetrieveStatisticsParams.Status status) { + return set("status", Conv.enumeration(CasesRetrieveStatisticsParams.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRetrieveStatisticsParams} + */ + public CasesRetrieveStatisticsParams build() { + return new CasesRetrieveStatisticsParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Priority extends StringEnum { + /** The value {@code "LOW"}. */ + public static final Priority LOW = new Priority("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Priority MEDIUM = new Priority("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Priority HIGH = new Priority("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Priority(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Priority of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Priority::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "MANUAL"}. */ + public static final Source MANUAL = new Source("MANUAL"); + + /** The value {@code "AML_SCREENING"}. */ + public static final Source AML_SCREENING = new Source("AML_SCREENING"); + + /** The value {@code "TRANSACTION_RULE"}. */ + public static final Source TRANSACTION_RULE = new Source("TRANSACTION_RULE"); + + /** The value {@code "WORKFLOW_BUILDER"}. */ + public static final Source WORKFLOW_BUILDER = new Source("WORKFLOW_BUILDER"); + + private static final List KNOWN_VALUES = List.of(MANUAL, AML_SCREENING, TRANSACTION_RULE, WORKFLOW_BUILDER); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final Status OPEN = new Status("OPEN"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + /** The value {@code "RESOLVED"}. */ + public static final Status RESOLVED = new Status("RESOLVED"); + + private static final List KNOWN_VALUES = List.of(OPEN, AWAITING_USER, RESOLVED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CasesRetrieveStatisticsResponse.java b/src/main/java/me/didit/types/CasesRetrieveStatisticsResponse.java new file mode 100644 index 0000000..892876d --- /dev/null +++ b/src/main/java/me/didit/types/CasesRetrieveStatisticsResponse.java @@ -0,0 +1,2040 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CasesRetrieveStatisticsResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("series", "tables", "totals", "queue"); + + private CasesRetrieveStatisticsResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRetrieveStatisticsResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRetrieveStatisticsResponse fromJson(JsonNode json) { + return new CasesRetrieveStatisticsResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The series field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> series() { + return Json.optional(json, "series", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Series::fromJson))); + } + + /** + * The tables field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tables() { + return Json.optional(json, "tables", Conv.model(CasesRetrieveStatisticsResponse.Tables::fromJson)); + } + + /** + * The totals field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totals() { + return Json.optional(json, "totals", Conv.model(CasesRetrieveStatisticsResponse.Totals::fromJson)); + } + + /** + * Live snapshot, not scoped to the date range. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional queue() { + return Json.optional(json, "queue", Conv.model(CasesRetrieveStatisticsResponse.Queue::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRetrieveStatisticsResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRetrieveStatisticsResponse from) { + super(from); + } + + /** + * The series field. + * + * @param series the value + * @return this builder + */ + public Builder series(List series) { + return set("series", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Series::fromJson)), series); + } + + /** + * The tables field. + * + * @param tables the value + * @return this builder + */ + public Builder tables(CasesRetrieveStatisticsResponse.Tables tables) { + return set("tables", Conv.model(CasesRetrieveStatisticsResponse.Tables::fromJson), tables); + } + + /** + * The totals field. + * + * @param totals the value + * @return this builder + */ + public Builder totals(CasesRetrieveStatisticsResponse.Totals totals) { + return set("totals", Conv.model(CasesRetrieveStatisticsResponse.Totals::fromJson), totals); + } + + /** + * Live snapshot, not scoped to the date range. + * + * @param queue the value + * @return this builder + */ + public Builder queue(CasesRetrieveStatisticsResponse.Queue queue) { + return set("queue", Conv.model(CasesRetrieveStatisticsResponse.Queue::fromJson), queue); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRetrieveStatisticsResponse} + */ + public CasesRetrieveStatisticsResponse build() { + return new CasesRetrieveStatisticsResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Series extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("date", "created", "reviewed"); + + private Series(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Series} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Series fromJson(JsonNode json) { + return new Series(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional date() { + return Json.optional(json, "date", Conv.DATE); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.LONG); + } + + /** + * The reviewed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewed() { + return Json.optional(json, "reviewed", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Series}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Series from) { + super(from); + } + + /** + * The date field. + * + * @param date the value + * @return this builder + */ + public Builder date(LocalDate date) { + return set("date", Conv.DATE, date); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(long created) { + return set("created", Conv.LONG, created); + } + + /** + * The reviewed field. + * + * @param reviewed the value + * @return this builder + */ + public Builder reviewed(long reviewed) { + return set("reviewed", Conv.LONG, reviewed); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Series} + */ + public Series build() { + return new Series(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Tables extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("officer", "blueprint", "source", "status"); + + private Tables(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tables} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tables fromJson(JsonNode json) { + return new Tables(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The officer field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> officer() { + return Json.optional(json, "officer", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Officer::fromJson))); + } + + /** + * The blueprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> blueprint() { + return Json.optional(json, "blueprint", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Blueprint::fromJson))); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> source() { + return Json.optional(json, "source", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Source::fromJson))); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> status() { + return Json.optional(json, "status", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Status::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tables}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tables from) { + super(from); + } + + /** + * The officer field. + * + * @param officer the value + * @return this builder + */ + public Builder officer(List officer) { + return set("officer", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Officer::fromJson)), officer); + } + + /** + * The blueprint field. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(List blueprint) { + return set("blueprint", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Blueprint::fromJson)), blueprint); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(List source) { + return set("source", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Source::fromJson)), source); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(List status) { + return set("status", Conv.list(Conv.model(CasesRetrieveStatisticsResponse.Tables.Status::fromJson)), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tables} + */ + public Tables build() { + return new Tables(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Officer extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("key", "created", "assigned", "resolved", "threat_rate", "false_positive_rate", "unresolved", "reassignment_rate", "escalation_rate", "avg_assign_hours", "avg_resolve_hours", "avg_handling_hours"); + + private Officer(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Officer} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Officer fromJson(JsonNode json) { + return new Officer(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional key() { + return Json.optional(json, "key", Conv.STRING); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.LONG); + } + + /** + * The assigned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigned() { + return Json.optional(json, "assigned", Conv.LONG); + } + + /** + * The resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolved() { + return Json.optional(json, "resolved", Conv.LONG); + } + + /** + * The threat_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional threatRate() { + return Json.optional(json, "threat_rate", Conv.DOUBLE); + } + + /** + * The false_positive_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional falsePositiveRate() { + return Json.optional(json, "false_positive_rate", Conv.DOUBLE); + } + + /** + * The unresolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unresolved() { + return Json.optional(json, "unresolved", Conv.LONG); + } + + /** + * The reassignment_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reassignmentRate() { + return Json.optional(json, "reassignment_rate", Conv.DOUBLE); + } + + /** + * The escalation_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationRate() { + return Json.optional(json, "escalation_rate", Conv.DOUBLE); + } + + /** + * The avg_assign_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgAssignHours() { + return Json.optional(json, "avg_assign_hours", Conv.DOUBLE); + } + + /** + * The avg_resolve_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResolveHours() { + return Json.optional(json, "avg_resolve_hours", Conv.DOUBLE); + } + + /** + * The avg_handling_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgHandlingHours() { + return Json.optional(json, "avg_handling_hours", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Officer}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Officer from) { + super(from); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @param key the value + * @return this builder + */ + public Builder key(String key) { + return set("key", Conv.STRING, key); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(long created) { + return set("created", Conv.LONG, created); + } + + /** + * The assigned field. + * + * @param assigned the value + * @return this builder + */ + public Builder assigned(long assigned) { + return set("assigned", Conv.LONG, assigned); + } + + /** + * The resolved field. + * + * @param resolved the value + * @return this builder + */ + public Builder resolved(long resolved) { + return set("resolved", Conv.LONG, resolved); + } + + /** + * The threat_rate field. + * + * @param threatRate the value + * @return this builder + */ + public Builder threatRate(double threatRate) { + return set("threat_rate", Conv.DOUBLE, threatRate); + } + + /** + * The false_positive_rate field. + * + * @param falsePositiveRate the value + * @return this builder + */ + public Builder falsePositiveRate(double falsePositiveRate) { + return set("false_positive_rate", Conv.DOUBLE, falsePositiveRate); + } + + /** + * The unresolved field. + * + * @param unresolved the value + * @return this builder + */ + public Builder unresolved(long unresolved) { + return set("unresolved", Conv.LONG, unresolved); + } + + /** + * The reassignment_rate field. + * + * @param reassignmentRate the value + * @return this builder + */ + public Builder reassignmentRate(double reassignmentRate) { + return set("reassignment_rate", Conv.DOUBLE, reassignmentRate); + } + + /** + * The escalation_rate field. + * + * @param escalationRate the value + * @return this builder + */ + public Builder escalationRate(double escalationRate) { + return set("escalation_rate", Conv.DOUBLE, escalationRate); + } + + /** + * The avg_assign_hours field. + * + * @param avgAssignHours the value + * @return this builder + */ + public Builder avgAssignHours(double avgAssignHours) { + return set("avg_assign_hours", Conv.DOUBLE, avgAssignHours); + } + + /** + * The avg_resolve_hours field. + * + * @param avgResolveHours the value + * @return this builder + */ + public Builder avgResolveHours(double avgResolveHours) { + return set("avg_resolve_hours", Conv.DOUBLE, avgResolveHours); + } + + /** + * The avg_handling_hours field. + * + * @param avgHandlingHours the value + * @return this builder + */ + public Builder avgHandlingHours(double avgHandlingHours) { + return set("avg_handling_hours", Conv.DOUBLE, avgHandlingHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Officer} + */ + public Officer build() { + return new Officer(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Blueprint extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("key", "created", "assigned", "resolved", "threat_rate", "false_positive_rate", "unresolved", "reassignment_rate", "escalation_rate", "avg_assign_hours", "avg_resolve_hours", "avg_handling_hours"); + + private Blueprint(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Blueprint} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Blueprint fromJson(JsonNode json) { + return new Blueprint(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional key() { + return Json.optional(json, "key", Conv.STRING); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.LONG); + } + + /** + * The assigned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigned() { + return Json.optional(json, "assigned", Conv.LONG); + } + + /** + * The resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolved() { + return Json.optional(json, "resolved", Conv.LONG); + } + + /** + * The threat_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional threatRate() { + return Json.optional(json, "threat_rate", Conv.DOUBLE); + } + + /** + * The false_positive_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional falsePositiveRate() { + return Json.optional(json, "false_positive_rate", Conv.DOUBLE); + } + + /** + * The unresolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unresolved() { + return Json.optional(json, "unresolved", Conv.LONG); + } + + /** + * The reassignment_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reassignmentRate() { + return Json.optional(json, "reassignment_rate", Conv.DOUBLE); + } + + /** + * The escalation_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationRate() { + return Json.optional(json, "escalation_rate", Conv.DOUBLE); + } + + /** + * The avg_assign_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgAssignHours() { + return Json.optional(json, "avg_assign_hours", Conv.DOUBLE); + } + + /** + * The avg_resolve_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResolveHours() { + return Json.optional(json, "avg_resolve_hours", Conv.DOUBLE); + } + + /** + * The avg_handling_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgHandlingHours() { + return Json.optional(json, "avg_handling_hours", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Blueprint}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Blueprint from) { + super(from); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @param key the value + * @return this builder + */ + public Builder key(String key) { + return set("key", Conv.STRING, key); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(long created) { + return set("created", Conv.LONG, created); + } + + /** + * The assigned field. + * + * @param assigned the value + * @return this builder + */ + public Builder assigned(long assigned) { + return set("assigned", Conv.LONG, assigned); + } + + /** + * The resolved field. + * + * @param resolved the value + * @return this builder + */ + public Builder resolved(long resolved) { + return set("resolved", Conv.LONG, resolved); + } + + /** + * The threat_rate field. + * + * @param threatRate the value + * @return this builder + */ + public Builder threatRate(double threatRate) { + return set("threat_rate", Conv.DOUBLE, threatRate); + } + + /** + * The false_positive_rate field. + * + * @param falsePositiveRate the value + * @return this builder + */ + public Builder falsePositiveRate(double falsePositiveRate) { + return set("false_positive_rate", Conv.DOUBLE, falsePositiveRate); + } + + /** + * The unresolved field. + * + * @param unresolved the value + * @return this builder + */ + public Builder unresolved(long unresolved) { + return set("unresolved", Conv.LONG, unresolved); + } + + /** + * The reassignment_rate field. + * + * @param reassignmentRate the value + * @return this builder + */ + public Builder reassignmentRate(double reassignmentRate) { + return set("reassignment_rate", Conv.DOUBLE, reassignmentRate); + } + + /** + * The escalation_rate field. + * + * @param escalationRate the value + * @return this builder + */ + public Builder escalationRate(double escalationRate) { + return set("escalation_rate", Conv.DOUBLE, escalationRate); + } + + /** + * The avg_assign_hours field. + * + * @param avgAssignHours the value + * @return this builder + */ + public Builder avgAssignHours(double avgAssignHours) { + return set("avg_assign_hours", Conv.DOUBLE, avgAssignHours); + } + + /** + * The avg_resolve_hours field. + * + * @param avgResolveHours the value + * @return this builder + */ + public Builder avgResolveHours(double avgResolveHours) { + return set("avg_resolve_hours", Conv.DOUBLE, avgResolveHours); + } + + /** + * The avg_handling_hours field. + * + * @param avgHandlingHours the value + * @return this builder + */ + public Builder avgHandlingHours(double avgHandlingHours) { + return set("avg_handling_hours", Conv.DOUBLE, avgHandlingHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Blueprint} + */ + public Blueprint build() { + return new Blueprint(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Source extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("key", "created", "assigned", "resolved", "threat_rate", "false_positive_rate", "unresolved", "reassignment_rate", "escalation_rate", "avg_assign_hours", "avg_resolve_hours", "avg_handling_hours"); + + private Source(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Source} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Source fromJson(JsonNode json) { + return new Source(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional key() { + return Json.optional(json, "key", Conv.STRING); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.LONG); + } + + /** + * The assigned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigned() { + return Json.optional(json, "assigned", Conv.LONG); + } + + /** + * The resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolved() { + return Json.optional(json, "resolved", Conv.LONG); + } + + /** + * The threat_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional threatRate() { + return Json.optional(json, "threat_rate", Conv.DOUBLE); + } + + /** + * The false_positive_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional falsePositiveRate() { + return Json.optional(json, "false_positive_rate", Conv.DOUBLE); + } + + /** + * The unresolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unresolved() { + return Json.optional(json, "unresolved", Conv.LONG); + } + + /** + * The reassignment_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reassignmentRate() { + return Json.optional(json, "reassignment_rate", Conv.DOUBLE); + } + + /** + * The escalation_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationRate() { + return Json.optional(json, "escalation_rate", Conv.DOUBLE); + } + + /** + * The avg_assign_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgAssignHours() { + return Json.optional(json, "avg_assign_hours", Conv.DOUBLE); + } + + /** + * The avg_resolve_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResolveHours() { + return Json.optional(json, "avg_resolve_hours", Conv.DOUBLE); + } + + /** + * The avg_handling_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgHandlingHours() { + return Json.optional(json, "avg_handling_hours", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Source}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Source from) { + super(from); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @param key the value + * @return this builder + */ + public Builder key(String key) { + return set("key", Conv.STRING, key); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(long created) { + return set("created", Conv.LONG, created); + } + + /** + * The assigned field. + * + * @param assigned the value + * @return this builder + */ + public Builder assigned(long assigned) { + return set("assigned", Conv.LONG, assigned); + } + + /** + * The resolved field. + * + * @param resolved the value + * @return this builder + */ + public Builder resolved(long resolved) { + return set("resolved", Conv.LONG, resolved); + } + + /** + * The threat_rate field. + * + * @param threatRate the value + * @return this builder + */ + public Builder threatRate(double threatRate) { + return set("threat_rate", Conv.DOUBLE, threatRate); + } + + /** + * The false_positive_rate field. + * + * @param falsePositiveRate the value + * @return this builder + */ + public Builder falsePositiveRate(double falsePositiveRate) { + return set("false_positive_rate", Conv.DOUBLE, falsePositiveRate); + } + + /** + * The unresolved field. + * + * @param unresolved the value + * @return this builder + */ + public Builder unresolved(long unresolved) { + return set("unresolved", Conv.LONG, unresolved); + } + + /** + * The reassignment_rate field. + * + * @param reassignmentRate the value + * @return this builder + */ + public Builder reassignmentRate(double reassignmentRate) { + return set("reassignment_rate", Conv.DOUBLE, reassignmentRate); + } + + /** + * The escalation_rate field. + * + * @param escalationRate the value + * @return this builder + */ + public Builder escalationRate(double escalationRate) { + return set("escalation_rate", Conv.DOUBLE, escalationRate); + } + + /** + * The avg_assign_hours field. + * + * @param avgAssignHours the value + * @return this builder + */ + public Builder avgAssignHours(double avgAssignHours) { + return set("avg_assign_hours", Conv.DOUBLE, avgAssignHours); + } + + /** + * The avg_resolve_hours field. + * + * @param avgResolveHours the value + * @return this builder + */ + public Builder avgResolveHours(double avgResolveHours) { + return set("avg_resolve_hours", Conv.DOUBLE, avgResolveHours); + } + + /** + * The avg_handling_hours field. + * + * @param avgHandlingHours the value + * @return this builder + */ + public Builder avgHandlingHours(double avgHandlingHours) { + return set("avg_handling_hours", Conv.DOUBLE, avgHandlingHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Source} + */ + public Source build() { + return new Source(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Status extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("key", "created", "assigned", "resolved", "threat_rate", "false_positive_rate", "unresolved", "reassignment_rate", "escalation_rate", "avg_assign_hours", "avg_resolve_hours", "avg_handling_hours"); + + private Status(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Status} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Status fromJson(JsonNode json) { + return new Status(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional key() { + return Json.optional(json, "key", Conv.STRING); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.LONG); + } + + /** + * The assigned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigned() { + return Json.optional(json, "assigned", Conv.LONG); + } + + /** + * The resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolved() { + return Json.optional(json, "resolved", Conv.LONG); + } + + /** + * The threat_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional threatRate() { + return Json.optional(json, "threat_rate", Conv.DOUBLE); + } + + /** + * The false_positive_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional falsePositiveRate() { + return Json.optional(json, "false_positive_rate", Conv.DOUBLE); + } + + /** + * The unresolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unresolved() { + return Json.optional(json, "unresolved", Conv.LONG); + } + + /** + * The reassignment_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reassignmentRate() { + return Json.optional(json, "reassignment_rate", Conv.DOUBLE); + } + + /** + * The escalation_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationRate() { + return Json.optional(json, "escalation_rate", Conv.DOUBLE); + } + + /** + * The avg_assign_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgAssignHours() { + return Json.optional(json, "avg_assign_hours", Conv.DOUBLE); + } + + /** + * The avg_resolve_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResolveHours() { + return Json.optional(json, "avg_resolve_hours", Conv.DOUBLE); + } + + /** + * The avg_handling_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgHandlingHours() { + return Json.optional(json, "avg_handling_hours", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Status}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Status from) { + super(from); + } + + /** + * Dimension value: officer email, "blueprint_name:uuid", source, or status. "unassigned"/"none" for missing dimensions. + * + * @param key the value + * @return this builder + */ + public Builder key(String key) { + return set("key", Conv.STRING, key); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(long created) { + return set("created", Conv.LONG, created); + } + + /** + * The assigned field. + * + * @param assigned the value + * @return this builder + */ + public Builder assigned(long assigned) { + return set("assigned", Conv.LONG, assigned); + } + + /** + * The resolved field. + * + * @param resolved the value + * @return this builder + */ + public Builder resolved(long resolved) { + return set("resolved", Conv.LONG, resolved); + } + + /** + * The threat_rate field. + * + * @param threatRate the value + * @return this builder + */ + public Builder threatRate(double threatRate) { + return set("threat_rate", Conv.DOUBLE, threatRate); + } + + /** + * The false_positive_rate field. + * + * @param falsePositiveRate the value + * @return this builder + */ + public Builder falsePositiveRate(double falsePositiveRate) { + return set("false_positive_rate", Conv.DOUBLE, falsePositiveRate); + } + + /** + * The unresolved field. + * + * @param unresolved the value + * @return this builder + */ + public Builder unresolved(long unresolved) { + return set("unresolved", Conv.LONG, unresolved); + } + + /** + * The reassignment_rate field. + * + * @param reassignmentRate the value + * @return this builder + */ + public Builder reassignmentRate(double reassignmentRate) { + return set("reassignment_rate", Conv.DOUBLE, reassignmentRate); + } + + /** + * The escalation_rate field. + * + * @param escalationRate the value + * @return this builder + */ + public Builder escalationRate(double escalationRate) { + return set("escalation_rate", Conv.DOUBLE, escalationRate); + } + + /** + * The avg_assign_hours field. + * + * @param avgAssignHours the value + * @return this builder + */ + public Builder avgAssignHours(double avgAssignHours) { + return set("avg_assign_hours", Conv.DOUBLE, avgAssignHours); + } + + /** + * The avg_resolve_hours field. + * + * @param avgResolveHours the value + * @return this builder + */ + public Builder avgResolveHours(double avgResolveHours) { + return set("avg_resolve_hours", Conv.DOUBLE, avgResolveHours); + } + + /** + * The avg_handling_hours field. + * + * @param avgHandlingHours the value + * @return this builder + */ + public Builder avgHandlingHours(double avgHandlingHours) { + return set("avg_handling_hours", Conv.DOUBLE, avgHandlingHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Status} + */ + public Status build() { + return new Status(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Totals extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("created", "assigned", "resolved", "threat_rate", "false_positive_rate", "unresolved", "reassignment_rate", "escalation_rate", "avg_assign_hours", "avg_resolve_hours", "avg_handling_hours"); + + private Totals(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Totals} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Totals fromJson(JsonNode json) { + return new Totals(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The created field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.LONG); + } + + /** + * The assigned field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assigned() { + return Json.optional(json, "assigned", Conv.LONG); + } + + /** + * The resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolved() { + return Json.optional(json, "resolved", Conv.LONG); + } + + /** + * The threat_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional threatRate() { + return Json.optional(json, "threat_rate", Conv.DOUBLE); + } + + /** + * The false_positive_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional falsePositiveRate() { + return Json.optional(json, "false_positive_rate", Conv.DOUBLE); + } + + /** + * The unresolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unresolved() { + return Json.optional(json, "unresolved", Conv.LONG); + } + + /** + * The reassignment_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reassignmentRate() { + return Json.optional(json, "reassignment_rate", Conv.DOUBLE); + } + + /** + * The escalation_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional escalationRate() { + return Json.optional(json, "escalation_rate", Conv.DOUBLE); + } + + /** + * The avg_assign_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgAssignHours() { + return Json.optional(json, "avg_assign_hours", Conv.DOUBLE); + } + + /** + * The avg_resolve_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResolveHours() { + return Json.optional(json, "avg_resolve_hours", Conv.DOUBLE); + } + + /** + * The avg_handling_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgHandlingHours() { + return Json.optional(json, "avg_handling_hours", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Totals}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Totals from) { + super(from); + } + + /** + * The created field. + * + * @param created the value + * @return this builder + */ + public Builder created(long created) { + return set("created", Conv.LONG, created); + } + + /** + * The assigned field. + * + * @param assigned the value + * @return this builder + */ + public Builder assigned(long assigned) { + return set("assigned", Conv.LONG, assigned); + } + + /** + * The resolved field. + * + * @param resolved the value + * @return this builder + */ + public Builder resolved(long resolved) { + return set("resolved", Conv.LONG, resolved); + } + + /** + * The threat_rate field. + * + * @param threatRate the value + * @return this builder + */ + public Builder threatRate(double threatRate) { + return set("threat_rate", Conv.DOUBLE, threatRate); + } + + /** + * The false_positive_rate field. + * + * @param falsePositiveRate the value + * @return this builder + */ + public Builder falsePositiveRate(double falsePositiveRate) { + return set("false_positive_rate", Conv.DOUBLE, falsePositiveRate); + } + + /** + * The unresolved field. + * + * @param unresolved the value + * @return this builder + */ + public Builder unresolved(long unresolved) { + return set("unresolved", Conv.LONG, unresolved); + } + + /** + * The reassignment_rate field. + * + * @param reassignmentRate the value + * @return this builder + */ + public Builder reassignmentRate(double reassignmentRate) { + return set("reassignment_rate", Conv.DOUBLE, reassignmentRate); + } + + /** + * The escalation_rate field. + * + * @param escalationRate the value + * @return this builder + */ + public Builder escalationRate(double escalationRate) { + return set("escalation_rate", Conv.DOUBLE, escalationRate); + } + + /** + * The avg_assign_hours field. + * + * @param avgAssignHours the value + * @return this builder + */ + public Builder avgAssignHours(double avgAssignHours) { + return set("avg_assign_hours", Conv.DOUBLE, avgAssignHours); + } + + /** + * The avg_resolve_hours field. + * + * @param avgResolveHours the value + * @return this builder + */ + public Builder avgResolveHours(double avgResolveHours) { + return set("avg_resolve_hours", Conv.DOUBLE, avgResolveHours); + } + + /** + * The avg_handling_hours field. + * + * @param avgHandlingHours the value + * @return this builder + */ + public Builder avgHandlingHours(double avgHandlingHours) { + return set("avg_handling_hours", Conv.DOUBLE, avgHandlingHours); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Totals} + */ + public Totals build() { + return new Totals(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Live snapshot, not scoped to the date range. */ + public static final class Queue extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("open", "overdue"); + + private Queue(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Queue} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Queue fromJson(JsonNode json) { + return new Queue(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The open field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional open() { + return Json.optional(json, "open", Conv.LONG); + } + + /** + * The overdue field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overdue() { + return Json.optional(json, "overdue", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Queue}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Queue from) { + super(from); + } + + /** + * The open field. + * + * @param open the value + * @return this builder + */ + public Builder open(long open) { + return set("open", Conv.LONG, open); + } + + /** + * The overdue field. + * + * @param overdue the value + * @return this builder + */ + public Builder overdue(long overdue) { + return set("overdue", Conv.LONG, overdue); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Queue} + */ + public Queue build() { + return new Queue(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/CasesRoutingRulesListHistoryParams.java b/src/main/java/me/didit/types/CasesRoutingRulesListHistoryParams.java new file mode 100644 index 0000000..54842e8 --- /dev/null +++ b/src/main/java/me/didit/types/CasesRoutingRulesListHistoryParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.routing_rules.list_history}. */ +public final class CasesRoutingRulesListHistoryParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ordering", "limit", "offset"); + + private CasesRoutingRulesListHistoryParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRoutingRulesListHistoryParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRoutingRulesListHistoryParams fromJson(JsonNode json) { + return new CasesRoutingRulesListHistoryParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Which field to use when ordering the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + /** + * Number of results to return per page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The initial index from which to return the results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRoutingRulesListHistoryParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRoutingRulesListHistoryParams from) { + super(from); + } + + /** + * Which field to use when ordering the results. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Number of results to return per page. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The initial index from which to return the results. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRoutingRulesListHistoryParams} + */ + public CasesRoutingRulesListHistoryParams build() { + return new CasesRoutingRulesListHistoryParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesRoutingRulesListParams.java b/src/main/java/me/didit/types/CasesRoutingRulesListParams.java new file mode 100644 index 0000000..3935d62 --- /dev/null +++ b/src/main/java/me/didit/types/CasesRoutingRulesListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.routing_rules.list}. */ +public final class CasesRoutingRulesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private CasesRoutingRulesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRoutingRulesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRoutingRulesListParams fromJson(JsonNode json) { + return new CasesRoutingRulesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The limit field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRoutingRulesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRoutingRulesListParams from) { + super(from); + } + + /** + * The limit field. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRoutingRulesListParams} + */ + public CasesRoutingRulesListParams build() { + return new CasesRoutingRulesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesRoutingRulesListResponse.java b/src/main/java/me/didit/types/CasesRoutingRulesListResponse.java new file mode 100644 index 0000000..5e517ac --- /dev/null +++ b/src/main/java/me/didit/types/CasesRoutingRulesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasesRoutingRulesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results", "count", "next", "previous"); + + private CasesRoutingRulesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesRoutingRulesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesRoutingRulesListResponse fromJson(JsonNode json) { + return new CasesRoutingRulesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CaseRoutingRule::fromJson))); + } + + /** + * Matching count, capped at 100. Follow next to continue beyond the cap. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesRoutingRulesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesRoutingRulesListResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseRoutingRule::fromJson)), results); + } + + /** + * Matching count, capped at 100. Follow next to continue beyond the cap. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesRoutingRulesListResponse} + */ + public CasesRoutingRulesListResponse build() { + return new CasesRoutingRulesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesTeamsListParams.java b/src/main/java/me/didit/types/CasesTeamsListParams.java new file mode 100644 index 0000000..9ac0417 --- /dev/null +++ b/src/main/java/me/didit/types/CasesTeamsListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.teams.list}. */ +public final class CasesTeamsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private CasesTeamsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesTeamsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesTeamsListParams fromJson(JsonNode json) { + return new CasesTeamsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The limit field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesTeamsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesTeamsListParams from) { + super(from); + } + + /** + * The limit field. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesTeamsListParams} + */ + public CasesTeamsListParams build() { + return new CasesTeamsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesTeamsListResponse.java b/src/main/java/me/didit/types/CasesTeamsListResponse.java new file mode 100644 index 0000000..734a820 --- /dev/null +++ b/src/main/java/me/didit/types/CasesTeamsListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CasesTeamsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results", "count", "next", "previous"); + + private CasesTeamsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesTeamsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesTeamsListResponse fromJson(JsonNode json) { + return new CasesTeamsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(CaseReviewTeam::fromJson))); + } + + /** + * Matching count, capped at 100. Follow next to continue beyond the cap. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesTeamsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesTeamsListResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CaseReviewTeam::fromJson)), results); + } + + /** + * Matching count, capped at 100. Follow next to continue beyond the cap. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesTeamsListResponse} + */ + public CasesTeamsListResponse build() { + return new CasesTeamsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesTransferParams.java b/src/main/java/me/didit/types/CasesTransferParams.java new file mode 100644 index 0000000..9dc0152 --- /dev/null +++ b/src/main/java/me/didit/types/CasesTransferParams.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code cases.transfer}. */ +public final class CasesTransferParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("target_blueprint"); + + private CasesTransferParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesTransferParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesTransferParams fromJson(JsonNode json) { + return new CasesTransferParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The target_blueprint field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String targetBlueprint() { + return Json.required(json, "target_blueprint", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesTransferParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesTransferParams from) { + super(from); + } + + /** + * The target_blueprint field. + * + * @param targetBlueprint the value + * @return this builder + */ + public Builder targetBlueprint(String targetBlueprint) { + return set("target_blueprint", Conv.STRING, targetBlueprint); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesTransferParams} + * @throws IllegalStateException when a required field is missing + */ + public CasesTransferParams build() { + require("target_blueprint", false); + return new CasesTransferParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CasesUpdateParams.java b/src/main/java/me/didit/types/CasesUpdateParams.java new file mode 100644 index 0000000..934ed65 --- /dev/null +++ b/src/main/java/me/didit/types/CasesUpdateParams.java @@ -0,0 +1,207 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code cases.update}. */ +public final class CasesUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "priority", "due_at", "tags"); + + private CasesUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CasesUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CasesUpdateParams fromJson(JsonNode json) { + return new CasesUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.enumeration(CasesUpdateParams.Priority::of)); + } + + /** + * The due_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dueAt() { + return Json.optional(json, "due_at", Conv.DATE_TIME); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CasesUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CasesUpdateParams from) { + super(from); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(CasesUpdateParams.Priority priority) { + return set("priority", Conv.enumeration(CasesUpdateParams.Priority::of), priority); + } + + /** + * The due_at field. + * + * @param dueAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dueAt(@Nullable OffsetDateTime dueAt) { + return setNullable("due_at", Conv.DATE_TIME, dueAt); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CasesUpdateParams} + */ + public CasesUpdateParams build() { + return new CasesUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Priority extends StringEnum { + /** The value {@code "LOW"}. */ + public static final Priority LOW = new Priority("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Priority MEDIUM = new Priority("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Priority HIGH = new Priority("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Priority(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Priority of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Priority::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseCustomerResponseRequest.java b/src/main/java/me/didit/types/CustomerMessagingCaseCustomerResponseRequest.java new file mode 100644 index 0000000..865bc79 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseCustomerResponseRequest.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseCustomerResponseRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "date_of_birth", "file"); + + private CustomerMessagingCaseCustomerResponseRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseCustomerResponseRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseCustomerResponseRequest fromJson(JsonNode json) { + return new CustomerMessagingCaseCustomerResponseRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * The file field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional file() { + return Json.optional(json, "file", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseCustomerResponseRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseCustomerResponseRequest from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * The file field. + * + * @param file the value + * @return this builder + */ + public Builder file(String file) { + return set("file", Conv.STRING, file); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseCustomerResponseRequest} + */ + public CustomerMessagingCaseCustomerResponseRequest build() { + return new CustomerMessagingCaseCustomerResponseRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseCustomerResponseResult.java b/src/main/java/me/didit/types/CustomerMessagingCaseCustomerResponseResult.java new file mode 100644 index 0000000..ac97512 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseCustomerResponseResult.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseCustomerResponseResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("responded_at"); + + private CustomerMessagingCaseCustomerResponseResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseCustomerResponseResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseCustomerResponseResult fromJson(JsonNode json) { + return new CustomerMessagingCaseCustomerResponseResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The responded_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime respondedAt() { + return Json.required(json, "responded_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseCustomerResponseResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseCustomerResponseResult from) { + super(from); + } + + /** + * The responded_at field. + * + * @param respondedAt the value + * @return this builder + */ + public Builder respondedAt(OffsetDateTime respondedAt) { + return set("responded_at", Conv.DATE_TIME, respondedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseCustomerResponseResult} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseCustomerResponseResult build() { + require("responded_at", false); + return new CustomerMessagingCaseCustomerResponseResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequest.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequest.java new file mode 100644 index 0000000..e741cea --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequest.java @@ -0,0 +1,354 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CustomerMessagingCaseRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "purpose", "language", "recipient", "expires_at", "actor_email", "delivery_status", "delivered_at", "cancelled_at", "responded_at", "response", "has_attachment", "created_at"); + + private CustomerMessagingCaseRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequest fromJson(JsonNode json) { + return new CustomerMessagingCaseRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The purpose field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String purpose() { + return Json.required(json, "purpose", Conv.STRING); + } + + /** + * The language field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String language() { + return Json.required(json, "language", Conv.STRING); + } + + /** + * The recipient field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String recipient() { + return Json.required(json, "recipient", Conv.STRING); + } + + /** + * The expires_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime expiresAt() { + return Json.required(json, "expires_at", Conv.DATE_TIME); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The delivery_status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String deliveryStatus() { + return Json.required(json, "delivery_status", Conv.STRING); + } + + /** + * The delivered_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deliveredAt() { + return Json.optional(json, "delivered_at", Conv.DATE_TIME); + } + + /** + * The cancelled_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional cancelledAt() { + return Json.optional(json, "cancelled_at", Conv.DATE_TIME); + } + + /** + * The responded_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional respondedAt() { + return Json.optional(json, "responded_at", Conv.DATE_TIME); + } + + /** + * The response field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional response() { + return Json.optional(json, "response", Conv.ANY); + } + + /** + * The has_attachment field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean hasAttachment() { + return Json.required(json, "has_attachment", Conv.BOOLEAN); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequest from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The purpose field. + * + * @param purpose the value + * @return this builder + */ + public Builder purpose(String purpose) { + return set("purpose", Conv.STRING, purpose); + } + + /** + * The language field. + * + * @param language the value + * @return this builder + */ + public Builder language(String language) { + return set("language", Conv.STRING, language); + } + + /** + * The recipient field. + * + * @param recipient the value + * @return this builder + */ + public Builder recipient(String recipient) { + return set("recipient", Conv.STRING, recipient); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The delivery_status field. + * + * @param deliveryStatus the value + * @return this builder + */ + public Builder deliveryStatus(String deliveryStatus) { + return set("delivery_status", Conv.STRING, deliveryStatus); + } + + /** + * The delivered_at field. + * + * @param deliveredAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deliveredAt(@Nullable OffsetDateTime deliveredAt) { + return setNullable("delivered_at", Conv.DATE_TIME, deliveredAt); + } + + /** + * The cancelled_at field. + * + * @param cancelledAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder cancelledAt(@Nullable OffsetDateTime cancelledAt) { + return setNullable("cancelled_at", Conv.DATE_TIME, cancelledAt); + } + + /** + * The responded_at field. + * + * @param respondedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder respondedAt(@Nullable OffsetDateTime respondedAt) { + return setNullable("responded_at", Conv.DATE_TIME, respondedAt); + } + + /** + * The response field. + * + * @param response the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder response(@Nullable Object response) { + return setAny("response", response); + } + + /** + * The has_attachment field. + * + * @param hasAttachment the value + * @return this builder + */ + public Builder hasAttachment(boolean hasAttachment) { + return set("has_attachment", Conv.BOOLEAN, hasAttachment); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequest} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequest build() { + require("uuid", false); + require("purpose", false); + require("language", false); + require("recipient", false); + require("expires_at", false); + require("actor_email", true); + require("delivery_status", false); + require("delivered_at", true); + require("cancelled_at", true); + require("responded_at", true); + require("response", true); + require("has_attachment", false); + require("created_at", false); + return new CustomerMessagingCaseRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequestConfirmRequest.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequestConfirmRequest.java new file mode 100644 index 0000000..c81573c --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequestConfirmRequest.java @@ -0,0 +1,213 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseRequestConfirmRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("contact_id", "purpose", "language", "request_id", "expires_at", "preview_token"); + + private CustomerMessagingCaseRequestConfirmRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequestConfirmRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequestConfirmRequest fromJson(JsonNode json) { + return new CustomerMessagingCaseRequestConfirmRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The contact_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String contactId() { + return Json.required(json, "contact_id", Conv.STRING); + } + + /** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CustomerMessagingPurposeEnum purpose() { + return Json.required(json, "purpose", Conv.enumeration(CustomerMessagingPurposeEnum::of)); + } + + /** + * The language field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional language() { + return Json.optional(json, "language", Conv.enumeration(CustomerMessagingLanguageEnum::of)); + } + + /** + * The request_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * The expires_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime expiresAt() { + return Json.required(json, "expires_at", Conv.DATE_TIME); + } + + /** + * The preview_token field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String previewToken() { + return Json.required(json, "preview_token", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequestConfirmRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequestConfirmRequest from) { + super(from); + } + + /** + * The contact_id field. + * + * @param contactId the value + * @return this builder + */ + public Builder contactId(String contactId) { + return set("contact_id", Conv.STRING, contactId); + } + + /** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + * @param purpose the value + * @return this builder + */ + public Builder purpose(CustomerMessagingPurposeEnum purpose) { + return set("purpose", Conv.enumeration(CustomerMessagingPurposeEnum::of), purpose); + } + + /** + * The language field. + * + * @param language the value + * @return this builder + */ + public Builder language(CustomerMessagingLanguageEnum language) { + return set("language", Conv.enumeration(CustomerMessagingLanguageEnum::of), language); + } + + /** + * The request_id field. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * The preview_token field. + * + * @param previewToken the value + * @return this builder + */ + public Builder previewToken(String previewToken) { + return set("preview_token", Conv.STRING, previewToken); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequestConfirmRequest} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequestConfirmRequest build() { + require("contact_id", false); + require("purpose", false); + require("request_id", false); + require("expires_at", false); + require("preview_token", false); + return new CustomerMessagingCaseRequestConfirmRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequestContact.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequestContact.java new file mode 100644 index 0000000..bad03e3 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequestContact.java @@ -0,0 +1,142 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseRequestContact extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "email", "verified_at"); + + private CustomerMessagingCaseRequestContact(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequestContact} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequestContact fromJson(JsonNode json) { + return new CustomerMessagingCaseRequestContact(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The email field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * The verified_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime verifiedAt() { + return Json.required(json, "verified_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequestContact}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequestContact from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * The verified_at field. + * + * @param verifiedAt the value + * @return this builder + */ + public Builder verifiedAt(OffsetDateTime verifiedAt) { + return set("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequestContact} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequestContact build() { + require("uuid", false); + require("email", false); + require("verified_at", false); + return new CustomerMessagingCaseRequestContact(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequestOptions.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequestOptions.java new file mode 100644 index 0000000..09be307 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequestOptions.java @@ -0,0 +1,141 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseRequestOptions extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("contacts", "purposes", "languages"); + + private CustomerMessagingCaseRequestOptions(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequestOptions} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequestOptions fromJson(JsonNode json) { + return new CustomerMessagingCaseRequestOptions(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The contacts field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List contacts() { + return Json.required(json, "contacts", Conv.list(Conv.model(CustomerMessagingCaseRequestContact::fromJson))); + } + + /** + * The purposes field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List purposes() { + return Json.required(json, "purposes", Conv.list(Conv.enumeration(CustomerMessagingPurposesEnum::of))); + } + + /** + * The languages field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List languages() { + return Json.required(json, "languages", Conv.list(Conv.enumeration(CustomerMessagingLanguagesEnum::of))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequestOptions}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequestOptions from) { + super(from); + } + + /** + * The contacts field. + * + * @param contacts the value + * @return this builder + */ + public Builder contacts(List contacts) { + return set("contacts", Conv.list(Conv.model(CustomerMessagingCaseRequestContact::fromJson)), contacts); + } + + /** + * The purposes field. + * + * @param purposes the value + * @return this builder + */ + public Builder purposes(List purposes) { + return set("purposes", Conv.list(Conv.enumeration(CustomerMessagingPurposesEnum::of)), purposes); + } + + /** + * The languages field. + * + * @param languages the value + * @return this builder + */ + public Builder languages(List languages) { + return set("languages", Conv.list(Conv.enumeration(CustomerMessagingLanguagesEnum::of)), languages); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequestOptions} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequestOptions build() { + require("contacts", false); + require("purposes", false); + require("languages", false); + return new CustomerMessagingCaseRequestOptions(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequestPreviewRequest.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequestPreviewRequest.java new file mode 100644 index 0000000..26b93c9 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequestPreviewRequest.java @@ -0,0 +1,149 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseRequestPreviewRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("contact_id", "purpose", "language"); + + private CustomerMessagingCaseRequestPreviewRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequestPreviewRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequestPreviewRequest fromJson(JsonNode json) { + return new CustomerMessagingCaseRequestPreviewRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The contact_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String contactId() { + return Json.required(json, "contact_id", Conv.STRING); + } + + /** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CustomerMessagingPurposeEnum purpose() { + return Json.required(json, "purpose", Conv.enumeration(CustomerMessagingPurposeEnum::of)); + } + + /** + * The language field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional language() { + return Json.optional(json, "language", Conv.enumeration(CustomerMessagingLanguageEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequestPreviewRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequestPreviewRequest from) { + super(from); + } + + /** + * The contact_id field. + * + * @param contactId the value + * @return this builder + */ + public Builder contactId(String contactId) { + return set("contact_id", Conv.STRING, contactId); + } + + /** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + * @param purpose the value + * @return this builder + */ + public Builder purpose(CustomerMessagingPurposeEnum purpose) { + return set("purpose", Conv.enumeration(CustomerMessagingPurposeEnum::of), purpose); + } + + /** + * The language field. + * + * @param language the value + * @return this builder + */ + public Builder language(CustomerMessagingLanguageEnum language) { + return set("language", Conv.enumeration(CustomerMessagingLanguageEnum::of), language); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequestPreviewRequest} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequestPreviewRequest build() { + require("contact_id", false); + require("purpose", false); + return new CustomerMessagingCaseRequestPreviewRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequestPreviewResponse.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequestPreviewResponse.java new file mode 100644 index 0000000..14422bc --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequestPreviewResponse.java @@ -0,0 +1,247 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class CustomerMessagingCaseRequestPreviewResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "expires_at", "recipient", "sender", "subject", "html", "requires_user_action", "preview_token"); + + private CustomerMessagingCaseRequestPreviewResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequestPreviewResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequestPreviewResponse fromJson(JsonNode json) { + return new CustomerMessagingCaseRequestPreviewResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The request_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * The expires_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime expiresAt() { + return Json.required(json, "expires_at", Conv.DATE_TIME); + } + + /** + * The recipient field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String recipient() { + return Json.required(json, "recipient", Conv.STRING); + } + + /** + * The sender field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sender() { + return Json.required(json, "sender", Conv.STRING); + } + + /** + * The subject field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String subject() { + return Json.required(json, "subject", Conv.STRING); + } + + /** + * The html field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String html() { + return Json.required(json, "html", Conv.STRING); + } + + /** + * The requires_user_action field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean requiresUserAction() { + return Json.required(json, "requires_user_action", Conv.BOOLEAN); + } + + /** + * The preview_token field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String previewToken() { + return Json.required(json, "preview_token", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequestPreviewResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequestPreviewResponse from) { + super(from); + } + + /** + * The request_id field. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * The recipient field. + * + * @param recipient the value + * @return this builder + */ + public Builder recipient(String recipient) { + return set("recipient", Conv.STRING, recipient); + } + + /** + * The sender field. + * + * @param sender the value + * @return this builder + */ + public Builder sender(String sender) { + return set("sender", Conv.STRING, sender); + } + + /** + * The subject field. + * + * @param subject the value + * @return this builder + */ + public Builder subject(String subject) { + return set("subject", Conv.STRING, subject); + } + + /** + * The html field. + * + * @param html the value + * @return this builder + */ + public Builder html(String html) { + return set("html", Conv.STRING, html); + } + + /** + * The requires_user_action field. + * + * @param requiresUserAction the value + * @return this builder + */ + public Builder requiresUserAction(boolean requiresUserAction) { + return set("requires_user_action", Conv.BOOLEAN, requiresUserAction); + } + + /** + * The preview_token field. + * + * @param previewToken the value + * @return this builder + */ + public Builder previewToken(String previewToken) { + return set("preview_token", Conv.STRING, previewToken); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequestPreviewResponse} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequestPreviewResponse build() { + require("request_id", false); + require("expires_at", false); + require("recipient", false); + require("sender", false); + require("subject", false); + require("html", false); + require("requires_user_action", false); + require("preview_token", false); + return new CustomerMessagingCaseRequestPreviewResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingCaseRequestPublic.java b/src/main/java/me/didit/types/CustomerMessagingCaseRequestPublic.java new file mode 100644 index 0000000..135937e --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingCaseRequestPublic.java @@ -0,0 +1,282 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CustomerMessagingCaseRequestPublic extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "purpose", "language", "expires_at", "responded_at", "copy", "organization_name", "is_white_label", "customization"); + + private CustomerMessagingCaseRequestPublic(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingCaseRequestPublic} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingCaseRequestPublic fromJson(JsonNode json) { + return new CustomerMessagingCaseRequestPublic(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The request_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CustomerMessagingPurposeEnum purpose() { + return Json.required(json, "purpose", Conv.enumeration(CustomerMessagingPurposeEnum::of)); + } + + /** + * - en - en + * - es - es + * - pt - pt + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public CustomerMessagingLanguageEnum language() { + return Json.required(json, "language", Conv.enumeration(CustomerMessagingLanguageEnum::of)); + } + + /** + * The expires_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime expiresAt() { + return Json.required(json, "expires_at", Conv.DATE_TIME); + } + + /** + * The responded_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional respondedAt() { + return Json.optional(json, "responded_at", Conv.DATE_TIME); + } + + /** + * The copy field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map copy() { + return Json.required(json, "copy", Conv.OBJECT); + } + + /** + * The organization_name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String organizationName() { + return Json.required(json, "organization_name", Conv.STRING); + } + + /** + * The is_white_label field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isWhiteLabel() { + return Json.required(json, "is_white_label", Conv.BOOLEAN); + } + + /** + * The customization field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> customization() { + return Json.optional(json, "customization", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingCaseRequestPublic}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingCaseRequestPublic from) { + super(from); + } + + /** + * The request_id field. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + * @param purpose the value + * @return this builder + */ + public Builder purpose(CustomerMessagingPurposeEnum purpose) { + return set("purpose", Conv.enumeration(CustomerMessagingPurposeEnum::of), purpose); + } + + /** + * - en - en + * - es - es + * - pt - pt + * + * @param language the value + * @return this builder + */ + public Builder language(CustomerMessagingLanguageEnum language) { + return set("language", Conv.enumeration(CustomerMessagingLanguageEnum::of), language); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * The responded_at field. + * + * @param respondedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder respondedAt(@Nullable OffsetDateTime respondedAt) { + return setNullable("responded_at", Conv.DATE_TIME, respondedAt); + } + + /** + * The copy field. + * + * @param copy the value + * @return this builder + */ + public Builder copy(Map copy) { + return setAny("copy", copy); + } + + /** + * The organization_name field. + * + * @param organizationName the value + * @return this builder + */ + public Builder organizationName(String organizationName) { + return set("organization_name", Conv.STRING, organizationName); + } + + /** + * The is_white_label field. + * + * @param isWhiteLabel the value + * @return this builder + */ + public Builder isWhiteLabel(boolean isWhiteLabel) { + return set("is_white_label", Conv.BOOLEAN, isWhiteLabel); + } + + /** + * The customization field. + * + * @param customization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder customization(@Nullable Map customization) { + return setAny("customization", customization); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingCaseRequestPublic} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingCaseRequestPublic build() { + require("request_id", false); + require("purpose", false); + require("language", false); + require("expires_at", false); + require("responded_at", true); + require("copy", false); + require("organization_name", false); + require("is_white_label", false); + require("customization", true); + return new CustomerMessagingCaseRequestPublic(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingLanguageEnum.java b/src/main/java/me/didit/types/CustomerMessagingLanguageEnum.java new file mode 100644 index 0000000..053778f --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingLanguageEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - en - en + * - es - es + * - pt - pt + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CustomerMessagingLanguageEnum extends StringEnum { + /** The value {@code "en"}. */ + public static final CustomerMessagingLanguageEnum EN = new CustomerMessagingLanguageEnum("en"); + + /** The value {@code "es"}. */ + public static final CustomerMessagingLanguageEnum ES = new CustomerMessagingLanguageEnum("es"); + + /** The value {@code "pt"}. */ + public static final CustomerMessagingLanguageEnum PT = new CustomerMessagingLanguageEnum("pt"); + + private static final List KNOWN_VALUES = List.of(EN, ES, PT); + + private CustomerMessagingLanguageEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CustomerMessagingLanguageEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CustomerMessagingLanguageEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingLanguagesEnum.java b/src/main/java/me/didit/types/CustomerMessagingLanguagesEnum.java new file mode 100644 index 0000000..b7c1cd4 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingLanguagesEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - en - en + * - es - es + * - pt - pt + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CustomerMessagingLanguagesEnum extends StringEnum { + /** The value {@code "en"}. */ + public static final CustomerMessagingLanguagesEnum EN = new CustomerMessagingLanguagesEnum("en"); + + /** The value {@code "es"}. */ + public static final CustomerMessagingLanguagesEnum ES = new CustomerMessagingLanguagesEnum("es"); + + /** The value {@code "pt"}. */ + public static final CustomerMessagingLanguagesEnum PT = new CustomerMessagingLanguagesEnum("pt"); + + private static final List KNOWN_VALUES = List.of(EN, ES, PT); + + private CustomerMessagingLanguagesEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CustomerMessagingLanguagesEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CustomerMessagingLanguagesEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingPaginatedCaseRequestList.java b/src/main/java/me/didit/types/CustomerMessagingPaginatedCaseRequestList.java new file mode 100644 index 0000000..fbc5f35 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingPaginatedCaseRequestList.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class CustomerMessagingPaginatedCaseRequestList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private CustomerMessagingPaginatedCaseRequestList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomerMessagingPaginatedCaseRequestList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomerMessagingPaginatedCaseRequestList fromJson(JsonNode json) { + return new CustomerMessagingPaginatedCaseRequestList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(CustomerMessagingCaseRequest::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomerMessagingPaginatedCaseRequestList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomerMessagingPaginatedCaseRequestList from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(CustomerMessagingCaseRequest::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomerMessagingPaginatedCaseRequestList} + * @throws IllegalStateException when a required field is missing + */ + public CustomerMessagingPaginatedCaseRequestList build() { + require("count", false); + require("results", false); + return new CustomerMessagingPaginatedCaseRequestList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingPurposeEnum.java b/src/main/java/me/didit/types/CustomerMessagingPurposeEnum.java new file mode 100644 index 0000000..cf04682 --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingPurposeEnum.java @@ -0,0 +1,61 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CustomerMessagingPurposeEnum extends StringEnum { + /** The value {@code "identity_document"}. */ + public static final CustomerMessagingPurposeEnum IDENTITY_DOCUMENT = new CustomerMessagingPurposeEnum("identity_document"); + + /** The value {@code "proof_of_address"}. */ + public static final CustomerMessagingPurposeEnum PROOF_OF_ADDRESS = new CustomerMessagingPurposeEnum("proof_of_address"); + + /** The value {@code "business_document"}. */ + public static final CustomerMessagingPurposeEnum BUSINESS_DOCUMENT = new CustomerMessagingPurposeEnum("business_document"); + + /** The value {@code "confirm_details"}. */ + public static final CustomerMessagingPurposeEnum CONFIRM_DETAILS = new CustomerMessagingPurposeEnum("confirm_details"); + + /** The value {@code "review_in_progress"}. */ + public static final CustomerMessagingPurposeEnum REVIEW_IN_PROGRESS = new CustomerMessagingPurposeEnum("review_in_progress"); + + private static final List KNOWN_VALUES = List.of(IDENTITY_DOCUMENT, PROOF_OF_ADDRESS, BUSINESS_DOCUMENT, CONFIRM_DETAILS, REVIEW_IN_PROGRESS); + + private CustomerMessagingPurposeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CustomerMessagingPurposeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CustomerMessagingPurposeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CustomerMessagingPurposesEnum.java b/src/main/java/me/didit/types/CustomerMessagingPurposesEnum.java new file mode 100644 index 0000000..ff74b9e --- /dev/null +++ b/src/main/java/me/didit/types/CustomerMessagingPurposesEnum.java @@ -0,0 +1,61 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - identity_document - identity_document + * - proof_of_address - proof_of_address + * - business_document - business_document + * - confirm_details - confirm_details + * - review_in_progress - review_in_progress + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class CustomerMessagingPurposesEnum extends StringEnum { + /** The value {@code "identity_document"}. */ + public static final CustomerMessagingPurposesEnum IDENTITY_DOCUMENT = new CustomerMessagingPurposesEnum("identity_document"); + + /** The value {@code "proof_of_address"}. */ + public static final CustomerMessagingPurposesEnum PROOF_OF_ADDRESS = new CustomerMessagingPurposesEnum("proof_of_address"); + + /** The value {@code "business_document"}. */ + public static final CustomerMessagingPurposesEnum BUSINESS_DOCUMENT = new CustomerMessagingPurposesEnum("business_document"); + + /** The value {@code "confirm_details"}. */ + public static final CustomerMessagingPurposesEnum CONFIRM_DETAILS = new CustomerMessagingPurposesEnum("confirm_details"); + + /** The value {@code "review_in_progress"}. */ + public static final CustomerMessagingPurposesEnum REVIEW_IN_PROGRESS = new CustomerMessagingPurposesEnum("review_in_progress"); + + private static final List KNOWN_VALUES = List.of(IDENTITY_DOCUMENT, PROOF_OF_ADDRESS, BUSINESS_DOCUMENT, CONFIRM_DETAILS, REVIEW_IN_PROGRESS); + + private CustomerMessagingPurposesEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CustomerMessagingPurposesEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CustomerMessagingPurposesEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/CustomizationUpdateParams.java b/src/main/java/me/didit/types/CustomizationUpdateParams.java new file mode 100644 index 0000000..4ba76cf --- /dev/null +++ b/src/main/java/me/didit/types/CustomizationUpdateParams.java @@ -0,0 +1,166 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code customization.update}. */ +public final class CustomizationUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("image_square", "image_rectangular", "image_favicon"); + + private CustomizationUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CustomizationUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CustomizationUpdateParams fromJson(JsonNode json) { + return new CustomizationUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Square logo (1:1 aspect ratio). Max 1 MB. Allowed: png, jpg, jpeg, webp. + * + * @return the file to upload, if set + */ + public Optional imageSquare() { + return file("image_square"); + } + + /** + * Rectangular logo (2:1 aspect ratio). Max 1 MB. Allowed: png, jpg, jpeg, webp. + * + * @return the file to upload, if set + */ + public Optional imageRectangular() { + return file("image_rectangular"); + } + + /** + * Favicon image. Max 500 KB. + * + * @return the file to upload, if set + */ + public Optional imageFavicon() { + return file("image_favicon"); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CustomizationUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CustomizationUpdateParams from) { + super(from); + } + + /** + * Square logo (1:1 aspect ratio). Max 1 MB. Allowed: png, jpg, jpeg, webp. + * + * @param imageSquare the value + * @return this builder + */ + public Builder imageSquare(FileUpload imageSquare) { + return setFile("image_square", imageSquare); + } + + /** + * Uploads the file at {@code path} as {@code image_square}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder imageSquare(Path path) { + return setFile("image_square", FileUpload.of(path)); + } + + /** + * Rectangular logo (2:1 aspect ratio). Max 1 MB. Allowed: png, jpg, jpeg, webp. + * + * @param imageRectangular the value + * @return this builder + */ + public Builder imageRectangular(FileUpload imageRectangular) { + return setFile("image_rectangular", imageRectangular); + } + + /** + * Uploads the file at {@code path} as {@code image_rectangular}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder imageRectangular(Path path) { + return setFile("image_rectangular", FileUpload.of(path)); + } + + /** + * Favicon image. Max 500 KB. + * + * @param imageFavicon the value + * @return this builder + */ + public Builder imageFavicon(FileUpload imageFavicon) { + return setFile("image_favicon", imageFavicon); + } + + /** + * Uploads the file at {@code path} as {@code image_favicon}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder imageFavicon(Path path) { + return setFile("image_favicon", FileUpload.of(path)); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CustomizationUpdateParams} + */ + public CustomizationUpdateParams build() { + return new CustomizationUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DatabaseValidationValidateParams.java b/src/main/java/me/didit/types/DatabaseValidationValidateParams.java new file mode 100644 index 0000000..937fa66 --- /dev/null +++ b/src/main/java/me/didit/types/DatabaseValidationValidateParams.java @@ -0,0 +1,1891 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code database_validation.validate}. */ +public final class DatabaseValidationValidateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("issuing_state", "services", "validation_type", "consent", "identification_number", "first_name", "last_name", "middle_name", "full_name", "date_of_birth", "personal_number", "tax_number", "document_number", "document_type", "expiration_date", "date_of_issue", "nationality", "gender", "address", "address_element_1", "address_element_2", "address_element_3", "address_element_4", "address_element_5", "postal_code", "driver_license_number", "driver_license_card_number", "driver_license_state", "driver_license_version", "passport_number", "passport_expiration_date", "passport_file_number", "passport_issue_country", "medicare_card_number", "immi_card_number", "immi_card_expiry_date", "citizenship_certificate_number", "birth_registration_number", "birth_registration_date", "birth_registration_state", "marriage_certificate_number", "change_of_name_certificate_number", "first_partner_name", "last_partner_name", "voter_id", "epic_card", "pan", "national_id", "cic", "identificador_ciudadano", "ocr", "voter_number", "emission_number", "bvn", "bank_card_number", "ssn", "phone", "landline", "email", "country_of_residence", "partial_match_action", "no_match_action", "save_api_request", "vendor_data", "metadata", "selfie"); + + private DatabaseValidationValidateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DatabaseValidationValidateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DatabaseValidationValidateParams fromJson(JsonNode json) { + return new DatabaseValidationValidateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * ISO 3166-1 alpha-3 country code of the registry to validate against (e.g. BRA, ESP, COL). Determines which services are available. Unsupported codes return 400 with the full list of valid options. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String issuingState() { + return Json.required(json, "issuing_state", Conv.STRING); + } + + /** + * Catalog service_ids to run for this country (e.g. ["bra_cpf"]). Also accepts a single string or a comma-separated/JSON-encoded string. If omitted or empty, exactly one default service runs โ€” the longest-established live service for the country; newer, biometric, and pay-as-you-go services must be named explicitly. Sending services switches the response to the extended shape (adds services_used and match_score). Every id must exist and be live for the issuing_state; services that require onboarding return 400 until activated for your organization. Discover available services per country via GET /v1/organization/database-validation-countries/ (a catalog endpoint not documented in this spec) or the Business Console workflow editor. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> services() { + return Json.optional(json, "services", Conv.list(Conv.STRING)); + } + + /** + * DEPRECATED. Accepted for backward compatibility but ignored โ€” the response validation_type is now derived from how many services full-matched. Use services to pin specific services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + * + * @deprecated Deprecated by the API. + */ + @Deprecated + public Optional validationType() { + return Json.optional(json, "validation_type", Conv.STRING); + } + + /** + * Set to true when the end user has explicitly consented to the selected validation services. Required for services flagged requires_consent=true in the catalog โ€” without it those services return 400 with services_requiring_consent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional consent() { + return Json.optional(json, "consent", Conv.BOOLEAN); + } + + /** + * Universal identification number โ€” automatically mapped to the correct country-specific field, so you can use it instead of personal_number/tax_number/document_number: ARGโ†’document_number (DNI), BOLโ†’document_number (CI), BRAโ†’tax_number (CPF, 11 digits), CHLโ†’personal_number (RUT), COLโ†’personal_number (Cรฉdula), CRIโ†’personal_number (Cรฉdula), DOMโ†’personal_number (Cรฉdula, 11 digits), ECUโ†’personal_number (Cรฉdula, 10 digits), ESPโ†’personal_number (DNI/NIE), GTMโ†’document_number (DPI), HNDโ†’document_number (DNI), MEXโ†’personal_number (CURP, 18 chars), PANโ†’personal_number (Cรฉdula), PERโ†’personal_number (DNI, 8 digits), PRYโ†’document_number (CI), SLVโ†’document_number (DUI), URYโ†’personal_number (CI), VENโ†’document_number (Cรฉdula). It never overrides an explicitly provided country-specific field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identificationNumber() { + return Json.optional(json, "identification_number", Conv.STRING); + } + + /** + * The individual's first name. Required by some services/countries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The individual's last name. Required by some services/countries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Middle name, used by some country services (AUS, NZL, โ€ฆ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional middleName() { + return Json.optional(json, "middle_name", Conv.STRING); + } + + /** + * Full name โ€” some services accept this in lieu of first/last name (e.g. CHN services, which match the native-script name). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * Date of birth, YYYY-MM-DD. Required by many services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Government-issued unique personal identifier. Used by: CHL (RUT), COL (Cรฉdula), CRI, DOM, ECU, ESP (DNI/NIE), MEX (CURP), PAN (Cรฉdula), PER (DNI), URY. Consider identification_number instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * Tax identification number. Used by: BRA (CPF, 11 digits). Consider identification_number instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * Document number. Used by: ARG (DNI), BOL (CI), GTM (DPI), HND (DNI), PRY (CI), SLV (DUI), VEN (Cรฉdula). Consider identification_number instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * Type of document being validated: P passport, DL driver license, ID national ID, RP residence permit (plus SSC, HIC, WP, TC, VISA, PSC, BC, OTHER). Required by some services (e.g. ESP). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(DatabaseValidationValidateParams.DocumentType::of)); + } + + /** + * Document expiration date, YYYY-MM-DD. Required for ESP (Spain) validation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * Document issue date, YYYY-MM-DD (fecha de expediciรณn). Required for COL (Colombia) cรฉdula validation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfIssue() { + return Json.optional(json, "date_of_issue", Conv.DATE); + } + + /** + * Nationality as ISO 3166-1 alpha-3. Required by some services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Gender: M, F, or X (other/unknown). Required for Argentina's RENAPER validation (arg_renaper). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.enumeration(DatabaseValidationValidateParams.Gender::of)); + } + + /** + * Residential address. Prefer the structured object {"street_1":"123 Main St","street_2":"Apt 4B","city":"Springfield","region":"IL","postal_code":"62701","country":"US"}; a complete single-line string is still accepted. Required by address-verification services; when a service defines address requirements, missing parts return 400 with address_fields_required_by. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.union(DatabaseValidationValidateParams.Address::fromJson)); + } + + /** + * Street address including street number and type. If omitted, derived from address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressElement1() { + return Json.optional(json, "address_element_1", Conv.STRING); + } + + /** + * Apartment, unit, building, floor, or extra address line. Only send when you have it explicitly. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressElement2() { + return Json.optional(json, "address_element_2", Conv.STRING); + } + + /** + * City, suburb, district, locality, or neighborhood. If omitted, derived from address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressElement3() { + return Json.optional(json, "address_element_3", Conv.STRING); + } + + /** + * State, province, region, or town. If omitted, derived from address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressElement4() { + return Json.optional(json, "address_element_4", Conv.STRING); + } + + /** + * Postcode or postal code. postal_code is accepted as an alias. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressElement5() { + return Json.optional(json, "address_element_5", Conv.STRING); + } + + /** + * Postal code for address-based services (alias of address_element_5). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * Driver licence number for government document-verification services (AUS, NZL, IND). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional driverLicenseNumber() { + return Json.optional(json, "driver_license_number", Conv.STRING); + } + + /** + * Physical driver licence card number, where required separately from the licence number (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional driverLicenseCardNumber() { + return Json.optional(json, "driver_license_card_number", Conv.STRING); + } + + /** + * Driver licence state or territory of issue (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional driverLicenseState() { + return Json.optional(json, "driver_license_state", Conv.STRING); + } + + /** + * Driver licence version code (NZL). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional driverLicenseVersion() { + return Json.optional(json, "driver_license_version", Conv.STRING); + } + + /** + * Passport number for government passport-verification services (AUS, NZL, IND, CHN). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional passportNumber() { + return Json.optional(json, "passport_number", Conv.STRING); + } + + /** + * Passport expiry date, YYYY-MM-DD, for passport-verification services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional passportExpirationDate() { + return Json.optional(json, "passport_expiration_date", Conv.DATE); + } + + /** + * Passport file number (IND). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional passportFileNumber() { + return Json.optional(json, "passport_file_number", Conv.STRING); + } + + /** + * Issuing country of the passport (ISO 3166-1 alpha-3) for passport-verification services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional passportIssueCountry() { + return Json.optional(json, "passport_issue_country", Conv.STRING); + } + + /** + * Medicare card number (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional medicareCardNumber() { + return Json.optional(json, "medicare_card_number", Conv.STRING); + } + + /** + * Australian ImmiCard number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional immiCardNumber() { + return Json.optional(json, "immi_card_number", Conv.STRING); + } + + /** + * Australian ImmiCard expiry date. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional immiCardExpiryDate() { + return Json.optional(json, "immi_card_expiry_date", Conv.DATE); + } + + /** + * Citizenship certificate number (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional citizenshipCertificateNumber() { + return Json.optional(json, "citizenship_certificate_number", Conv.STRING); + } + + /** + * Birth-certificate registration number (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthRegistrationNumber() { + return Json.optional(json, "birth_registration_number", Conv.STRING); + } + + /** + * Birth-certificate registration date (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthRegistrationDate() { + return Json.optional(json, "birth_registration_date", Conv.DATE); + } + + /** + * Birth-certificate registration state (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthRegistrationState() { + return Json.optional(json, "birth_registration_state", Conv.STRING); + } + + /** + * Marriage certificate number (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional marriageCertificateNumber() { + return Json.optional(json, "marriage_certificate_number", Conv.STRING); + } + + /** + * Change-of-name certificate number (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional changeOfNameCertificateNumber() { + return Json.optional(json, "change_of_name_certificate_number", Conv.STRING); + } + + /** + * First name of the partner on a marriage certificate (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstPartnerName() { + return Json.optional(json, "first_partner_name", Conv.STRING); + } + + /** + * Last name of the partner on a marriage certificate (AUS). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastPartnerName() { + return Json.optional(json, "last_partner_name", Conv.STRING); + } + + /** + * Voter registration number (IND EPIC, IRL). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional voterId() { + return Json.optional(json, "voter_id", Conv.STRING); + } + + /** + * India EPIC voter card number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional epicCard() { + return Json.optional(json, "epic_card", Conv.STRING); + } + + /** + * India PAN (Permanent Account Number). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pan() { + return Json.optional(json, "pan", Conv.STRING); + } + + /** + * National ID number (CHN, MYS, KEN, KHM, NGA, ZAF, โ€ฆ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationalId() { + return Json.optional(json, "national_id", Conv.STRING); + } + + /** + * Mexican INE/IFE Cรณdigo de Identificaciรณn de Credencial (CIC), 9 digits. Used by the MEX INE credential-validity service (mex_ine_vigencia). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional cic() { + return Json.optional(json, "cic", Conv.STRING); + } + + /** + * Mexican INE Identificador del Ciudadano (9 digits). Used with cic for modern INE models (E/F/G/H) in mex_ine_vigencia. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identificadorCiudadano() { + return Json.optional(json, "identificador_ciudadano", Conv.STRING); + } + + /** + * Mexican INE OCR number (13 digits, back of card). Used with cic for Model D in mex_ine_vigencia. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ocr() { + return Json.optional(json, "ocr", Conv.STRING); + } + + /** + * Mexican INE Clave de Elector (18 chars). Used with emission_number for legacy IFE models (A/B/C) in mex_ine_vigencia. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional voterNumber() { + return Json.optional(json, "voter_number", Conv.STRING); + } + + /** + * Mexican INE Nรบmero de Emisiรณn. Used with voter_number for legacy IFE models (A/B/C) in mex_ine_vigencia. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emissionNumber() { + return Json.optional(json, "emission_number", Conv.STRING); + } + + /** + * Nigerian Bank Verification Number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bvn() { + return Json.optional(json, "bvn", Conv.STRING); + } + + /** + * Bank card number (CHN bank-card verification). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankCardNumber() { + return Json.optional(json, "bank_card_number", Conv.STRING); + } + + /** + * Social Security Number (USA). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ssn() { + return Json.optional(json, "ssn", Conv.STRING); + } + + /** + * Phone number for phone-verification services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * Landline number for phone-verification services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional landline() { + return Json.optional(json, "landline", Conv.STRING); + } + + /** + * Email address for identity-verification services. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country of residence. Used by global identity-enrichment services (e.g. glb_identity_enrichment) to focus the lookup. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryOfResidence() { + return Json.optional(json, "country_of_residence", Conv.STRING); + } + + /** + * What a partial_match does to database_validation.status. Defaults to NO_ACTION (status stays Approved, with a warning). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional partialMatchAction() { + return Json.optional(json, "partial_match_action", Conv.enumeration(DatabaseValidationValidateParams.PartialMatchAction::of)); + } + + /** + * What a no_match does to database_validation.status. Defaults to DECLINE. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional noMatchAction() { + return Json.optional(json, "no_match_action", Conv.enumeration(DatabaseValidationValidateParams.NoMatchAction::of)); + } + + /** + * Persist the validation as a session (console visibility, decision endpoint, status.updated webhook). Also changes the validations response shape: per-service objects when true (default), a merged field map when false. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Your identifier for the validated user; echoed back and stored with the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Free-form JSON stored with the request and echoed back. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Selfie image (jpg, jpeg, png, webp; max 2 MB โ€” images are compressed to ~1.5 MB before upload to the registry) for biometric validation services, e.g. Argentina RENAPER (arg_renaper) and Panama SIB (pan_cedula_sib, pan_cedula_sib_plus). Required whenever a selected service lists it as a required field. Only available via multipart/form-data. + * + * @return the file to upload, if set + */ + public Optional selfie() { + return file("selfie"); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DatabaseValidationValidateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DatabaseValidationValidateParams from) { + super(from); + } + + /** + * ISO 3166-1 alpha-3 country code of the registry to validate against (e.g. BRA, ESP, COL). Determines which services are available. Unsupported codes return 400 with the full list of valid options. + * + * @param issuingState the value + * @return this builder + */ + public Builder issuingState(String issuingState) { + return set("issuing_state", Conv.STRING, issuingState); + } + + /** + * Catalog service_ids to run for this country (e.g. ["bra_cpf"]). Also accepts a single string or a comma-separated/JSON-encoded string. If omitted or empty, exactly one default service runs โ€” the longest-established live service for the country; newer, biometric, and pay-as-you-go services must be named explicitly. Sending services switches the response to the extended shape (adds services_used and match_score). Every id must exist and be live for the issuing_state; services that require onboarding return 400 until activated for your organization. Discover available services per country via GET /v1/organization/database-validation-countries/ (a catalog endpoint not documented in this spec) or the Business Console workflow editor. + * + * @param services the value + * @return this builder + */ + public Builder services(List services) { + return set("services", Conv.list(Conv.STRING), services); + } + + /** + * DEPRECATED. Accepted for backward compatibility but ignored โ€” the response validation_type is now derived from how many services full-matched. Use services to pin specific services. + * + * @param validationType the value + * @return this builder + * + * @deprecated Deprecated by the API. + */ + @Deprecated + public Builder validationType(String validationType) { + return set("validation_type", Conv.STRING, validationType); + } + + /** + * Set to true when the end user has explicitly consented to the selected validation services. Required for services flagged requires_consent=true in the catalog โ€” without it those services return 400 with services_requiring_consent. + * + * @param consent the value + * @return this builder + */ + public Builder consent(boolean consent) { + return set("consent", Conv.BOOLEAN, consent); + } + + /** + * Universal identification number โ€” automatically mapped to the correct country-specific field, so you can use it instead of personal_number/tax_number/document_number: ARGโ†’document_number (DNI), BOLโ†’document_number (CI), BRAโ†’tax_number (CPF, 11 digits), CHLโ†’personal_number (RUT), COLโ†’personal_number (Cรฉdula), CRIโ†’personal_number (Cรฉdula), DOMโ†’personal_number (Cรฉdula, 11 digits), ECUโ†’personal_number (Cรฉdula, 10 digits), ESPโ†’personal_number (DNI/NIE), GTMโ†’document_number (DPI), HNDโ†’document_number (DNI), MEXโ†’personal_number (CURP, 18 chars), PANโ†’personal_number (Cรฉdula), PERโ†’personal_number (DNI, 8 digits), PRYโ†’document_number (CI), SLVโ†’document_number (DUI), URYโ†’personal_number (CI), VENโ†’document_number (Cรฉdula). It never overrides an explicitly provided country-specific field. + * + * @param identificationNumber the value + * @return this builder + */ + public Builder identificationNumber(String identificationNumber) { + return set("identification_number", Conv.STRING, identificationNumber); + } + + /** + * The individual's first name. Required by some services/countries. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * The individual's last name. Required by some services/countries. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * Middle name, used by some country services (AUS, NZL, โ€ฆ). + * + * @param middleName the value + * @return this builder + */ + public Builder middleName(String middleName) { + return set("middle_name", Conv.STRING, middleName); + } + + /** + * Full name โ€” some services accept this in lieu of first/last name (e.g. CHN services, which match the native-script name). + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * Date of birth, YYYY-MM-DD. Required by many services. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Government-issued unique personal identifier. Used by: CHL (RUT), COL (Cรฉdula), CRI, DOM, ECU, ESP (DNI/NIE), MEX (CURP), PAN (Cรฉdula), PER (DNI), URY. Consider identification_number instead. + * + * @param personalNumber the value + * @return this builder + */ + public Builder personalNumber(String personalNumber) { + return set("personal_number", Conv.STRING, personalNumber); + } + + /** + * Tax identification number. Used by: BRA (CPF, 11 digits). Consider identification_number instead. + * + * @param taxNumber the value + * @return this builder + */ + public Builder taxNumber(String taxNumber) { + return set("tax_number", Conv.STRING, taxNumber); + } + + /** + * Document number. Used by: ARG (DNI), BOL (CI), GTM (DPI), HND (DNI), PRY (CI), SLV (DUI), VEN (Cรฉdula). Consider identification_number instead. + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * Type of document being validated: P passport, DL driver license, ID national ID, RP residence permit (plus SSC, HIC, WP, TC, VISA, PSC, BC, OTHER). Required by some services (e.g. ESP). + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(DatabaseValidationValidateParams.DocumentType documentType) { + return set("document_type", Conv.enumeration(DatabaseValidationValidateParams.DocumentType::of), documentType); + } + + /** + * Document expiration date, YYYY-MM-DD. Required for ESP (Spain) validation. + * + * @param expirationDate the value + * @return this builder + */ + public Builder expirationDate(LocalDate expirationDate) { + return set("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Document issue date, YYYY-MM-DD (fecha de expediciรณn). Required for COL (Colombia) cรฉdula validation. + * + * @param dateOfIssue the value + * @return this builder + */ + public Builder dateOfIssue(LocalDate dateOfIssue) { + return set("date_of_issue", Conv.DATE, dateOfIssue); + } + + /** + * Nationality as ISO 3166-1 alpha-3. Required by some services. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * Gender: M, F, or X (other/unknown). Required for Argentina's RENAPER validation (arg_renaper). + * + * @param gender the value + * @return this builder + */ + public Builder gender(DatabaseValidationValidateParams.Gender gender) { + return set("gender", Conv.enumeration(DatabaseValidationValidateParams.Gender::of), gender); + } + + /** + * Residential address. Prefer the structured object {"street_1":"123 Main St","street_2":"Apt 4B","city":"Springfield","region":"IL","postal_code":"62701","country":"US"}; a complete single-line string is still accepted. Required by address-verification services; when a service defines address requirements, missing parts return 400 with address_fields_required_by. + * + * @param address the value + * @return this builder + */ + public Builder address(DatabaseValidationValidateParams.Address address) { + return set("address", Conv.union(DatabaseValidationValidateParams.Address::fromJson), address); + } + + /** + * Street address including street number and type. If omitted, derived from address. + * + * @param addressElement1 the value + * @return this builder + */ + public Builder addressElement1(String addressElement1) { + return set("address_element_1", Conv.STRING, addressElement1); + } + + /** + * Apartment, unit, building, floor, or extra address line. Only send when you have it explicitly. + * + * @param addressElement2 the value + * @return this builder + */ + public Builder addressElement2(String addressElement2) { + return set("address_element_2", Conv.STRING, addressElement2); + } + + /** + * City, suburb, district, locality, or neighborhood. If omitted, derived from address. + * + * @param addressElement3 the value + * @return this builder + */ + public Builder addressElement3(String addressElement3) { + return set("address_element_3", Conv.STRING, addressElement3); + } + + /** + * State, province, region, or town. If omitted, derived from address. + * + * @param addressElement4 the value + * @return this builder + */ + public Builder addressElement4(String addressElement4) { + return set("address_element_4", Conv.STRING, addressElement4); + } + + /** + * Postcode or postal code. postal_code is accepted as an alias. + * + * @param addressElement5 the value + * @return this builder + */ + public Builder addressElement5(String addressElement5) { + return set("address_element_5", Conv.STRING, addressElement5); + } + + /** + * Postal code for address-based services (alias of address_element_5). + * + * @param postalCode the value + * @return this builder + */ + public Builder postalCode(String postalCode) { + return set("postal_code", Conv.STRING, postalCode); + } + + /** + * Driver licence number for government document-verification services (AUS, NZL, IND). + * + * @param driverLicenseNumber the value + * @return this builder + */ + public Builder driverLicenseNumber(String driverLicenseNumber) { + return set("driver_license_number", Conv.STRING, driverLicenseNumber); + } + + /** + * Physical driver licence card number, where required separately from the licence number (AUS). + * + * @param driverLicenseCardNumber the value + * @return this builder + */ + public Builder driverLicenseCardNumber(String driverLicenseCardNumber) { + return set("driver_license_card_number", Conv.STRING, driverLicenseCardNumber); + } + + /** + * Driver licence state or territory of issue (AUS). + * + * @param driverLicenseState the value + * @return this builder + */ + public Builder driverLicenseState(String driverLicenseState) { + return set("driver_license_state", Conv.STRING, driverLicenseState); + } + + /** + * Driver licence version code (NZL). + * + * @param driverLicenseVersion the value + * @return this builder + */ + public Builder driverLicenseVersion(String driverLicenseVersion) { + return set("driver_license_version", Conv.STRING, driverLicenseVersion); + } + + /** + * Passport number for government passport-verification services (AUS, NZL, IND, CHN). + * + * @param passportNumber the value + * @return this builder + */ + public Builder passportNumber(String passportNumber) { + return set("passport_number", Conv.STRING, passportNumber); + } + + /** + * Passport expiry date, YYYY-MM-DD, for passport-verification services. + * + * @param passportExpirationDate the value + * @return this builder + */ + public Builder passportExpirationDate(LocalDate passportExpirationDate) { + return set("passport_expiration_date", Conv.DATE, passportExpirationDate); + } + + /** + * Passport file number (IND). + * + * @param passportFileNumber the value + * @return this builder + */ + public Builder passportFileNumber(String passportFileNumber) { + return set("passport_file_number", Conv.STRING, passportFileNumber); + } + + /** + * Issuing country of the passport (ISO 3166-1 alpha-3) for passport-verification services. + * + * @param passportIssueCountry the value + * @return this builder + */ + public Builder passportIssueCountry(String passportIssueCountry) { + return set("passport_issue_country", Conv.STRING, passportIssueCountry); + } + + /** + * Medicare card number (AUS). + * + * @param medicareCardNumber the value + * @return this builder + */ + public Builder medicareCardNumber(String medicareCardNumber) { + return set("medicare_card_number", Conv.STRING, medicareCardNumber); + } + + /** + * Australian ImmiCard number. + * + * @param immiCardNumber the value + * @return this builder + */ + public Builder immiCardNumber(String immiCardNumber) { + return set("immi_card_number", Conv.STRING, immiCardNumber); + } + + /** + * Australian ImmiCard expiry date. + * + * @param immiCardExpiryDate the value + * @return this builder + */ + public Builder immiCardExpiryDate(LocalDate immiCardExpiryDate) { + return set("immi_card_expiry_date", Conv.DATE, immiCardExpiryDate); + } + + /** + * Citizenship certificate number (AUS). + * + * @param citizenshipCertificateNumber the value + * @return this builder + */ + public Builder citizenshipCertificateNumber(String citizenshipCertificateNumber) { + return set("citizenship_certificate_number", Conv.STRING, citizenshipCertificateNumber); + } + + /** + * Birth-certificate registration number (AUS). + * + * @param birthRegistrationNumber the value + * @return this builder + */ + public Builder birthRegistrationNumber(String birthRegistrationNumber) { + return set("birth_registration_number", Conv.STRING, birthRegistrationNumber); + } + + /** + * Birth-certificate registration date (AUS). + * + * @param birthRegistrationDate the value + * @return this builder + */ + public Builder birthRegistrationDate(LocalDate birthRegistrationDate) { + return set("birth_registration_date", Conv.DATE, birthRegistrationDate); + } + + /** + * Birth-certificate registration state (AUS). + * + * @param birthRegistrationState the value + * @return this builder + */ + public Builder birthRegistrationState(String birthRegistrationState) { + return set("birth_registration_state", Conv.STRING, birthRegistrationState); + } + + /** + * Marriage certificate number (AUS). + * + * @param marriageCertificateNumber the value + * @return this builder + */ + public Builder marriageCertificateNumber(String marriageCertificateNumber) { + return set("marriage_certificate_number", Conv.STRING, marriageCertificateNumber); + } + + /** + * Change-of-name certificate number (AUS). + * + * @param changeOfNameCertificateNumber the value + * @return this builder + */ + public Builder changeOfNameCertificateNumber(String changeOfNameCertificateNumber) { + return set("change_of_name_certificate_number", Conv.STRING, changeOfNameCertificateNumber); + } + + /** + * First name of the partner on a marriage certificate (AUS). + * + * @param firstPartnerName the value + * @return this builder + */ + public Builder firstPartnerName(String firstPartnerName) { + return set("first_partner_name", Conv.STRING, firstPartnerName); + } + + /** + * Last name of the partner on a marriage certificate (AUS). + * + * @param lastPartnerName the value + * @return this builder + */ + public Builder lastPartnerName(String lastPartnerName) { + return set("last_partner_name", Conv.STRING, lastPartnerName); + } + + /** + * Voter registration number (IND EPIC, IRL). + * + * @param voterId the value + * @return this builder + */ + public Builder voterId(String voterId) { + return set("voter_id", Conv.STRING, voterId); + } + + /** + * India EPIC voter card number. + * + * @param epicCard the value + * @return this builder + */ + public Builder epicCard(String epicCard) { + return set("epic_card", Conv.STRING, epicCard); + } + + /** + * India PAN (Permanent Account Number). + * + * @param pan the value + * @return this builder + */ + public Builder pan(String pan) { + return set("pan", Conv.STRING, pan); + } + + /** + * National ID number (CHN, MYS, KEN, KHM, NGA, ZAF, โ€ฆ). + * + * @param nationalId the value + * @return this builder + */ + public Builder nationalId(String nationalId) { + return set("national_id", Conv.STRING, nationalId); + } + + /** + * Mexican INE/IFE Cรณdigo de Identificaciรณn de Credencial (CIC), 9 digits. Used by the MEX INE credential-validity service (mex_ine_vigencia). + * + * @param cic the value + * @return this builder + */ + public Builder cic(String cic) { + return set("cic", Conv.STRING, cic); + } + + /** + * Mexican INE Identificador del Ciudadano (9 digits). Used with cic for modern INE models (E/F/G/H) in mex_ine_vigencia. + * + * @param identificadorCiudadano the value + * @return this builder + */ + public Builder identificadorCiudadano(String identificadorCiudadano) { + return set("identificador_ciudadano", Conv.STRING, identificadorCiudadano); + } + + /** + * Mexican INE OCR number (13 digits, back of card). Used with cic for Model D in mex_ine_vigencia. + * + * @param ocr the value + * @return this builder + */ + public Builder ocr(String ocr) { + return set("ocr", Conv.STRING, ocr); + } + + /** + * Mexican INE Clave de Elector (18 chars). Used with emission_number for legacy IFE models (A/B/C) in mex_ine_vigencia. + * + * @param voterNumber the value + * @return this builder + */ + public Builder voterNumber(String voterNumber) { + return set("voter_number", Conv.STRING, voterNumber); + } + + /** + * Mexican INE Nรบmero de Emisiรณn. Used with voter_number for legacy IFE models (A/B/C) in mex_ine_vigencia. + * + * @param emissionNumber the value + * @return this builder + */ + public Builder emissionNumber(String emissionNumber) { + return set("emission_number", Conv.STRING, emissionNumber); + } + + /** + * Nigerian Bank Verification Number. + * + * @param bvn the value + * @return this builder + */ + public Builder bvn(String bvn) { + return set("bvn", Conv.STRING, bvn); + } + + /** + * Bank card number (CHN bank-card verification). + * + * @param bankCardNumber the value + * @return this builder + */ + public Builder bankCardNumber(String bankCardNumber) { + return set("bank_card_number", Conv.STRING, bankCardNumber); + } + + /** + * Social Security Number (USA). + * + * @param ssn the value + * @return this builder + */ + public Builder ssn(String ssn) { + return set("ssn", Conv.STRING, ssn); + } + + /** + * Phone number for phone-verification services. + * + * @param phone the value + * @return this builder + */ + public Builder phone(String phone) { + return set("phone", Conv.STRING, phone); + } + + /** + * Landline number for phone-verification services. + * + * @param landline the value + * @return this builder + */ + public Builder landline(String landline) { + return set("landline", Conv.STRING, landline); + } + + /** + * Email address for identity-verification services. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * ISO 3166-1 alpha-2 country of residence. Used by global identity-enrichment services (e.g. glb_identity_enrichment) to focus the lookup. + * + * @param countryOfResidence the value + * @return this builder + */ + public Builder countryOfResidence(String countryOfResidence) { + return set("country_of_residence", Conv.STRING, countryOfResidence); + } + + /** + * What a partial_match does to database_validation.status. Defaults to NO_ACTION (status stays Approved, with a warning). + * + * @param partialMatchAction the value + * @return this builder + */ + public Builder partialMatchAction(DatabaseValidationValidateParams.PartialMatchAction partialMatchAction) { + return set("partial_match_action", Conv.enumeration(DatabaseValidationValidateParams.PartialMatchAction::of), partialMatchAction); + } + + /** + * What a no_match does to database_validation.status. Defaults to DECLINE. + * + * @param noMatchAction the value + * @return this builder + */ + public Builder noMatchAction(DatabaseValidationValidateParams.NoMatchAction noMatchAction) { + return set("no_match_action", Conv.enumeration(DatabaseValidationValidateParams.NoMatchAction::of), noMatchAction); + } + + /** + * Persist the validation as a session (console visibility, decision endpoint, status.updated webhook). Also changes the validations response shape: per-service objects when true (default), a merged field map when false. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Your identifier for the validated user; echoed back and stored with the session. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Free-form JSON stored with the request and echoed back. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Selfie image (jpg, jpeg, png, webp; max 2 MB โ€” images are compressed to ~1.5 MB before upload to the registry) for biometric validation services, e.g. Argentina RENAPER (arg_renaper) and Panama SIB (pan_cedula_sib, pan_cedula_sib_plus). Required whenever a selected service lists it as a required field. Only available via multipart/form-data. + * + * @param selfie the value + * @return this builder + */ + public Builder selfie(FileUpload selfie) { + return setFile("selfie", selfie); + } + + /** + * Uploads the file at {@code path} as {@code selfie}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder selfie(Path path) { + return setFile("selfie", FileUpload.of(path)); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DatabaseValidationValidateParams} + * @throws IllegalStateException when a required field is missing + */ + public DatabaseValidationValidateParams build() { + require("issuing_state", false); + return new DatabaseValidationValidateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Type of document being validated: P passport, DL driver license, ID national ID, RP residence permit (plus SSC, HIC, WP, TC, VISA, PSC, BC, OTHER). Required by some services (e.g. ESP). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "P"}. */ + public static final DocumentType P = new DocumentType("P"); + + /** The value {@code "DL"}. */ + public static final DocumentType DL = new DocumentType("DL"); + + /** The value {@code "ID"}. */ + public static final DocumentType ID = new DocumentType("ID"); + + /** The value {@code "RP"}. */ + public static final DocumentType RP = new DocumentType("RP"); + + /** The value {@code "SSC"}. */ + public static final DocumentType SSC = new DocumentType("SSC"); + + /** The value {@code "HIC"}. */ + public static final DocumentType HIC = new DocumentType("HIC"); + + /** The value {@code "WP"}. */ + public static final DocumentType WP = new DocumentType("WP"); + + /** The value {@code "TC"}. */ + public static final DocumentType TC = new DocumentType("TC"); + + /** The value {@code "VISA"}. */ + public static final DocumentType VISA = new DocumentType("VISA"); + + /** The value {@code "PSC"}. */ + public static final DocumentType PSC = new DocumentType("PSC"); + + /** The value {@code "BC"}. */ + public static final DocumentType BC = new DocumentType("BC"); + + /** The value {@code "OTHER"}. */ + public static final DocumentType OTHER = new DocumentType("OTHER"); + + private static final List KNOWN_VALUES = List.of(P, DL, ID, RP, SSC, HIC, WP, TC, VISA, PSC, BC, OTHER); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Gender: M, F, or X (other/unknown). Required for Argentina's RENAPER validation (arg_renaper). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Gender extends StringEnum { + /** The value {@code "M"}. */ + public static final Gender M = new Gender("M"); + + /** The value {@code "F"}. */ + public static final Gender F = new Gender("F"); + + /** The value {@code "X"}. */ + public static final Gender X = new Gender("X"); + + private static final List KNOWN_VALUES = List.of(M, F, X); + + private Gender(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Gender of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Gender::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Residential address. Prefer the structured object {"street_1":"123 Main St","street_2":"Apt 4B","city":"Springfield","region":"IL","postal_code":"62701","country":"US"}; a complete single-line string is still accepted. Required by address-verification services; when a service defines address requirements, missing parts return 400 with address_fields_required_by. + * + *

One of: {@code Variant1}, {@code String}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ + public static final class Address extends JsonUnion { + private Address(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Address} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Address fromJson(JsonNode json) { + return new Address(json.deepCopy()); + } + + /** + * Wraps a {@code Variant1} value. + * + * @param value the value + * @return the union + */ + public static Address ofVariant1(DatabaseValidationValidateParams.Address.Variant1 value) { + return new Address(Conv.model(DatabaseValidationValidateParams.Address.Variant1::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant1}. + * + * @return true when it matches + */ + public boolean isVariant1() { + return Json.hasAnyField(json, "street_1", "street_2", "city", "region", "postal_code", "country"); + } + + /** + * Reads this value as a {@code Variant1}. + * + * @return the value, or empty when {@link #isVariant1()} is false + */ + public Optional asVariant1() { + return isVariant1() ? Optional.of(Conv.model(DatabaseValidationValidateParams.Address.Variant1::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code String} value. + * + * @param value the value + * @return the union + */ + public static Address ofString(String value) { + return new Address(Conv.STRING.write(value)); + } + + /** + * Whether this value is a {@code String}. + * + * Complete single-line address (legacy). + * + * @return true when it matches + */ + public boolean isString() { + return json.isTextual(); + } + + /** + * Reads this value as a {@code String}. + * + * @return the value, or empty when {@link #isString()} is false + */ + public Optional asString() { + return isString() ? Optional.of(Conv.STRING.read(json)) : Optional.empty(); + } + + public static final class Variant1 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("street_1", "street_2", "city", "region", "postal_code", "country"); + + private Variant1(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant1} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant1 fromJson(JsonNode json) { + return new Variant1(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * The region field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * The country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant1}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant1 from) { + super(from); + } + + /** + * The street_1 field. + * + * @param street1 the value + * @return this builder + */ + public Builder street1(String street1) { + return set("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value + * @return this builder + */ + public Builder street2(String street2) { + return set("street_2", Conv.STRING, street2); + } + + /** + * The city field. + * + * @param city the value + * @return this builder + */ + public Builder city(String city) { + return set("city", Conv.STRING, city); + } + + /** + * The region field. + * + * @param region the value + * @return this builder + */ + public Builder region(String region) { + return set("region", Conv.STRING, region); + } + + /** + * The postal_code field. + * + * @param postalCode the value + * @return this builder + */ + public Builder postalCode(String postalCode) { + return set("postal_code", Conv.STRING, postalCode); + } + + /** + * The country field. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant1} + */ + public Variant1 build() { + return new Variant1(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * What a partial_match does to database_validation.status. Defaults to NO_ACTION (status stays Approved, with a warning). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PartialMatchAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PartialMatchAction DECLINE = new PartialMatchAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PartialMatchAction NO_ACTION = new PartialMatchAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PartialMatchAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PartialMatchAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PartialMatchAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What a no_match does to database_validation.status. Defaults to DECLINE. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NoMatchAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final NoMatchAction DECLINE = new NoMatchAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final NoMatchAction NO_ACTION = new NoMatchAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private NoMatchAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NoMatchAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NoMatchAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/DatabaseValidationValidateResponse.java b/src/main/java/me/didit/types/DatabaseValidationValidateResponse.java new file mode 100644 index 0000000..58b1e11 --- /dev/null +++ b/src/main/java/me/didit/types/DatabaseValidationValidateResponse.java @@ -0,0 +1,1349 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class DatabaseValidationValidateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "database_validation", "vendor_data", "metadata", "created_at"); + + private DatabaseValidationValidateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DatabaseValidationValidateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DatabaseValidationValidateResponse fromJson(JsonNode json) { + return new DatabaseValidationValidateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The database_validation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional databaseValidation() { + return Json.optional(json, "database_validation", Conv.model(DatabaseValidationValidateResponse.DatabaseValidation::fromJson)); + } + + /** + * Echo of the vendor_data you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DatabaseValidationValidateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DatabaseValidationValidateResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The database_validation field. + * + * @param databaseValidation the value + * @return this builder + */ + public Builder databaseValidation(DatabaseValidationValidateResponse.DatabaseValidation databaseValidation) { + return set("database_validation", Conv.model(DatabaseValidationValidateResponse.DatabaseValidation::fromJson), databaseValidation); + } + + /** + * Echo of the vendor_data you sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DatabaseValidationValidateResponse} + */ + public DatabaseValidationValidateResponse build() { + return new DatabaseValidationValidateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class DatabaseValidation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "issuing_state", "validation_type", "screened_data", "match_type", "validations", "warnings", "errors", "services_used", "match_score"); + + private DatabaseValidation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DatabaseValidation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DatabaseValidation fromJson(JsonNode json) { + return new DatabaseValidation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Declined when the overall match_type triggers a DECLINE action (no_match_action defaults to DECLINE, partial_match_action to NO_ACTION); In Review when no service produced a usable comparison, for example when the only selected service came back REGISTRY_UNAVAILABLE or INCONCLUSIVE; Approved otherwise. A request that selected several services can be Approved on one service's match while another was unavailable, so check errors and the per-service outcome_codes too. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Status::of)); + } + + /** + * Echo of the ISO 3166-1 alpha-3 country validated against. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * Derived from the results: two_by_two when โ‰ฅ2 distinct services produced a full match (on the identification number, on full name + date of birth together, or on the address without contradictions); one_by_one otherwise. (The request field of the same name is deprecated and ignored.) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validationType() { + return Json.optional(json, "validation_type", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.ValidationType::of)); + } + + /** + * Echo of the input fields that were sent to the selected services (dates normalized to YYYY-MM-DD; a selfie, when sent, is returned as a pre-signed URL; consent_obtained: true is added when consent was given). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> screenedData() { + return Json.optional(json, "screened_data", Conv.OBJECT); + } + + /** + * Overall result aggregated across services with field-level comparisons: any full_match โ†’ full_match; else any partial_match โ†’ partial_match; else no_match. Outcome-only services, such as biometric criminal screening, can return null; inspect each item in validations for its outcome_code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchType() { + return Json.optional(json, "match_type", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.MatchType::of)); + } + + /** + * Shape depends on save_api_request. **true (default):** an array of per-service objects (service_id, service_name, validation, outcome_code, outcome_detail, source_data). **false:** a single flat object merging the field-level results of all services ({"full_name": "full_match", ...}). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validations() { + return Json.optional(json, "validations", Conv.union(DatabaseValidationValidateResponse.DatabaseValidation.Validations::fromJson)); + } + + /** + * DATABASE_VALIDATION_NO_MATCH or DATABASE_VALIDATION_PARTIAL_MATCH when applicable; empty on a full match. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(DatabaseValidationValidateResponse.DatabaseValidation.Warnings::fromJson))); + } + + /** + * Present only when some (but not all) selected services failed. Each entry carries service_id, code, message, and retryable. A service reported here is absent from validations and services_used, and is not billed. This array is the only place it appears, so inspect it even when status is Approved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> errors() { + return Json.optional(json, "errors", Conv.list(Conv.model(DatabaseValidationValidateResponse.DatabaseValidation.Errors::fromJson))); + } + + /** + * Catalog ids of the services that returned a billable result. **Only present when the request explicitly sent services.** + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> servicesUsed() { + return Json.optional(json, "services_used", Conv.list(Conv.STRING)); + } + + /** + * Fraction (0.0โ€“1.0) of attempted services that produced a full match (on the identification number, on full name + date of birth together, or on the address without contradictions). **Only present when the request explicitly sent services.** + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchScore() { + return Json.optional(json, "match_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DatabaseValidation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DatabaseValidation from) { + super(from); + } + + /** + * Declined when the overall match_type triggers a DECLINE action (no_match_action defaults to DECLINE, partial_match_action to NO_ACTION); In Review when no service produced a usable comparison, for example when the only selected service came back REGISTRY_UNAVAILABLE or INCONCLUSIVE; Approved otherwise. A request that selected several services can be Approved on one service's match while another was unavailable, so check errors and the per-service outcome_codes too. + * + * @param status the value + * @return this builder + */ + public Builder status(DatabaseValidationValidateResponse.DatabaseValidation.Status status) { + return set("status", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Status::of), status); + } + + /** + * Echo of the ISO 3166-1 alpha-3 country validated against. + * + * @param issuingState the value + * @return this builder + */ + public Builder issuingState(String issuingState) { + return set("issuing_state", Conv.STRING, issuingState); + } + + /** + * Derived from the results: two_by_two when โ‰ฅ2 distinct services produced a full match (on the identification number, on full name + date of birth together, or on the address without contradictions); one_by_one otherwise. (The request field of the same name is deprecated and ignored.) + * + * @param validationType the value + * @return this builder + */ + public Builder validationType(DatabaseValidationValidateResponse.DatabaseValidation.ValidationType validationType) { + return set("validation_type", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.ValidationType::of), validationType); + } + + /** + * Echo of the input fields that were sent to the selected services (dates normalized to YYYY-MM-DD; a selfie, when sent, is returned as a pre-signed URL; consent_obtained: true is added when consent was given). + * + * @param screenedData the value + * @return this builder + */ + public Builder screenedData(Map screenedData) { + return setAny("screened_data", screenedData); + } + + /** + * Overall result aggregated across services with field-level comparisons: any full_match โ†’ full_match; else any partial_match โ†’ partial_match; else no_match. Outcome-only services, such as biometric criminal screening, can return null; inspect each item in validations for its outcome_code. + * + * @param matchType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchType(DatabaseValidationValidateResponse.DatabaseValidation.@Nullable MatchType matchType) { + return setNullable("match_type", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.MatchType::of), matchType); + } + + /** + * Shape depends on save_api_request. **true (default):** an array of per-service objects (service_id, service_name, validation, outcome_code, outcome_detail, source_data). **false:** a single flat object merging the field-level results of all services ({"full_name": "full_match", ...}). + * + * @param validations the value + * @return this builder + */ + public Builder validations(DatabaseValidationValidateResponse.DatabaseValidation.Validations validations) { + return set("validations", Conv.union(DatabaseValidationValidateResponse.DatabaseValidation.Validations::fromJson), validations); + } + + /** + * DATABASE_VALIDATION_NO_MATCH or DATABASE_VALIDATION_PARTIAL_MATCH when applicable; empty on a full match. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(DatabaseValidationValidateResponse.DatabaseValidation.Warnings::fromJson)), warnings); + } + + /** + * Present only when some (but not all) selected services failed. Each entry carries service_id, code, message, and retryable. A service reported here is absent from validations and services_used, and is not billed. This array is the only place it appears, so inspect it even when status is Approved. + * + * @param errors the value + * @return this builder + */ + public Builder errors(List errors) { + return set("errors", Conv.list(Conv.model(DatabaseValidationValidateResponse.DatabaseValidation.Errors::fromJson)), errors); + } + + /** + * Catalog ids of the services that returned a billable result. **Only present when the request explicitly sent services.** + * + * @param servicesUsed the value + * @return this builder + */ + public Builder servicesUsed(List servicesUsed) { + return set("services_used", Conv.list(Conv.STRING), servicesUsed); + } + + /** + * Fraction (0.0โ€“1.0) of attempted services that produced a full match (on the identification number, on full name + date of birth together, or on the address without contradictions). **Only present when the request explicitly sent services.** + * + * @param matchScore the value + * @return this builder + */ + public Builder matchScore(double matchScore) { + return set("match_score", Conv.DOUBLE, matchScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DatabaseValidation} + */ + public DatabaseValidation build() { + return new DatabaseValidation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Declined when the overall match_type triggers a DECLINE action (no_match_action defaults to DECLINE, partial_match_action to NO_ACTION); In Review when no service produced a usable comparison, for example when the only selected service came back REGISTRY_UNAVAILABLE or INCONCLUSIVE; Approved otherwise. A request that selected several services can be Approved on one service's match while another was unavailable, so check errors and the per-service outcome_codes too. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Derived from the results: two_by_two when โ‰ฅ2 distinct services produced a full match (on the identification number, on full name + date of birth together, or on the address without contradictions); one_by_one otherwise. (The request field of the same name is deprecated and ignored.) + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ValidationType extends StringEnum { + /** The value {@code "one_by_one"}. */ + public static final ValidationType ONE_BY_ONE = new ValidationType("one_by_one"); + + /** The value {@code "two_by_two"}. */ + public static final ValidationType TWO_BY_TWO = new ValidationType("two_by_two"); + + private static final List KNOWN_VALUES = List.of(ONE_BY_ONE, TWO_BY_TWO); + + private ValidationType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ValidationType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ValidationType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Overall result aggregated across services with field-level comparisons: any full_match โ†’ full_match; else any partial_match โ†’ partial_match; else no_match. Outcome-only services, such as biometric criminal screening, can return null; inspect each item in validations for its outcome_code. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MatchType extends StringEnum { + /** The value {@code "full_match"}. */ + public static final MatchType FULL_MATCH = new MatchType("full_match"); + + /** The value {@code "partial_match"}. */ + public static final MatchType PARTIAL_MATCH = new MatchType("partial_match"); + + /** The value {@code "no_match"}. */ + public static final MatchType NO_MATCH = new MatchType("no_match"); + + private static final List KNOWN_VALUES = List.of(FULL_MATCH, PARTIAL_MATCH, NO_MATCH); + + private MatchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MatchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MatchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Shape depends on save_api_request. **true (default):** an array of per-service objects (service_id, service_name, validation, outcome_code, outcome_detail, source_data). **false:** a single flat object merging the field-level results of all services ({"full_name": "full_match", ...}). + * + *

One of: {@code List}, {@code Variant2}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ + public static final class Validations extends JsonUnion { + private Validations(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Validations} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Validations fromJson(JsonNode json) { + return new Validations(json.deepCopy()); + } + + /** + * Wraps a {@code List} value. + * + * @param value the value + * @return the union + */ + public static Validations ofList(List value) { + return new Validations(Conv.list(Conv.model(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue::fromJson)).write(value)); + } + + /** + * Whether this value is a {@code List}. + * + * @return true when it matches + */ + public boolean isList() { + return json.isArray(); + } + + /** + * Reads this value as a {@code List}. + * + * @return the value, or empty when {@link #isList()} is false + */ + public Optional> asList() { + return isList() ? Optional.of(Conv.list(Conv.model(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue::fromJson)).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static Validations ofVariant2(Map value) { + return new Validations(Conv.map(Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Validations.Variant2Value::of)).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * Merged field-level results (stateless save_api_request=false shape). + * + * @return true when it matches + */ + public boolean isVariant2() { + return json.isObject(); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional> asVariant2() { + return isVariant2() ? Optional.of(Conv.map(Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Validations.Variant2Value::of)).read(json)) : Optional.empty(); + } + + /** + * Per-service validation result (returned when save_api_request=true, the default). + */ + public static final class ListValue extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("service_id", "service_name", "validation", "outcome_code", "outcome_detail", "source_data"); + + private ListValue(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ListValue} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ListValue fromJson(JsonNode json) { + return new ListValue(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Catalog id of the service that produced this result (e.g. bra_cpf). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serviceId() { + return Json.optional(json, "service_id", Conv.STRING); + } + + /** + * Human-readable catalog name of the service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serviceName() { + return Json.optional(json, "service_name", Conv.STRING); + } + + /** + * Field-by-field comparison between your input and the registry record. Keys are canonical field names (full_name, date_of_birth, identification_number, address, โ€ฆ); values are full_match, partial_match, or no_match. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> validation() { + return Json.optional(json, "validation", Conv.map(Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue.ValidationValue::of))); + } + + /** + * Vendor-neutral outcome of the registry lookup. MATCH/PARTIAL_MATCH/NO_MATCH describe the comparison; DOCUMENT_NOT_FOUND means the identifier is not in the registry; INCONCLUSIVE means the registry could not confirm either way (routed to review โ€” NOT a no-match); BIOMETRIC_NO_MATCH is a definitive face mismatch while BIOMETRIC_IMAGE_UNUSABLE is a technical image problem (retake the selfie); DECEASED/MINOR_BLOCKED are registry-policy outcomes; DOCUMENT_SUPERSEDED means the identity matched but the edition of the document presented is not the one on file (a newer edition has been issued); INVALID_DOCUMENT_FORMAT/INVALID_INPUT mean the registry itself rejected the data it was sent; REGISTRY_UNAVAILABLE/REGISTRY_ERROR indicate upstream failures. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomeCode() { + return Json.optional(json, "outcome_code", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue.OutcomeCode::of)); + } + + /** + * Raw upstream status detail backing the outcome code (e.g. an HTTP or registry status code). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomeDetail() { + return Json.optional(json, "outcome_detail", Conv.STRING); + } + + /** + * Cleaned, normalized view of the registry record using canonical field names (identification_number, first_name, last_name, date_of_birth, plus registry-specific flags). Image fields, when present, are returned as pre-signed URLs. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sourceData() { + return Json.optional(json, "source_data", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ListValue}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ListValue from) { + super(from); + } + + /** + * Catalog id of the service that produced this result (e.g. bra_cpf). + * + * @param serviceId the value + * @return this builder + */ + public Builder serviceId(String serviceId) { + return set("service_id", Conv.STRING, serviceId); + } + + /** + * Human-readable catalog name of the service. + * + * @param serviceName the value + * @return this builder + */ + public Builder serviceName(String serviceName) { + return set("service_name", Conv.STRING, serviceName); + } + + /** + * Field-by-field comparison between your input and the registry record. Keys are canonical field names (full_name, date_of_birth, identification_number, address, โ€ฆ); values are full_match, partial_match, or no_match. + * + * @param validation the value + * @return this builder + */ + public Builder validation(Map validation) { + return set("validation", Conv.map(Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue.ValidationValue::of)), validation); + } + + /** + * Vendor-neutral outcome of the registry lookup. MATCH/PARTIAL_MATCH/NO_MATCH describe the comparison; DOCUMENT_NOT_FOUND means the identifier is not in the registry; INCONCLUSIVE means the registry could not confirm either way (routed to review โ€” NOT a no-match); BIOMETRIC_NO_MATCH is a definitive face mismatch while BIOMETRIC_IMAGE_UNUSABLE is a technical image problem (retake the selfie); DECEASED/MINOR_BLOCKED are registry-policy outcomes; DOCUMENT_SUPERSEDED means the identity matched but the edition of the document presented is not the one on file (a newer edition has been issued); INVALID_DOCUMENT_FORMAT/INVALID_INPUT mean the registry itself rejected the data it was sent; REGISTRY_UNAVAILABLE/REGISTRY_ERROR indicate upstream failures. + * + * @param outcomeCode the value + * @return this builder + */ + public Builder outcomeCode(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue.OutcomeCode outcomeCode) { + return set("outcome_code", Conv.enumeration(DatabaseValidationValidateResponse.DatabaseValidation.Validations.ListValue.OutcomeCode::of), outcomeCode); + } + + /** + * Raw upstream status detail backing the outcome code (e.g. an HTTP or registry status code). + * + * @param outcomeDetail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder outcomeDetail(@Nullable String outcomeDetail) { + return setNullable("outcome_detail", Conv.STRING, outcomeDetail); + } + + /** + * Cleaned, normalized view of the registry record using canonical field names (identification_number, first_name, last_name, date_of_birth, plus registry-specific flags). Image fields, when present, are returned as pre-signed URLs. + * + * @param sourceData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sourceData(@Nullable Map sourceData) { + return setAny("source_data", sourceData); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ListValue} + */ + public ListValue build() { + return new ListValue(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ValidationValue extends StringEnum { + /** The value {@code "full_match"}. */ + public static final ValidationValue FULL_MATCH = new ValidationValue("full_match"); + + /** The value {@code "partial_match"}. */ + public static final ValidationValue PARTIAL_MATCH = new ValidationValue("partial_match"); + + /** The value {@code "no_match"}. */ + public static final ValidationValue NO_MATCH = new ValidationValue("no_match"); + + private static final List KNOWN_VALUES = List.of(FULL_MATCH, PARTIAL_MATCH, NO_MATCH); + + private ValidationValue(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ValidationValue of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ValidationValue::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Vendor-neutral outcome of the registry lookup. MATCH/PARTIAL_MATCH/NO_MATCH describe the comparison; DOCUMENT_NOT_FOUND means the identifier is not in the registry; INCONCLUSIVE means the registry could not confirm either way (routed to review โ€” NOT a no-match); BIOMETRIC_NO_MATCH is a definitive face mismatch while BIOMETRIC_IMAGE_UNUSABLE is a technical image problem (retake the selfie); DECEASED/MINOR_BLOCKED are registry-policy outcomes; DOCUMENT_SUPERSEDED means the identity matched but the edition of the document presented is not the one on file (a newer edition has been issued); INVALID_DOCUMENT_FORMAT/INVALID_INPUT mean the registry itself rejected the data it was sent; REGISTRY_UNAVAILABLE/REGISTRY_ERROR indicate upstream failures. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class OutcomeCode extends StringEnum { + /** The value {@code "MATCH"}. */ + public static final OutcomeCode MATCH = new OutcomeCode("MATCH"); + + /** The value {@code "PARTIAL_MATCH"}. */ + public static final OutcomeCode PARTIAL_MATCH = new OutcomeCode("PARTIAL_MATCH"); + + /** The value {@code "NO_MATCH"}. */ + public static final OutcomeCode NO_MATCH = new OutcomeCode("NO_MATCH"); + + /** The value {@code "DOCUMENT_NOT_FOUND"}. */ + public static final OutcomeCode DOCUMENT_NOT_FOUND = new OutcomeCode("DOCUMENT_NOT_FOUND"); + + /** The value {@code "INVALID_DOCUMENT_FORMAT"}. */ + public static final OutcomeCode INVALID_DOCUMENT_FORMAT = new OutcomeCode("INVALID_DOCUMENT_FORMAT"); + + /** The value {@code "INVALID_INPUT"}. */ + public static final OutcomeCode INVALID_INPUT = new OutcomeCode("INVALID_INPUT"); + + /** The value {@code "MINOR_BLOCKED"}. */ + public static final OutcomeCode MINOR_BLOCKED = new OutcomeCode("MINOR_BLOCKED"); + + /** The value {@code "DECEASED"}. */ + public static final OutcomeCode DECEASED = new OutcomeCode("DECEASED"); + + /** The value {@code "BIOMETRIC_NO_MATCH"}. */ + public static final OutcomeCode BIOMETRIC_NO_MATCH = new OutcomeCode("BIOMETRIC_NO_MATCH"); + + /** The value {@code "BIOMETRIC_IMAGE_UNUSABLE"}. */ + public static final OutcomeCode BIOMETRIC_IMAGE_UNUSABLE = new OutcomeCode("BIOMETRIC_IMAGE_UNUSABLE"); + + /** The value {@code "INCONCLUSIVE"}. */ + public static final OutcomeCode INCONCLUSIVE = new OutcomeCode("INCONCLUSIVE"); + + /** The value {@code "DOCUMENT_SUPERSEDED"}. */ + public static final OutcomeCode DOCUMENT_SUPERSEDED = new OutcomeCode("DOCUMENT_SUPERSEDED"); + + /** The value {@code "REGISTRY_UNAVAILABLE"}. */ + public static final OutcomeCode REGISTRY_UNAVAILABLE = new OutcomeCode("REGISTRY_UNAVAILABLE"); + + /** The value {@code "REGISTRY_ERROR"}. */ + public static final OutcomeCode REGISTRY_ERROR = new OutcomeCode("REGISTRY_ERROR"); + + private static final List KNOWN_VALUES = List.of(MATCH, PARTIAL_MATCH, NO_MATCH, DOCUMENT_NOT_FOUND, INVALID_DOCUMENT_FORMAT, INVALID_INPUT, MINOR_BLOCKED, DECEASED, BIOMETRIC_NO_MATCH, BIOMETRIC_IMAGE_UNUSABLE, INCONCLUSIVE, DOCUMENT_SUPERSEDED, REGISTRY_UNAVAILABLE, REGISTRY_ERROR); + + private OutcomeCode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static OutcomeCode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, OutcomeCode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Variant2Value extends StringEnum { + /** The value {@code "full_match"}. */ + public static final Variant2Value FULL_MATCH = new Variant2Value("full_match"); + + /** The value {@code "partial_match"}. */ + public static final Variant2Value PARTIAL_MATCH = new Variant2Value("partial_match"); + + /** The value {@code "no_match"}. */ + public static final Variant2Value NO_MATCH = new Variant2Value("no_match"); + + private static final List KNOWN_VALUES = List.of(FULL_MATCH, PARTIAL_MATCH, NO_MATCH); + + private Variant2Value(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Variant2Value of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Variant2Value::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature that raised the warning. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Machine-readable risk identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Extra context for the warning, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * warning, information, or error โ€” how the risk affected the outcome. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * One-line human-readable summary. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Full human-readable explanation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Feature that raised the warning. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Machine-readable risk identifier. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Extra context for the warning, when available. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * warning, information, or error โ€” how the risk affected the outcome. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * One-line human-readable summary. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Full human-readable explanation. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Errors extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("service_id", "code", "message", "retryable"); + + private Errors(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Errors} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Errors fromJson(JsonNode json) { + return new Errors(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The service_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serviceId() { + return Json.optional(json, "service_id", Conv.STRING); + } + + /** + * The code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional code() { + return Json.optional(json, "code", Conv.STRING); + } + + /** + * The message field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + /** + * true when the service produced no answer and retrying it later can succeed; false when the source refused the data it was sent and the input must be corrected first. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retryable() { + return Json.optional(json, "retryable", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Errors}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Errors from) { + super(from); + } + + /** + * The service_id field. + * + * @param serviceId the value + * @return this builder + */ + public Builder serviceId(String serviceId) { + return set("service_id", Conv.STRING, serviceId); + } + + /** + * The code field. + * + * @param code the value + * @return this builder + */ + public Builder code(String code) { + return set("code", Conv.STRING, code); + } + + /** + * The message field. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * true when the service produced no answer and retrying it later can succeed; false when the source refused the data it was sent and the input must be corrected first. + * + * @param retryable the value + * @return this builder + */ + public Builder retryable(boolean retryable) { + return set("retryable", Conv.BOOLEAN, retryable); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Errors} + */ + public Errors build() { + return new Errors(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..cd46fca --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - ISL - ISL + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "ISL"}. */ + public static final DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum ISL = new DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum("ISL"); + + private static final List KNOWN_VALUES = List.of(ISL); + + private DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiAudkenniWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiAudkenniWalletVerificationStartRequest.java new file mode 100644 index 0000000..0209b53 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiAudkenniWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Auรฐkenni verification (ISL). */ +public final class DigitalIdWalletApiAudkenniWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiAudkenniWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiAudkenniWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiAudkenniWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiAudkenniWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Auรฐkenni identity. Defaults to ISL, the only country it serves. + * + *

- ISL - ISL + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiAudkenniWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiAudkenniWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Auรฐkenni identity. Defaults to ISL, the only country it serves. + * + *

- ISL - ISL + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiAudkenniWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiAudkenniWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiAudkenniWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiBankidCzWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiBankidCzWalletVerificationStartRequest.java new file mode 100644 index 0000000..18dfcff --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiBankidCzWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Bank iD verification (CZE). */ +public final class DigitalIdWalletApiBankidCzWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiBankidCzWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiBankidCzWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiBankidCzWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiBankidCzWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Bank iD identity. Defaults to CZE, the only country it serves. + * + *

- CZE - CZE + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryE2dEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiBankidCzWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiBankidCzWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Bank iD identity. Defaults to CZE, the only country it serves. + * + *

- CZE - CZE + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryE2dEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryE2dEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiBankidCzWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiBankidCzWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiBankidCzWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiBankidNoWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiBankidNoWalletVerificationStartRequest.java new file mode 100644 index 0000000..322448a --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiBankidNoWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a BankID verification (NOR). */ +public final class DigitalIdWalletApiBankidNoWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiBankidNoWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiBankidNoWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiBankidNoWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiBankidNoWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the BankID identity. Defaults to NOR, the only country it serves. + * + *

- NOR - NOR + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryAfcEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiBankidNoWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiBankidNoWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the BankID identity. Defaults to NOR, the only country it serves. + * + *

- NOR - NOR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryAfcEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryAfcEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiBankidNoWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiBankidNoWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiBankidNoWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiBankidSeWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiBankidSeWalletVerificationStartRequest.java new file mode 100644 index 0000000..2bc260f --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiBankidSeWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a BankID verification (SWE). */ +public final class DigitalIdWalletApiBankidSeWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiBankidSeWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiBankidSeWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiBankidSeWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiBankidSeWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the BankID identity. Defaults to SWE, the only country it serves. + * + *

- SWE - SWE + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryEe9Enum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiBankidSeWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiBankidSeWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the BankID identity. Defaults to SWE, the only country it serves. + * + *

- SWE - SWE + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryEe9Enum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryEe9Enum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiBankidSeWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiBankidSeWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiBankidSeWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiBuypassWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiBuypassWalletVerificationStartRequest.java new file mode 100644 index 0000000..c5e7e5c --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiBuypassWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Buypass ID verification (NOR). */ +public final class DigitalIdWalletApiBuypassWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiBuypassWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiBuypassWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiBuypassWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiBuypassWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Buypass ID identity. Defaults to NOR, the only country it serves. + * + *

- NOR - NOR + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryAfcEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiBuypassWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiBuypassWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Buypass ID identity. Defaults to NOR, the only country it serves. + * + *

- NOR - NOR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryAfcEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryAfcEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiBuypassWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiBuypassWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiBuypassWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiClientCredentialsForbiddenErrorMessage.java b/src/main/java/me/didit/types/DigitalIdWalletApiClientCredentialsForbiddenErrorMessage.java new file mode 100644 index 0000000..173f80a --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiClientCredentialsForbiddenErrorMessage.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class DigitalIdWalletApiClientCredentialsForbiddenErrorMessage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private DigitalIdWalletApiClientCredentialsForbiddenErrorMessage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiClientCredentialsForbiddenErrorMessage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiClientCredentialsForbiddenErrorMessage fromJson(JsonNode json) { + return new DigitalIdWalletApiClientCredentialsForbiddenErrorMessage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiClientCredentialsForbiddenErrorMessage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiClientCredentialsForbiddenErrorMessage from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiClientCredentialsForbiddenErrorMessage} + */ + public DigitalIdWalletApiClientCredentialsForbiddenErrorMessage build() { + return new DigitalIdWalletApiClientCredentialsForbiddenErrorMessage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..8da08c9 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - AUS - AUS + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "AUS"}. */ + public static final DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum AUS = new DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum("AUS"); + + private static final List KNOWN_VALUES = List.of(AUS); + + private DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiConnectidWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiConnectidWalletVerificationStartRequest.java new file mode 100644 index 0000000..586ecda --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiConnectidWalletVerificationStartRequest.java @@ -0,0 +1,232 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a ConnectID verification (AUS). */ +public final class DigitalIdWalletApiConnectidWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "authorisation_server_id", "return_url", "device"); + + private DigitalIdWalletApiConnectidWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiConnectidWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiConnectidWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiConnectidWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the ConnectID identity. Defaults to AUS, the only country it serves. + * + *

- AUS - AUS + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum::of)); + } + + /** + * Authorisation server ID selected with ConnectID's bank selector. Sandbox defaults to Mock Bank A. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional authorisationServerId() { + return Json.optional(json, "authorisation_server_id", Conv.STRING); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiConnectidWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiConnectidWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the ConnectID identity. Defaults to AUS, the only country it serves. + * + *

- AUS - AUS + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum::of), country); + } + + /** + * Authorisation server ID selected with ConnectID's bank selector. Sandbox defaults to Mock Bank A. + * + * @param authorisationServerId the value + * @return this builder + */ + public Builder authorisationServerId(String authorisationServerId) { + return set("authorisation_server_id", Conv.STRING, authorisationServerId); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiConnectidWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiConnectidWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiConnectidWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiCountry520Enum.java b/src/main/java/me/didit/types/DigitalIdWalletApiCountry520Enum.java new file mode 100644 index 0000000..38793f9 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiCountry520Enum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - GBR - GBR + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiCountry520Enum extends StringEnum { + /** The value {@code "GBR"}. */ + public static final DigitalIdWalletApiCountry520Enum GBR = new DigitalIdWalletApiCountry520Enum("GBR"); + + private static final List KNOWN_VALUES = List.of(GBR); + + private DigitalIdWalletApiCountry520Enum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiCountry520Enum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiCountry520Enum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiCountryAfcEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiCountryAfcEnum.java new file mode 100644 index 0000000..5106180 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiCountryAfcEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - NOR - NOR + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiCountryAfcEnum extends StringEnum { + /** The value {@code "NOR"}. */ + public static final DigitalIdWalletApiCountryAfcEnum NOR = new DigitalIdWalletApiCountryAfcEnum("NOR"); + + private static final List KNOWN_VALUES = List.of(NOR); + + private DigitalIdWalletApiCountryAfcEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiCountryAfcEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiCountryAfcEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiCountryE2dEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiCountryE2dEnum.java new file mode 100644 index 0000000..c6c215e --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiCountryE2dEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - CZE - CZE + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiCountryE2dEnum extends StringEnum { + /** The value {@code "CZE"}. */ + public static final DigitalIdWalletApiCountryE2dEnum CZE = new DigitalIdWalletApiCountryE2dEnum("CZE"); + + private static final List KNOWN_VALUES = List.of(CZE); + + private DigitalIdWalletApiCountryE2dEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiCountryE2dEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiCountryE2dEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiCountryEe9Enum.java b/src/main/java/me/didit/types/DigitalIdWalletApiCountryEe9Enum.java new file mode 100644 index 0000000..564f4c9 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiCountryEe9Enum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - SWE - SWE + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiCountryEe9Enum extends StringEnum { + /** The value {@code "SWE"}. */ + public static final DigitalIdWalletApiCountryEe9Enum SWE = new DigitalIdWalletApiCountryEe9Enum("SWE"); + + private static final List KNOWN_VALUES = List.of(SWE); + + private DigitalIdWalletApiCountryEe9Enum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiCountryEe9Enum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiCountryEe9Enum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiDeviceEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiDeviceEnum.java new file mode 100644 index 0000000..57334de --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiDeviceEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - same_device - same_device + * - cross_device - cross_device + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiDeviceEnum extends StringEnum { + /** The value {@code "same_device"}. */ + public static final DigitalIdWalletApiDeviceEnum SAME_DEVICE = new DigitalIdWalletApiDeviceEnum("same_device"); + + /** The value {@code "cross_device"}. */ + public static final DigitalIdWalletApiDeviceEnum CROSS_DEVICE = new DigitalIdWalletApiDeviceEnum("cross_device"); + + private static final List KNOWN_VALUES = List.of(SAME_DEVICE, CROSS_DEVICE); + + private DigitalIdWalletApiDeviceEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiDeviceEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiDeviceEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..a998f36 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - UKR - UKR + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "UKR"}. */ + public static final DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum UKR = new DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum("UKR"); + + private static final List KNOWN_VALUES = List.of(UKR); + + private DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiDiiaWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiDiiaWalletVerificationStartRequest.java new file mode 100644 index 0000000..c96c6e7 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiDiiaWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Diia verification (UKR). */ +public final class DigitalIdWalletApiDiiaWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiDiiaWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiDiiaWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiDiiaWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiDiiaWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Diia identity. Defaults to UKR, the only country it serves. + * + *

- UKR - UKR + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiDiiaWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiDiiaWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Diia identity. Defaults to UKR, the only country it serves. + * + *

- UKR - UKR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiDiiaWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiDiiaWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiDiiaWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..9455b06 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - LVA - LVA + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "LVA"}. */ + public static final DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum LVA = new DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum("LVA"); + + private static final List KNOWN_VALUES = List.of(LVA); + + private DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest.java new file mode 100644 index 0000000..27b624a --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a eParaksts mobile verification (LVA). */ +public final class DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the eParaksts mobile identity. Defaults to LVA, the only country it serves. + * + *

- LVA - LVA + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the eParaksts mobile identity. Defaults to LVA, the only country it serves. + * + *

- LVA - LVA + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiEudiWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiEudiWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..dbcf85f --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiEudiWalletVerificationStartCountryEnum.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - AUT - AUT + * - BEL - BEL + * - BGR - BGR + * - HRV - HRV + * - CYP - CYP + * - CZE - CZE + * - DNK - DNK + * - EST - EST + * - FIN - FIN + * - FRA - FRA + * - DEU - DEU + * - GRC - GRC + * - HUN - HUN + * - IRL - IRL + * - ITA - ITA + * - LVA - LVA + * - LTU - LTU + * - LUX - LUX + * - MLT - MLT + * - NLD - NLD + * - POL - POL + * - PRT - PRT + * - ROU - ROU + * - SVK - SVK + * - SVN - SVN + * - ESP - ESP + * - SWE - SWE + * - ISL - ISL + * - LIE - LIE + * - NOR - NOR + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiEudiWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "AUT"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum AUT = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("AUT"); + + /** The value {@code "BEL"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum BEL = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("BEL"); + + /** The value {@code "BGR"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum BGR = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("BGR"); + + /** The value {@code "HRV"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum HRV = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("HRV"); + + /** The value {@code "CYP"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum CYP = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("CYP"); + + /** The value {@code "CZE"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum CZE = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("CZE"); + + /** The value {@code "DNK"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum DNK = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("DNK"); + + /** The value {@code "EST"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum EST = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("EST"); + + /** The value {@code "FIN"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum FIN = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("FIN"); + + /** The value {@code "FRA"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum FRA = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("FRA"); + + /** The value {@code "DEU"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum DEU = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("DEU"); + + /** The value {@code "GRC"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum GRC = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("GRC"); + + /** The value {@code "HUN"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum HUN = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("HUN"); + + /** The value {@code "IRL"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum IRL = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("IRL"); + + /** The value {@code "ITA"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum ITA = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("ITA"); + + /** The value {@code "LVA"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum LVA = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("LVA"); + + /** The value {@code "LTU"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum LTU = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("LTU"); + + /** The value {@code "LUX"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum LUX = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("LUX"); + + /** The value {@code "MLT"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum MLT = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("MLT"); + + /** The value {@code "NLD"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum NLD = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("NLD"); + + /** The value {@code "POL"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum POL = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("POL"); + + /** The value {@code "PRT"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum PRT = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("PRT"); + + /** The value {@code "ROU"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum ROU = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("ROU"); + + /** The value {@code "SVK"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum SVK = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("SVK"); + + /** The value {@code "SVN"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum SVN = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("SVN"); + + /** The value {@code "ESP"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum ESP = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("ESP"); + + /** The value {@code "SWE"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum SWE = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("SWE"); + + /** The value {@code "ISL"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum ISL = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("ISL"); + + /** The value {@code "LIE"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum LIE = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("LIE"); + + /** The value {@code "NOR"}. */ + public static final DigitalIdWalletApiEudiWalletVerificationStartCountryEnum NOR = new DigitalIdWalletApiEudiWalletVerificationStartCountryEnum("NOR"); + + private static final List KNOWN_VALUES = List.of(AUT, BEL, BGR, HRV, CYP, CZE, DNK, EST, FIN, FRA, DEU, GRC, HUN, IRL, ITA, LVA, LTU, LUX, MLT, NLD, POL, PRT, ROU, SVK, SVN, ESP, SWE, ISL, LIE, NOR); + + private DigitalIdWalletApiEudiWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiEudiWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiEudiWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiEudiWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiEudiWalletVerificationStartRequest.java new file mode 100644 index 0000000..a2fb745 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiEudiWalletVerificationStartRequest.java @@ -0,0 +1,273 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Start a EUDI Wallet verification (AUT, BEL, BGR, HRV, CYP, CZE, DNK, EST, FIN, FRA, DEU, GRC, HUN, IRL, ITA, LVA, LTU, LUX, MLT, NLD, POL, PRT, ROU, SVK, SVN, ESP, SWE, ISL, LIE, NOR). + */ +public final class DigitalIdWalletApiEudiWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiEudiWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiEudiWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiEudiWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiEudiWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the EUDI Wallet identity. + * + *

- AUT - AUT + * - BEL - BEL + * - BGR - BGR + * - HRV - HRV + * - CYP - CYP + * - CZE - CZE + * - DNK - DNK + * - EST - EST + * - FIN - FIN + * - FRA - FRA + * - DEU - DEU + * - GRC - GRC + * - HUN - HUN + * - IRL - IRL + * - ITA - ITA + * - LVA - LVA + * - LTU - LTU + * - LUX - LUX + * - MLT - MLT + * - NLD - NLD + * - POL - POL + * - PRT - PRT + * - ROU - ROU + * - SVK - SVK + * - SVN - SVN + * - ESP - ESP + * - SWE - SWE + * - ISL - ISL + * - LIE - LIE + * - NOR - NOR + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiEudiWalletVerificationStartCountryEnum country() { + return Json.required(json, "country", Conv.enumeration(DigitalIdWalletApiEudiWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiEudiWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiEudiWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the EUDI Wallet identity. + * + *

- AUT - AUT + * - BEL - BEL + * - BGR - BGR + * - HRV - HRV + * - CYP - CYP + * - CZE - CZE + * - DNK - DNK + * - EST - EST + * - FIN - FIN + * - FRA - FRA + * - DEU - DEU + * - GRC - GRC + * - HUN - HUN + * - IRL - IRL + * - ITA - ITA + * - LVA - LVA + * - LTU - LTU + * - LUX - LUX + * - MLT - MLT + * - NLD - NLD + * - POL - POL + * - PRT - PRT + * - ROU - ROU + * - SVK - SVK + * - SVN - SVN + * - ESP - ESP + * - SWE - SWE + * - ISL - ISL + * - LIE - LIE + * - NOR - NOR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiEudiWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiEudiWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiEudiWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiEudiWalletVerificationStartRequest build() { + require("country", false); + require("return_url", false); + return new DigitalIdWalletApiEudiWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..39ae284 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - FRA - FRA + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "FRA"}. */ + public static final DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum FRA = new DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum("FRA"); + + private static final List KNOWN_VALUES = List.of(FRA); + + private DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiFranceconnectWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiFranceconnectWalletVerificationStartRequest.java new file mode 100644 index 0000000..2e37f99 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiFranceconnectWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a FranceConnect verification (FRA). */ +public final class DigitalIdWalletApiFranceconnectWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiFranceconnectWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiFranceconnectWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiFranceconnectWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiFranceconnectWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the FranceConnect identity. Defaults to FRA, the only country it serves. + * + *

- FRA - FRA + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiFranceconnectWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiFranceconnectWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the FranceConnect identity. Defaults to FRA, the only country it serves. + * + *

- FRA - FRA + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiFranceconnectWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiFranceconnectWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiFranceconnectWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiFrejaidWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiFrejaidWalletVerificationStartRequest.java new file mode 100644 index 0000000..0018cf0 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiFrejaidWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Freja eID verification (SWE). */ +public final class DigitalIdWalletApiFrejaidWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiFrejaidWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiFrejaidWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiFrejaidWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiFrejaidWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Freja eID identity. Defaults to SWE, the only country it serves. + * + *

- SWE - SWE + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryEe9Enum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiFrejaidWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiFrejaidWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Freja eID identity. Defaults to SWE, the only country it serves. + * + *

- SWE - SWE + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryEe9Enum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryEe9Enum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiFrejaidWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiFrejaidWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiFrejaidWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiFtnWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiFtnWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..b7ec5e0 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiFtnWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - FIN - FIN + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiFtnWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "FIN"}. */ + public static final DigitalIdWalletApiFtnWalletVerificationStartCountryEnum FIN = new DigitalIdWalletApiFtnWalletVerificationStartCountryEnum("FIN"); + + private static final List KNOWN_VALUES = List.of(FIN); + + private DigitalIdWalletApiFtnWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiFtnWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiFtnWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiFtnWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiFtnWalletVerificationStartRequest.java new file mode 100644 index 0000000..2b050ea --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiFtnWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Finnish Trust Network verification (FIN). */ +public final class DigitalIdWalletApiFtnWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiFtnWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiFtnWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiFtnWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiFtnWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Finnish Trust Network identity. Defaults to FIN, the only country it serves. + * + *

- FIN - FIN + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiFtnWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiFtnWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiFtnWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Finnish Trust Network identity. Defaults to FIN, the only country it serves. + * + *

- FIN - FIN + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiFtnWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiFtnWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiFtnWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiFtnWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiFtnWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..852a475 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - BRA - BRA + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "BRA"}. */ + public static final DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum BRA = new DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum("BRA"); + + private static final List KNOWN_VALUES = List.of(BRA); + + private DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiGovbrWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiGovbrWalletVerificationStartRequest.java new file mode 100644 index 0000000..eef587e --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiGovbrWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a gov.br verification (BRA). */ +public final class DigitalIdWalletApiGovbrWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiGovbrWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiGovbrWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiGovbrWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiGovbrWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the gov.br identity. Defaults to BRA, the only country it serves. + * + *

- BRA - BRA + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiGovbrWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiGovbrWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the gov.br identity. Defaults to BRA, the only country it serves. + * + *

- BRA - BRA + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiGovbrWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiGovbrWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiGovbrWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiGovukWalletWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiGovukWalletWalletVerificationStartRequest.java new file mode 100644 index 0000000..16adef5 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiGovukWalletWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a GOV.UK Wallet verification (GBR). */ +public final class DigitalIdWalletApiGovukWalletWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiGovukWalletWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiGovukWalletWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiGovukWalletWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiGovukWalletWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the GOV.UK Wallet identity. Defaults to GBR, the only country it serves. + * + *

- GBR - GBR + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountry520Enum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiGovukWalletWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiGovukWalletWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the GOV.UK Wallet identity. Defaults to GBR, the only country it serves. + * + *

- GBR - GBR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountry520Enum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountry520Enum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiGovukWalletWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiGovukWalletWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiGovukWalletWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..093a721 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - EST - EST + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "EST"}. */ + public static final DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum EST = new DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum("EST"); + + private static final List KNOWN_VALUES = List.of(EST); + + private DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiIdcardEeWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiIdcardEeWalletVerificationStartRequest.java new file mode 100644 index 0000000..9bddb25 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiIdcardEeWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Estonian ID-card verification (EST). */ +public final class DigitalIdWalletApiIdcardEeWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiIdcardEeWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiIdcardEeWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiIdcardEeWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiIdcardEeWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Estonian ID-card identity. Defaults to EST, the only country it serves. + * + *

- EST - EST + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiIdcardEeWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiIdcardEeWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Estonian ID-card identity. Defaults to EST, the only country it serves. + * + *

- EST - EST + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiIdcardEeWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiIdcardEeWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiIdcardEeWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiIdinWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiIdinWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..9f55766 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiIdinWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - NLD - NLD + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiIdinWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "NLD"}. */ + public static final DigitalIdWalletApiIdinWalletVerificationStartCountryEnum NLD = new DigitalIdWalletApiIdinWalletVerificationStartCountryEnum("NLD"); + + private static final List KNOWN_VALUES = List.of(NLD); + + private DigitalIdWalletApiIdinWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiIdinWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiIdinWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiIdinWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiIdinWalletVerificationStartRequest.java new file mode 100644 index 0000000..5d86b61 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiIdinWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a iDIN verification (NLD). */ +public final class DigitalIdWalletApiIdinWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiIdinWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiIdinWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiIdinWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiIdinWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the iDIN identity. Defaults to NLD, the only country it serves. + * + *

- NLD - NLD + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiIdinWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiIdinWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiIdinWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the iDIN identity. Defaults to NLD, the only country it serves. + * + *

- NLD - NLD + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiIdinWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiIdinWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiIdinWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiIdinWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiIdinWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiInteractionEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiInteractionEnum.java new file mode 100644 index 0000000..88ae900 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiInteractionEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - redirect - redirect + * - in_app - in_app + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiInteractionEnum extends StringEnum { + /** The value {@code "redirect"}. */ + public static final DigitalIdWalletApiInteractionEnum REDIRECT = new DigitalIdWalletApiInteractionEnum("redirect"); + + /** The value {@code "in_app"}. */ + public static final DigitalIdWalletApiInteractionEnum IN_APP = new DigitalIdWalletApiInteractionEnum("in_app"); + + private static final List KNOWN_VALUES = List.of(REDIRECT, IN_APP); + + private DigitalIdWalletApiInteractionEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiInteractionEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiInteractionEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..4f37aff --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - BEL - BEL + * - LUX - LUX + * - NLD - NLD + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "BEL"}. */ + public static final DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum BEL = new DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum("BEL"); + + /** The value {@code "LUX"}. */ + public static final DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum LUX = new DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum("LUX"); + + /** The value {@code "NLD"}. */ + public static final DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum NLD = new DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum("NLD"); + + private static final List KNOWN_VALUES = List.of(BEL, LUX, NLD); + + private DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiItsmeWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiItsmeWalletVerificationStartRequest.java new file mode 100644 index 0000000..990a486 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiItsmeWalletVerificationStartRequest.java @@ -0,0 +1,217 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a itsme verification (BEL, LUX, NLD). */ +public final class DigitalIdWalletApiItsmeWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiItsmeWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiItsmeWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiItsmeWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiItsmeWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the itsme identity. + * + *

- BEL - BEL + * - LUX - LUX + * - NLD - NLD + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum country() { + return Json.required(json, "country", Conv.enumeration(DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiItsmeWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiItsmeWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the itsme identity. + * + *

- BEL - BEL + * - LUX - LUX + * - NLD - NLD + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiItsmeWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiItsmeWalletVerificationStartRequest build() { + require("country", false); + require("return_url", false); + return new DigitalIdWalletApiItsmeWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiMitidWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiMitidWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..41f8e4d --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiMitidWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - DNK - DNK + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiMitidWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "DNK"}. */ + public static final DigitalIdWalletApiMitidWalletVerificationStartCountryEnum DNK = new DigitalIdWalletApiMitidWalletVerificationStartCountryEnum("DNK"); + + private static final List KNOWN_VALUES = List.of(DNK); + + private DigitalIdWalletApiMitidWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiMitidWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiMitidWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiMitidWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiMitidWalletVerificationStartRequest.java new file mode 100644 index 0000000..ef37dc6 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiMitidWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a MitID verification (DNK). */ +public final class DigitalIdWalletApiMitidWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiMitidWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiMitidWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiMitidWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiMitidWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the MitID identity. Defaults to DNK, the only country it serves. + * + *

- DNK - DNK + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiMitidWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiMitidWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiMitidWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the MitID identity. Defaults to DNK, the only country it serves. + * + *

- DNK - DNK + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiMitidWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiMitidWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiMitidWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiMitidWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiMitidWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..e41fb8f --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - EST - EST + * - LTU - LTU + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "EST"}. */ + public static final DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum EST = new DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum("EST"); + + /** The value {@code "LTU"}. */ + public static final DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum LTU = new DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum("LTU"); + + private static final List KNOWN_VALUES = List.of(EST, LTU); + + private DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiMobileIdWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiMobileIdWalletVerificationStartRequest.java new file mode 100644 index 0000000..1996faa --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiMobileIdWalletVerificationStartRequest.java @@ -0,0 +1,210 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Mobile-ID verification (EST, LTU). */ +public final class DigitalIdWalletApiMobileIdWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "personal_code", "phone_number"); + + private DigitalIdWalletApiMobileIdWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiMobileIdWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiMobileIdWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiMobileIdWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Mobile-ID identity. + * + *

- EST - EST + * - LTU - LTU + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum country() { + return Json.required(json, "country", Conv.enumeration(DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum::of)); + } + + /** + * The user's national personal identification code. It addresses the user's Mobile-ID app; the user confirms the comparison code and enters their PIN in the app. Never collect the PIN. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String personalCode() { + return Json.required(json, "personal_code", Conv.STRING); + } + + /** + * The Mobile-ID phone number in E.164 format (+372... or +370...). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String phoneNumber() { + return Json.required(json, "phone_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiMobileIdWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiMobileIdWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Mobile-ID identity. + * + *

- EST - EST + * - LTU - LTU + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum::of), country); + } + + /** + * The user's national personal identification code. It addresses the user's Mobile-ID app; the user confirms the comparison code and enters their PIN in the app. Never collect the PIN. + * + * @param personalCode the value + * @return this builder + */ + public Builder personalCode(String personalCode) { + return set("personal_code", Conv.STRING, personalCode); + } + + /** + * The Mobile-ID phone number in E.164 format (+372... or +370...). + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiMobileIdWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiMobileIdWalletVerificationStartRequest build() { + require("country", false); + require("personal_code", false); + require("phone_number", false); + return new DigitalIdWalletApiMobileIdWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiMojeidWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiMojeidWalletVerificationStartRequest.java new file mode 100644 index 0000000..1d5b1ca --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiMojeidWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a MojeID verification (CZE). */ +public final class DigitalIdWalletApiMojeidWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiMojeidWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiMojeidWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiMojeidWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiMojeidWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the MojeID identity. Defaults to CZE, the only country it serves. + * + *

- CZE - CZE + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryE2dEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiMojeidWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiMojeidWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the MojeID identity. Defaults to CZE, the only country it serves. + * + *

- CZE - CZE + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryE2dEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryE2dEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiMojeidWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiMojeidWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiMojeidWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiOneidWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiOneidWalletVerificationStartRequest.java new file mode 100644 index 0000000..4183ba0 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiOneidWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a OneID verification (GBR). */ +public final class DigitalIdWalletApiOneidWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiOneidWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiOneidWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiOneidWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiOneidWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the OneID identity. Defaults to GBR, the only country it serves. + * + *

- GBR - GBR + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountry520Enum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiOneidWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiOneidWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the OneID identity. Defaults to GBR, the only country it serves. + * + *

- GBR - GBR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountry520Enum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountry520Enum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiOneidWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiOneidWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiOneidWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..63205f5 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - DEU - DEU + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "DEU"}. */ + public static final DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum DEU = new DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum("DEU"); + + private static final List KNOWN_VALUES = List.of(DEU); + + private DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest.java new file mode 100644 index 0000000..85bc668 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Personalausweis verification (DEU). */ +public final class DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Personalausweis identity. Defaults to DEU, the only country it serves. + * + *

- DEU - DEU + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Personalausweis identity. Defaults to DEU, the only country it serves. + * + *

- DEU - DEU + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..88635f7 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - EST - EST + * - LVA - LVA + * - LTU - LTU + * - BEL - BEL + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "EST"}. */ + public static final DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum EST = new DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum("EST"); + + /** The value {@code "LVA"}. */ + public static final DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum LVA = new DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum("LVA"); + + /** The value {@code "LTU"}. */ + public static final DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum LTU = new DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum("LTU"); + + /** The value {@code "BEL"}. */ + public static final DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum BEL = new DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum("BEL"); + + private static final List KNOWN_VALUES = List.of(EST, LVA, LTU, BEL); + + private DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiSmartIdWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiSmartIdWalletVerificationStartRequest.java new file mode 100644 index 0000000..54f98b6 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiSmartIdWalletVerificationStartRequest.java @@ -0,0 +1,193 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Smart-ID verification (EST, LVA, LTU, BEL). */ +public final class DigitalIdWalletApiSmartIdWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "personal_code"); + + private DigitalIdWalletApiSmartIdWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiSmartIdWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiSmartIdWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiSmartIdWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Smart-ID identity. + * + *

- EST - EST + * - LVA - LVA + * - LTU - LTU + * - BEL - BEL + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum country() { + return Json.required(json, "country", Conv.enumeration(DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum::of)); + } + + /** + * The user's national personal identification code. It addresses the user's Smart-ID app; the user confirms the comparison code and enters their PIN in the app. Never collect the PIN. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String personalCode() { + return Json.required(json, "personal_code", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiSmartIdWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiSmartIdWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Smart-ID identity. + * + *

- EST - EST + * - LVA - LVA + * - LTU - LTU + * - BEL - BEL + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum::of), country); + } + + /** + * The user's national personal identification code. It addresses the user's Smart-ID app; the user confirms the comparison code and enters their PIN in the app. Never collect the PIN. + * + * @param personalCode the value + * @return this builder + */ + public Builder personalCode(String personalCode) { + return set("personal_code", Conv.STRING, personalCode); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiSmartIdWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiSmartIdWalletVerificationStartRequest build() { + require("country", false); + require("personal_code", false); + return new DigitalIdWalletApiSmartIdWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum.java new file mode 100644 index 0000000..3732258 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - ARE - ARE + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum extends StringEnum { + /** The value {@code "ARE"}. */ + public static final DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum ARE = new DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum("ARE"); + + private static final List KNOWN_VALUES = List.of(ARE); + + private DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiUaePassWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiUaePassWalletVerificationStartRequest.java new file mode 100644 index 0000000..4768572 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiUaePassWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a UAE PASS verification (ARE). */ +public final class DigitalIdWalletApiUaePassWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiUaePassWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiUaePassWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiUaePassWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiUaePassWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the UAE PASS identity. Defaults to ARE, the only country it serves. + * + *

- ARE - ARE + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiUaePassWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiUaePassWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the UAE PASS identity. Defaults to ARE, the only country it serves. + * + *

- ARE - ARE + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiUaePassWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiUaePassWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiUaePassWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiVippsWalletVerificationStartRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiVippsWalletVerificationStartRequest.java new file mode 100644 index 0000000..34a84f3 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiVippsWalletVerificationStartRequest.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Start a Vipps verification (NOR). */ +public final class DigitalIdWalletApiVippsWalletVerificationStartRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "metadata", "sandbox_scenario", "country", "return_url", "device"); + + private DigitalIdWalletApiVippsWalletVerificationStartRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiVippsWalletVerificationStartRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiVippsWalletVerificationStartRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiVippsWalletVerificationStartRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country of the Vipps identity. Defaults to NOR, the only country it serves. + * + *

- NOR - NOR + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.enumeration(DigitalIdWalletApiCountryAfcEnum::of)); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String returnUrl() { + return Json.required(json, "return_url", Conv.STRING); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiVippsWalletVerificationStartRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiVippsWalletVerificationStartRequest from) { + super(from); + } + + /** + * Your own reference for this verification (e.g. your user id). Returned in results and webhooks. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the verification and returned in results and webhooks. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Sandbox applications only: the simulated outcome - 'wallet_cancelled', 'wallet_timeout' or 'wallet_provider_error'; any other scenario (or none) verifies. Rejected on live applications. The full catalog is available at GET /v1/sandbox/scenarios/. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * ISO 3166-1 alpha-3 country of the Vipps identity. Defaults to NOR, the only country it serves. + * + *

- NOR - NOR + * + * @param country the value + * @return this builder + */ + public Builder country(DigitalIdWalletApiCountryAfcEnum country) { + return set("country", Conv.enumeration(DigitalIdWalletApiCountryAfcEnum::of), country); + } + + /** + * https URL the user's browser returns to after the wallet, with request_id and result appended. Its host must be registered in the application's allowed_return_hosts (or be its white-label domain). Never trust result on its own: read the outcome with GET .../verifications/{request_id}/ or the webhook. + * + * @param returnUrl the value + * @return this builder + */ + public Builder returnUrl(String returnUrl) { + return set("return_url", Conv.STRING, returnUrl); + } + + /** + * same_device when the user signs in on the device showing your page, cross_device when they use another one (e.g. BankID's QR code). + * + *

- same_device - same_device + * - cross_device - cross_device + * + * @param device the value + * @return this builder + */ + public Builder device(DigitalIdWalletApiDeviceEnum device) { + return set("device", Conv.enumeration(DigitalIdWalletApiDeviceEnum::of), device); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiVippsWalletVerificationStartRequest} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiVippsWalletVerificationStartRequest build() { + require("return_url", false); + return new DigitalIdWalletApiVippsWalletVerificationStartRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWallet.java b/src/main/java/me/didit/types/DigitalIdWalletApiWallet.java new file mode 100644 index 0000000..aa0efc2 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWallet.java @@ -0,0 +1,143 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class DigitalIdWalletApiWallet extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "name", "issuing_authority"); + + private DigitalIdWalletApiWallet(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWallet} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWallet fromJson(JsonNode json) { + return new DigitalIdWalletApiWallet(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Catalog id of the wallet, e.g. bankid_se. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String id() { + return Json.required(json, "id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The issuing_authority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingAuthority() { + return Json.optional(json, "issuing_authority", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWallet}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWallet from) { + super(from); + } + + /** + * Catalog id of the wallet, e.g. bankid_se. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The issuing_authority field. + * + * @param issuingAuthority the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingAuthority(@Nullable String issuingAuthority) { + return setNullable("issuing_authority", Conv.STRING, issuingAuthority); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWallet} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWallet build() { + require("id", false); + require("name", false); + require("issuing_authority", true); + return new DigitalIdWalletApiWallet(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletCatalogEntry.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletCatalogEntry.java new file mode 100644 index 0000000..2834341 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletCatalogEntry.java @@ -0,0 +1,271 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class DigitalIdWalletApiWalletCatalogEntry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "name", "path", "countries", "issuing_authority", "level_of_assurance", "interaction", "required_fields", "available"); + + private DigitalIdWalletApiWalletCatalogEntry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletCatalogEntry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletCatalogEntry fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletCatalogEntry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String id() { + return Json.required(json, "id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The wallet's own start endpoint. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String path() { + return Json.required(json, "path", Conv.STRING); + } + + /** + * The countries field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List countries() { + return Json.required(json, "countries", Conv.list(Conv.STRING)); + } + + /** + * The issuing_authority field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String issuingAuthority() { + return Json.required(json, "issuing_authority", Conv.STRING); + } + + /** + * The level_of_assurance field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional levelOfAssurance() { + return Json.optional(json, "level_of_assurance", Conv.STRING); + } + + /** + * - redirect - redirect + * - in_app - in_app + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiInteractionEnum interaction() { + return Json.required(json, "interaction", Conv.enumeration(DigitalIdWalletApiInteractionEnum::of)); + } + + /** + * The required_fields field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List requiredFields() { + return Json.required(json, "required_fields", Conv.list(Conv.STRING)); + } + + /** + * Whether this application can start it in this environment now. Listed does not mean live. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean available() { + return Json.required(json, "available", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletCatalogEntry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletCatalogEntry from) { + super(from); + } + + /** + * The id field. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The wallet's own start endpoint. + * + * @param path the value + * @return this builder + */ + public Builder path(String path) { + return set("path", Conv.STRING, path); + } + + /** + * The countries field. + * + * @param countries the value + * @return this builder + */ + public Builder countries(List countries) { + return set("countries", Conv.list(Conv.STRING), countries); + } + + /** + * The issuing_authority field. + * + * @param issuingAuthority the value + * @return this builder + */ + public Builder issuingAuthority(String issuingAuthority) { + return set("issuing_authority", Conv.STRING, issuingAuthority); + } + + /** + * The level_of_assurance field. + * + * @param levelOfAssurance the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder levelOfAssurance(@Nullable String levelOfAssurance) { + return setNullable("level_of_assurance", Conv.STRING, levelOfAssurance); + } + + /** + * - redirect - redirect + * - in_app - in_app + * + * @param interaction the value + * @return this builder + */ + public Builder interaction(DigitalIdWalletApiInteractionEnum interaction) { + return set("interaction", Conv.enumeration(DigitalIdWalletApiInteractionEnum::of), interaction); + } + + /** + * The required_fields field. + * + * @param requiredFields the value + * @return this builder + */ + public Builder requiredFields(List requiredFields) { + return set("required_fields", Conv.list(Conv.STRING), requiredFields); + } + + /** + * Whether this application can start it in this environment now. Listed does not mean live. + * + * @param available the value + * @return this builder + */ + public Builder available(boolean available) { + return set("available", Conv.BOOLEAN, available); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletCatalogEntry} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletCatalogEntry build() { + require("id", false); + require("name", false); + require("path", false); + require("countries", false); + require("issuing_authority", false); + require("level_of_assurance", true); + require("interaction", false); + require("required_fields", false); + require("available", false); + return new DigitalIdWalletApiWalletCatalogEntry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletCatalogResponse.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletCatalogResponse.java new file mode 100644 index 0000000..3459f7a --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletCatalogResponse.java @@ -0,0 +1,99 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class DigitalIdWalletApiWalletCatalogResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("wallets"); + + private DigitalIdWalletApiWalletCatalogResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletCatalogResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletCatalogResponse fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletCatalogResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The wallets field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List wallets() { + return Json.required(json, "wallets", Conv.list(Conv.model(DigitalIdWalletApiWalletCatalogEntry::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletCatalogResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletCatalogResponse from) { + super(from); + } + + /** + * The wallets field. + * + * @param wallets the value + * @return this builder + */ + public Builder wallets(List wallets) { + return set("wallets", Conv.list(Conv.model(DigitalIdWalletApiWalletCatalogEntry::fromJson)), wallets); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletCatalogResponse} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletCatalogResponse build() { + require("wallets", false); + return new DigitalIdWalletApiWalletCatalogResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletIdentity.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletIdentity.java new file mode 100644 index 0000000..892669f --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletIdentity.java @@ -0,0 +1,207 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class DigitalIdWalletApiWalletIdentity extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "first_name", "last_name", "date_of_birth", "nationality", "issuing_state"); + + private DigitalIdWalletApiWalletIdentity(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletIdentity} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletIdentity fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletIdentity(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * ISO3 nationality, only when the wallet asserts one (never inferred). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * ISO3 country whose scheme issued the identity. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String issuingState() { + return Json.required(json, "issuing_state", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletIdentity}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletIdentity from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * ISO3 nationality, only when the wallet asserts one (never inferred). + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * ISO3 country whose scheme issued the identity. + * + * @param issuingState the value + * @return this builder + */ + public Builder issuingState(String issuingState) { + return set("issuing_state", Conv.STRING, issuingState); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletIdentity} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletIdentity build() { + require("full_name", true); + require("first_name", true); + require("last_name", true); + require("date_of_birth", true); + require("nationality", true); + require("issuing_state", false); + return new DigitalIdWalletApiWalletIdentity(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletNextAction.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletNextAction.java new file mode 100644 index 0000000..63435e5 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletNextAction.java @@ -0,0 +1,166 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class DigitalIdWalletApiWalletNextAction extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "url", "verification_code", "poll_interval_seconds"); + + private DigitalIdWalletApiWalletNextAction(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletNextAction} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletNextAction fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletNextAction(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * redirect: send the user's browser to url. confirm_in_app: show verification_code to the user, who checks it matches the code in their wallet app and confirms there; then poll. + * + *

- redirect - redirect + * - confirm_in_app - confirm_in_app + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiWalletNextActionTypeEnum type() { + return Json.required(json, "type", Conv.enumeration(DigitalIdWalletApiWalletNextActionTypeEnum::of)); + } + + /** + * redirect only: where the user signs in with the wallet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * confirm_in_app only: the 4-digit comparison code the wallet app shows too. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationCode() { + return Json.optional(json, "verification_code", Conv.STRING); + } + + /** + * confirm_in_app only: how often to call POST .../verifications/{request_id}/poll/ for prompt feedback. Didit also polls pending sign-ins in the background, so the webhook reports the outcome even when you do not poll. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pollIntervalSeconds() { + return Json.optional(json, "poll_interval_seconds", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletNextAction}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletNextAction from) { + super(from); + } + + /** + * redirect: send the user's browser to url. confirm_in_app: show verification_code to the user, who checks it matches the code in their wallet app and confirms there; then poll. + * + *

- redirect - redirect + * - confirm_in_app - confirm_in_app + * + * @param type the value + * @return this builder + */ + public Builder type(DigitalIdWalletApiWalletNextActionTypeEnum type) { + return set("type", Conv.enumeration(DigitalIdWalletApiWalletNextActionTypeEnum::of), type); + } + + /** + * redirect only: where the user signs in with the wallet. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * confirm_in_app only: the 4-digit comparison code the wallet app shows too. + * + * @param verificationCode the value + * @return this builder + */ + public Builder verificationCode(String verificationCode) { + return set("verification_code", Conv.STRING, verificationCode); + } + + /** + * confirm_in_app only: how often to call POST .../verifications/{request_id}/poll/ for prompt feedback. Didit also polls pending sign-ins in the background, so the webhook reports the outcome even when you do not poll. + * + * @param pollIntervalSeconds the value + * @return this builder + */ + public Builder pollIntervalSeconds(long pollIntervalSeconds) { + return set("poll_interval_seconds", Conv.LONG, pollIntervalSeconds); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletNextAction} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletNextAction build() { + require("type", false); + return new DigitalIdWalletApiWalletNextAction(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletNextActionTypeEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletNextActionTypeEnum.java new file mode 100644 index 0000000..aff488f --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletNextActionTypeEnum.java @@ -0,0 +1,49 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - redirect - redirect + * - confirm_in_app - confirm_in_app + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiWalletNextActionTypeEnum extends StringEnum { + /** The value {@code "redirect"}. */ + public static final DigitalIdWalletApiWalletNextActionTypeEnum REDIRECT = new DigitalIdWalletApiWalletNextActionTypeEnum("redirect"); + + /** The value {@code "confirm_in_app"}. */ + public static final DigitalIdWalletApiWalletNextActionTypeEnum CONFIRM_IN_APP = new DigitalIdWalletApiWalletNextActionTypeEnum("confirm_in_app"); + + private static final List KNOWN_VALUES = List.of(REDIRECT, CONFIRM_IN_APP); + + private DigitalIdWalletApiWalletNextActionTypeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiWalletNextActionTypeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiWalletNextActionTypeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationError.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationError.java new file mode 100644 index 0000000..f88ddfe --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationError.java @@ -0,0 +1,120 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class DigitalIdWalletApiWalletVerificationError extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("error", "detail"); + + private DigitalIdWalletApiWalletVerificationError(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletVerificationError} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletVerificationError fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletVerificationError(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable machine-readable code, e.g. wallet_unavailable. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String error() { + return Json.required(json, "error", Conv.STRING); + } + + /** + * The detail field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String detail() { + return Json.required(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletVerificationError}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletVerificationError from) { + super(from); + } + + /** + * Stable machine-readable code, e.g. wallet_unavailable. + * + * @param error the value + * @return this builder + */ + public Builder error(String error) { + return set("error", Conv.STRING, error); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletVerificationError} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletVerificationError build() { + require("error", false); + require("detail", false); + return new DigitalIdWalletApiWalletVerificationError(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResponse.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResponse.java new file mode 100644 index 0000000..99ae612 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResponse.java @@ -0,0 +1,187 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** One standalone wallet verification, as every wallet endpoint answers it. */ +public final class DigitalIdWalletApiWalletVerificationResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "wallet_verification", "vendor_data", "metadata", "created_at"); + + private DigitalIdWalletApiWalletVerificationResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletVerificationResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletVerificationResponse fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletVerificationResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The request_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * The wallet_verification field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiWalletVerificationResult walletVerification() { + return Json.required(json, "wallet_verification", Conv.model(DigitalIdWalletApiWalletVerificationResult::fromJson)); + } + + /** + * The vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The metadata object sent at start, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletVerificationResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletVerificationResponse from) { + super(from); + } + + /** + * The request_id field. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The wallet_verification field. + * + * @param walletVerification the value + * @return this builder + */ + public Builder walletVerification(DigitalIdWalletApiWalletVerificationResult walletVerification) { + return set("wallet_verification", Conv.model(DigitalIdWalletApiWalletVerificationResult::fromJson), walletVerification); + } + + /** + * The vendor_data field. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The metadata object sent at start, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletVerificationResponse} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletVerificationResponse build() { + require("request_id", false); + require("wallet_verification", false); + require("vendor_data", true); + require("metadata", true); + require("created_at", false); + return new DigitalIdWalletApiWalletVerificationResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResult.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResult.java new file mode 100644 index 0000000..d99db3e --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResult.java @@ -0,0 +1,404 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class DigitalIdWalletApiWalletVerificationResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("wallet", "country", "status", "outcome", "error", "interaction", "simulated", "expires_at", "next_action", "identity", "attributes", "level_of_assurance", "verified_at", "signature_valid", "credential_type"); + + private DigitalIdWalletApiWalletVerificationResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletVerificationResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DigitalIdWalletApiWalletVerificationResult fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletVerificationResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The wallet field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiWallet wallet() { + return Json.required(json, "wallet", Conv.model(DigitalIdWalletApiWallet::fromJson)); + } + + /** + * The country field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String country() { + return Json.required(json, "country", Conv.STRING); + } + + /** + * Not Finished while pending, then Approved (verified) or Declined. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String status() { + return Json.required(json, "status", Conv.STRING); + } + + /** + * - pending - Pending + * - verified - Verified + * - cancelled - Cancelled by the user + * - timeout - Timed out + * - failed - Failed + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiWalletVerificationResultOutcomeEnum outcome() { + return Json.required(json, "outcome", Conv.enumeration(DigitalIdWalletApiWalletVerificationResultOutcomeEnum::of)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The interaction field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public DigitalIdWalletApiInteractionEnum interaction() { + return Json.required(json, "interaction", Conv.enumeration(DigitalIdWalletApiInteractionEnum::of)); + } + + /** + * The simulated field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean simulated() { + return Json.required(json, "simulated", Conv.BOOLEAN); + } + + /** + * The expires_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime expiresAt() { + return Json.required(json, "expires_at", Conv.DATE_TIME); + } + + /** + * The next_action field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nextAction() { + return Json.optional(json, "next_action", Conv.model(DigitalIdWalletApiWalletNextAction::fromJson)); + } + + /** + * The identity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identity() { + return Json.optional(json, "identity", Conv.model(DigitalIdWalletApiWalletIdentity::fromJson)); + } + + /** + * The attributes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> attributes() { + return Json.optional(json, "attributes", Conv.OBJECT); + } + + /** + * The level_of_assurance field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional levelOfAssurance() { + return Json.optional(json, "level_of_assurance", Conv.STRING); + } + + /** + * The verified_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * True once the credential's signature was verified; null for a simulated one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signatureValid() { + return Json.optional(json, "signature_valid", Conv.BOOLEAN); + } + + /** + * The credential_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional credentialType() { + return Json.optional(json, "credential_type", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DigitalIdWalletApiWalletVerificationResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DigitalIdWalletApiWalletVerificationResult from) { + super(from); + } + + /** + * The wallet field. + * + * @param wallet the value + * @return this builder + */ + public Builder wallet(DigitalIdWalletApiWallet wallet) { + return set("wallet", Conv.model(DigitalIdWalletApiWallet::fromJson), wallet); + } + + /** + * The country field. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Not Finished while pending, then Approved (verified) or Declined. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * - pending - Pending + * - verified - Verified + * - cancelled - Cancelled by the user + * - timeout - Timed out + * - failed - Failed + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(DigitalIdWalletApiWalletVerificationResultOutcomeEnum outcome) { + return set("outcome", Conv.enumeration(DigitalIdWalletApiWalletVerificationResultOutcomeEnum::of), outcome); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * The interaction field. + * + * @param interaction the value + * @return this builder + */ + public Builder interaction(DigitalIdWalletApiInteractionEnum interaction) { + return set("interaction", Conv.enumeration(DigitalIdWalletApiInteractionEnum::of), interaction); + } + + /** + * The simulated field. + * + * @param simulated the value + * @return this builder + */ + public Builder simulated(boolean simulated) { + return set("simulated", Conv.BOOLEAN, simulated); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * The next_action field. + * + * @param nextAction the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nextAction(@Nullable DigitalIdWalletApiWalletNextAction nextAction) { + return setNullable("next_action", Conv.model(DigitalIdWalletApiWalletNextAction::fromJson), nextAction); + } + + /** + * The identity field. + * + * @param identity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder identity(@Nullable DigitalIdWalletApiWalletIdentity identity) { + return setNullable("identity", Conv.model(DigitalIdWalletApiWalletIdentity::fromJson), identity); + } + + /** + * The attributes field. + * + * @param attributes the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder attributes(@Nullable Map attributes) { + return setAny("attributes", attributes); + } + + /** + * The level_of_assurance field. + * + * @param levelOfAssurance the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder levelOfAssurance(@Nullable String levelOfAssurance) { + return setNullable("level_of_assurance", Conv.STRING, levelOfAssurance); + } + + /** + * The verified_at field. + * + * @param verifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verifiedAt(@Nullable OffsetDateTime verifiedAt) { + return setNullable("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * True once the credential's signature was verified; null for a simulated one. + * + * @param signatureValid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder signatureValid(@Nullable Boolean signatureValid) { + return setNullable("signature_valid", Conv.BOOLEAN, signatureValid); + } + + /** + * The credential_type field. + * + * @param credentialType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder credentialType(@Nullable String credentialType) { + return setNullable("credential_type", Conv.STRING, credentialType); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DigitalIdWalletApiWalletVerificationResult} + * @throws IllegalStateException when a required field is missing + */ + public DigitalIdWalletApiWalletVerificationResult build() { + require("wallet", false); + require("country", false); + require("status", false); + require("outcome", false); + require("error", true); + require("interaction", false); + require("simulated", false); + require("expires_at", false); + require("next_action", true); + require("identity", true); + require("attributes", true); + require("level_of_assurance", true); + require("verified_at", true); + require("signature_valid", true); + require("credential_type", true); + return new DigitalIdWalletApiWalletVerificationResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResultOutcomeEnum.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResultOutcomeEnum.java new file mode 100644 index 0000000..06a2d80 --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationResultOutcomeEnum.java @@ -0,0 +1,61 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - pending - Pending + * - verified - Verified + * - cancelled - Cancelled by the user + * - timeout - Timed out + * - failed - Failed + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class DigitalIdWalletApiWalletVerificationResultOutcomeEnum extends StringEnum { + /** The value {@code "pending"}. */ + public static final DigitalIdWalletApiWalletVerificationResultOutcomeEnum PENDING = new DigitalIdWalletApiWalletVerificationResultOutcomeEnum("pending"); + + /** The value {@code "verified"}. */ + public static final DigitalIdWalletApiWalletVerificationResultOutcomeEnum VERIFIED = new DigitalIdWalletApiWalletVerificationResultOutcomeEnum("verified"); + + /** The value {@code "cancelled"}. */ + public static final DigitalIdWalletApiWalletVerificationResultOutcomeEnum CANCELLED = new DigitalIdWalletApiWalletVerificationResultOutcomeEnum("cancelled"); + + /** The value {@code "timeout"}. */ + public static final DigitalIdWalletApiWalletVerificationResultOutcomeEnum TIMEOUT = new DigitalIdWalletApiWalletVerificationResultOutcomeEnum("timeout"); + + /** The value {@code "failed"}. */ + public static final DigitalIdWalletApiWalletVerificationResultOutcomeEnum FAILED = new DigitalIdWalletApiWalletVerificationResultOutcomeEnum("failed"); + + private static final List KNOWN_VALUES = List.of(PENDING, VERIFIED, CANCELLED, TIMEOUT, FAILED); + + private DigitalIdWalletApiWalletVerificationResultOutcomeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DigitalIdWalletApiWalletVerificationResultOutcomeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DigitalIdWalletApiWalletVerificationResultOutcomeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationStartBadRequest.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationStartBadRequest.java new file mode 100644 index 0000000..169c4bc --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationStartBadRequest.java @@ -0,0 +1,89 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import me.didit.core.Conv; +import me.didit.core.Json; +import me.didit.core.JsonUnion; + +/** + * + *

One of: {@code DigitalIdWalletApiWalletVerificationError}, {@code DigitalIdWalletApiWalletVerificationFieldErrors}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ +public final class DigitalIdWalletApiWalletVerificationStartBadRequest extends JsonUnion { + private DigitalIdWalletApiWalletVerificationStartBadRequest(JsonNode json) { + super(json); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletVerificationStartBadRequest} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static DigitalIdWalletApiWalletVerificationStartBadRequest fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletVerificationStartBadRequest(json.deepCopy()); + } + + /** + * Wraps a {@code DigitalIdWalletApiWalletVerificationError} value. + * + * @param value the value + * @return the union + */ + public static DigitalIdWalletApiWalletVerificationStartBadRequest ofDigitalIdWalletApiWalletVerificationError(DigitalIdWalletApiWalletVerificationError value) { + return new DigitalIdWalletApiWalletVerificationStartBadRequest(Conv.model(DigitalIdWalletApiWalletVerificationError::fromJson).write(value)); + } + + /** + * Whether this value is a {@code DigitalIdWalletApiWalletVerificationError}. + * + * @return true when it matches + */ + public boolean isDigitalIdWalletApiWalletVerificationError() { + return Json.hasFields(json, "detail", "error"); + } + + /** + * Reads this value as a {@code DigitalIdWalletApiWalletVerificationError}. + * + * @return the value, or empty when {@link #isDigitalIdWalletApiWalletVerificationError()} is false + */ + public Optional asDigitalIdWalletApiWalletVerificationError() { + return isDigitalIdWalletApiWalletVerificationError() ? Optional.of(Conv.model(DigitalIdWalletApiWalletVerificationError::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code DigitalIdWalletApiWalletVerificationFieldErrors} value. + * + * @param value the value + * @return the union + */ + public static DigitalIdWalletApiWalletVerificationStartBadRequest ofDigitalIdWalletApiWalletVerificationFieldErrors(Map> value) { + return new DigitalIdWalletApiWalletVerificationStartBadRequest(Conv.map(Conv.list(Conv.STRING)).write(value)); + } + + /** + * Whether this value is a {@code DigitalIdWalletApiWalletVerificationFieldErrors}. + * + * Request validation errors: each rejected field with its messages. + * + * @return true when it matches + */ + public boolean isDigitalIdWalletApiWalletVerificationFieldErrors() { + return json.isObject(); + } + + /** + * Reads this value as a {@code DigitalIdWalletApiWalletVerificationFieldErrors}. + * + * @return the value, or empty when {@link #isDigitalIdWalletApiWalletVerificationFieldErrors()} is false + */ + public Optional>> asDigitalIdWalletApiWalletVerificationFieldErrors() { + return isDigitalIdWalletApiWalletVerificationFieldErrors() ? Optional.of(Conv.map(Conv.list(Conv.STRING)).read(json)) : Optional.empty(); + } +} diff --git a/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationStartForbidden.java b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationStartForbidden.java new file mode 100644 index 0000000..68adf8a --- /dev/null +++ b/src/main/java/me/didit/types/DigitalIdWalletApiWalletVerificationStartForbidden.java @@ -0,0 +1,95 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.Optional; +import me.didit.core.Conv; +import me.didit.core.Json; +import me.didit.core.JsonUnion; + +/** + * + *

One of: {@code DigitalIdWalletApiClientCredentialsForbiddenErrorMessage}, {@code DigitalIdWalletApiWalletVerificationError}. Check with the {@code is...} + * methods and read with the {@code as...} methods; the fields every variant has are readable directly. + */ +public final class DigitalIdWalletApiWalletVerificationStartForbidden extends JsonUnion { + private DigitalIdWalletApiWalletVerificationStartForbidden(JsonNode json) { + super(json); + } + + /** + * Reads a {@code DigitalIdWalletApiWalletVerificationStartForbidden} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static DigitalIdWalletApiWalletVerificationStartForbidden fromJson(JsonNode json) { + return new DigitalIdWalletApiWalletVerificationStartForbidden(json.deepCopy()); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + /** + * Wraps a {@code DigitalIdWalletApiClientCredentialsForbiddenErrorMessage} value. + * + * @param value the value + * @return the union + */ + public static DigitalIdWalletApiWalletVerificationStartForbidden ofDigitalIdWalletApiClientCredentialsForbiddenErrorMessage(DigitalIdWalletApiClientCredentialsForbiddenErrorMessage value) { + return new DigitalIdWalletApiWalletVerificationStartForbidden(Conv.model(DigitalIdWalletApiClientCredentialsForbiddenErrorMessage::fromJson).write(value)); + } + + /** + * Whether this value is a {@code DigitalIdWalletApiClientCredentialsForbiddenErrorMessage}. + * + * @return true when it matches + */ + public boolean isDigitalIdWalletApiClientCredentialsForbiddenErrorMessage() { + return json.isObject(); + } + + /** + * Reads this value as a {@code DigitalIdWalletApiClientCredentialsForbiddenErrorMessage}. + * + * @return the value, or empty when {@link #isDigitalIdWalletApiClientCredentialsForbiddenErrorMessage()} is false + */ + public Optional asDigitalIdWalletApiClientCredentialsForbiddenErrorMessage() { + return isDigitalIdWalletApiClientCredentialsForbiddenErrorMessage() ? Optional.of(Conv.model(DigitalIdWalletApiClientCredentialsForbiddenErrorMessage::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code DigitalIdWalletApiWalletVerificationError} value. + * + * @param value the value + * @return the union + */ + public static DigitalIdWalletApiWalletVerificationStartForbidden ofDigitalIdWalletApiWalletVerificationError(DigitalIdWalletApiWalletVerificationError value) { + return new DigitalIdWalletApiWalletVerificationStartForbidden(Conv.model(DigitalIdWalletApiWalletVerificationError::fromJson).write(value)); + } + + /** + * Whether this value is a {@code DigitalIdWalletApiWalletVerificationError}. + * + * @return true when it matches + */ + public boolean isDigitalIdWalletApiWalletVerificationError() { + return Json.hasFields(json, "detail", "error"); + } + + /** + * Reads this value as a {@code DigitalIdWalletApiWalletVerificationError}. + * + * @return the value, or empty when {@link #isDigitalIdWalletApiWalletVerificationError()} is false + */ + public Optional asDigitalIdWalletApiWalletVerificationError() { + return isDigitalIdWalletApiWalletVerificationError() ? Optional.of(Conv.model(DigitalIdWalletApiWalletVerificationError::fromJson).read(json)) : Optional.empty(); + } +} diff --git a/src/main/java/me/didit/types/DocumentAIDetectedCode.java b/src/main/java/me/didit/types/DocumentAIDetectedCode.java new file mode 100644 index 0000000..0d7cf63 --- /dev/null +++ b/src/main/java/me/didit/types/DocumentAIDetectedCode.java @@ -0,0 +1,311 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class DocumentAIDetectedCode extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "page_number", "position", "x", "y", "width", "height", "page_width", "page_height", "raw_payload", "parsed_payload"); + + private DocumentAIDetectedCode(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentAIDetectedCode} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentAIDetectedCode fromJson(JsonNode json) { + return new DocumentAIDetectedCode(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Detected symbology, for example QR_CODE, CODE_128, EAN_13, DATA_MATRIX, or PDF_417. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String type() { + return Json.required(json, "type", Conv.STRING); + } + + /** + * 1-based page number. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long pageNumber() { + return Json.required(json, "page_number", Conv.LONG); + } + + /** + * Detected polygon in rendered-page pixel coordinates. null when no reliable location is available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> position() { + return Json.optional(json, "position", Conv.list(Conv.list(Conv.LONG))); + } + + /** + * Left edge of the bounding box in rendered-page pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional x() { + return Json.optional(json, "x", Conv.LONG); + } + + /** + * Top edge of the bounding box in rendered-page pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional y() { + return Json.optional(json, "y", Conv.LONG); + } + + /** + * Bounding-box width in rendered-page pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional width() { + return Json.optional(json, "width", Conv.LONG); + } + + /** + * Bounding-box height in rendered-page pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional height() { + return Json.optional(json, "height", Conv.LONG); + } + + /** + * Rendered page width in pixels. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long pageWidth() { + return Json.required(json, "page_width", Conv.LONG); + } + + /** + * Rendered page height in pixels. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long pageHeight() { + return Json.required(json, "page_height", Conv.LONG); + } + + /** + * Raw decoder payload as a base64 string when available; otherwise an empty string. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String rawPayload() { + return Json.required(json, "raw_payload", Conv.STRING); + } + + /** + * Decoded string or structured value. null when the code was located but could not be decoded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional parsedPayload() { + return Json.optional(json, "parsed_payload", Conv.ANY); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentAIDetectedCode}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentAIDetectedCode from) { + super(from); + } + + /** + * Detected symbology, for example QR_CODE, CODE_128, EAN_13, DATA_MATRIX, or PDF_417. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * 1-based page number. + * + * @param pageNumber the value + * @return this builder + */ + public Builder pageNumber(long pageNumber) { + return set("page_number", Conv.LONG, pageNumber); + } + + /** + * Detected polygon in rendered-page pixel coordinates. null when no reliable location is available. + * + * @param position the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder position(@Nullable List> position) { + return setNullable("position", Conv.list(Conv.list(Conv.LONG)), position); + } + + /** + * Left edge of the bounding box in rendered-page pixels. + * + * @param x the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder x(@Nullable Long x) { + return setNullable("x", Conv.LONG, x); + } + + /** + * Top edge of the bounding box in rendered-page pixels. + * + * @param y the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder y(@Nullable Long y) { + return setNullable("y", Conv.LONG, y); + } + + /** + * Bounding-box width in rendered-page pixels. + * + * @param width the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder width(@Nullable Long width) { + return setNullable("width", Conv.LONG, width); + } + + /** + * Bounding-box height in rendered-page pixels. + * + * @param height the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder height(@Nullable Long height) { + return setNullable("height", Conv.LONG, height); + } + + /** + * Rendered page width in pixels. + * + * @param pageWidth the value + * @return this builder + */ + public Builder pageWidth(long pageWidth) { + return set("page_width", Conv.LONG, pageWidth); + } + + /** + * Rendered page height in pixels. + * + * @param pageHeight the value + * @return this builder + */ + public Builder pageHeight(long pageHeight) { + return set("page_height", Conv.LONG, pageHeight); + } + + /** + * Raw decoder payload as a base64 string when available; otherwise an empty string. + * + * @param rawPayload the value + * @return this builder + */ + public Builder rawPayload(String rawPayload) { + return set("raw_payload", Conv.STRING, rawPayload); + } + + /** + * Decoded string or structured value. null when the code was located but could not be decoded. + * + * @param parsedPayload the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder parsedPayload(@Nullable Object parsedPayload) { + return setAny("parsed_payload", parsedPayload); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentAIDetectedCode} + * @throws IllegalStateException when a required field is missing + */ + public DocumentAIDetectedCode build() { + require("type", false); + require("page_number", false); + require("position", true); + require("x", true); + require("y", true); + require("width", true); + require("height", true); + require("page_width", false); + require("page_height", false); + require("raw_payload", false); + require("parsed_payload", true); + return new DocumentAIDetectedCode(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/DocumentAiAnalyzeParams.java b/src/main/java/me/didit/types/DocumentAiAnalyzeParams.java new file mode 100644 index 0000000..3e127c6 --- /dev/null +++ b/src/main/java/me/didit/types/DocumentAiAnalyzeParams.java @@ -0,0 +1,623 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code document_ai.analyze}. */ +public final class DocumentAiAnalyzeParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("document", "fields", "expected_first_name", "expected_last_name", "expected_company_name", "expected_company_country", "document_ai_name_match_score_threshold", "document_ai_unreadable_document_action", "document_ai_missing_required_fields_action", "document_ai_document_tampering_action", "document_ai_name_mismatch_action", "document_ai_unsupported_file_action", "save_api_request", "vendor_data", "metadata"); + + private DocumentAiAnalyzeParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentAiAnalyzeParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentAiAnalyzeParams fromJson(JsonNode json) { + return new DocumentAiAnalyzeParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The document to read. Allowed extensions: tiff, jpg, jpeg, png, pdf, webp, zip. Maximum upload size: 30 MB (larger files are rejected with 400). Multi-page PDFs are supported (expect higher latency); encrypted PDFs are rejected with 400. Images are automatically compressed before processing. + * + * @return the file to upload, if set + */ + public Optional document() { + return file("document"); + } + + /** + * One JSON-encoded array string with 1โ€“30 field definitions (maximum 16 KB). Each item: key (required, ^[a-z0-9_]{1,64}$, unique โ€” the key returned in extracted_data), name (โ‰ค100 chars, shown in messages), instruction (โ‰ค500 chars, what the model should read), type (text default | number | date), required (boolean, default false), is_full_name (boolean, default false, at most one per request). Bracket-style form arrays, invalid JSON, duplicate keys, or more than one is_full_name return 400 before any processing or billing. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String fields() { + return Json.required(json, "fields", Conv.STRING); + } + + /** + * First name to verify against the document's name field (fuzzy match, transliteration-aware). Use together with expected_last_name; cannot be combined with expected_company_name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedFirstName() { + return Json.optional(json, "expected_first_name", Conv.STRING); + } + + /** + * Last name to verify against the document's name field, combined with expected_first_name for name_match_score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedLastName() { + return Json.optional(json, "expected_last_name", Conv.STRING); + } + + /** + * Company name to verify against the document's name field (for business documents). Cannot be combined with expected_first_name / expected_last_name (no example value on purpose โ€” the generated request sample uses the person fields; swap them for this one when verifying a business document). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedCompanyName() { + return Json.optional(json, "expected_company_name", Conv.STRING); + } + + /** + * Optional ISO 3166-1 alpha-2 country code (two ASCII letters, e.g. FR) that tunes company-name normalization for expected_company_name. Only used with expected_company_name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedCompanyCountry() { + return Json.optional(json, "expected_company_country", Conv.STRING); + } + + /** + * Minimum name_match_score (0โ€“100) to consider the name matched. A lower score adds DOCUMENT_AI_NAME_MISMATCH, governed by document_ai_name_mismatch_action. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAiNameMatchScoreThreshold() { + return Json.optional(json, "document_ai_name_match_score_threshold", Conv.LONG); + } + + /** + * What to do when no field could be read from the document (DOCUMENT_AI_UNREADABLE_DOCUMENT). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAiUnreadableDocumentAction() { + return Json.optional(json, "document_ai_unreadable_document_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiUnreadableDocumentAction::of)); + } + + /** + * What to do when at least one required field could not be read (DOCUMENT_AI_MISSING_REQUIRED_FIELDS; additional_data.missing_fields lists them). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAiMissingRequiredFieldsAction() { + return Json.optional(json, "document_ai_missing_required_fields_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiMissingRequiredFieldsAction::of)); + } + + /** + * What to do when PDF/EXIF forensics suspect manipulation โ€” modified after digital signing, known PDF editor, overlay-text manipulation, suspicious re-export, image anomalies (DOCUMENT_AI_SUSPECTED_MANIPULATION). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAiDocumentTamperingAction() { + return Json.optional(json, "document_ai_document_tampering_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiDocumentTamperingAction::of)); + } + + /** + * What to do when name_match_score is below the threshold (DOCUMENT_AI_NAME_MISMATCH). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAiNameMismatchAction() { + return Json.optional(json, "document_ai_name_mismatch_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiNameMismatchAction::of)); + } + + /** + * What to do when the upload is empty or not a processable file (DOCUMENT_AI_UNSUPPORTED_FILE). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAiUnsupportedFileAction() { + return Json.optional(json, "document_ai_unsupported_file_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiUnsupportedFileAction::of)); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, with the uploaded document, the extracted values, the field definitions and the name-match snapshot stored. When false, nothing is stored and request_id is a transient UUID for response correlation only; the call is still billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"onboarding"}) โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentAiAnalyzeParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentAiAnalyzeParams from) { + super(from); + } + + /** + * The document to read. Allowed extensions: tiff, jpg, jpeg, png, pdf, webp, zip. Maximum upload size: 30 MB (larger files are rejected with 400). Multi-page PDFs are supported (expect higher latency); encrypted PDFs are rejected with 400. Images are automatically compressed before processing. + * + * @param document the value + * @return this builder + */ + public Builder document(FileUpload document) { + return setFile("document", document); + } + + /** + * Uploads the file at {@code path} as {@code document}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder document(Path path) { + return setFile("document", FileUpload.of(path)); + } + + /** + * One JSON-encoded array string with 1โ€“30 field definitions (maximum 16 KB). Each item: key (required, ^[a-z0-9_]{1,64}$, unique โ€” the key returned in extracted_data), name (โ‰ค100 chars, shown in messages), instruction (โ‰ค500 chars, what the model should read), type (text default | number | date), required (boolean, default false), is_full_name (boolean, default false, at most one per request). Bracket-style form arrays, invalid JSON, duplicate keys, or more than one is_full_name return 400 before any processing or billing. + * + * @param fields the value + * @return this builder + */ + public Builder fields(String fields) { + return set("fields", Conv.STRING, fields); + } + + /** + * First name to verify against the document's name field (fuzzy match, transliteration-aware). Use together with expected_last_name; cannot be combined with expected_company_name. + * + * @param expectedFirstName the value + * @return this builder + */ + public Builder expectedFirstName(String expectedFirstName) { + return set("expected_first_name", Conv.STRING, expectedFirstName); + } + + /** + * Last name to verify against the document's name field, combined with expected_first_name for name_match_score. + * + * @param expectedLastName the value + * @return this builder + */ + public Builder expectedLastName(String expectedLastName) { + return set("expected_last_name", Conv.STRING, expectedLastName); + } + + /** + * Company name to verify against the document's name field (for business documents). Cannot be combined with expected_first_name / expected_last_name (no example value on purpose โ€” the generated request sample uses the person fields; swap them for this one when verifying a business document). + * + * @param expectedCompanyName the value + * @return this builder + */ + public Builder expectedCompanyName(String expectedCompanyName) { + return set("expected_company_name", Conv.STRING, expectedCompanyName); + } + + /** + * Optional ISO 3166-1 alpha-2 country code (two ASCII letters, e.g. FR) that tunes company-name normalization for expected_company_name. Only used with expected_company_name. + * + * @param expectedCompanyCountry the value + * @return this builder + */ + public Builder expectedCompanyCountry(String expectedCompanyCountry) { + return set("expected_company_country", Conv.STRING, expectedCompanyCountry); + } + + /** + * Minimum name_match_score (0โ€“100) to consider the name matched. A lower score adds DOCUMENT_AI_NAME_MISMATCH, governed by document_ai_name_mismatch_action. + * + * @param documentAiNameMatchScoreThreshold the value + * @return this builder + */ + public Builder documentAiNameMatchScoreThreshold(long documentAiNameMatchScoreThreshold) { + return set("document_ai_name_match_score_threshold", Conv.LONG, documentAiNameMatchScoreThreshold); + } + + /** + * What to do when no field could be read from the document (DOCUMENT_AI_UNREADABLE_DOCUMENT). + * + * @param documentAiUnreadableDocumentAction the value + * @return this builder + */ + public Builder documentAiUnreadableDocumentAction(DocumentAiAnalyzeParams.DocumentAiUnreadableDocumentAction documentAiUnreadableDocumentAction) { + return set("document_ai_unreadable_document_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiUnreadableDocumentAction::of), documentAiUnreadableDocumentAction); + } + + /** + * What to do when at least one required field could not be read (DOCUMENT_AI_MISSING_REQUIRED_FIELDS; additional_data.missing_fields lists them). + * + * @param documentAiMissingRequiredFieldsAction the value + * @return this builder + */ + public Builder documentAiMissingRequiredFieldsAction(DocumentAiAnalyzeParams.DocumentAiMissingRequiredFieldsAction documentAiMissingRequiredFieldsAction) { + return set("document_ai_missing_required_fields_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiMissingRequiredFieldsAction::of), documentAiMissingRequiredFieldsAction); + } + + /** + * What to do when PDF/EXIF forensics suspect manipulation โ€” modified after digital signing, known PDF editor, overlay-text manipulation, suspicious re-export, image anomalies (DOCUMENT_AI_SUSPECTED_MANIPULATION). + * + * @param documentAiDocumentTamperingAction the value + * @return this builder + */ + public Builder documentAiDocumentTamperingAction(DocumentAiAnalyzeParams.DocumentAiDocumentTamperingAction documentAiDocumentTamperingAction) { + return set("document_ai_document_tampering_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiDocumentTamperingAction::of), documentAiDocumentTamperingAction); + } + + /** + * What to do when name_match_score is below the threshold (DOCUMENT_AI_NAME_MISMATCH). + * + * @param documentAiNameMismatchAction the value + * @return this builder + */ + public Builder documentAiNameMismatchAction(DocumentAiAnalyzeParams.DocumentAiNameMismatchAction documentAiNameMismatchAction) { + return set("document_ai_name_mismatch_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiNameMismatchAction::of), documentAiNameMismatchAction); + } + + /** + * What to do when the upload is empty or not a processable file (DOCUMENT_AI_UNSUPPORTED_FILE). + * + * @param documentAiUnsupportedFileAction the value + * @return this builder + */ + public Builder documentAiUnsupportedFileAction(DocumentAiAnalyzeParams.DocumentAiUnsupportedFileAction documentAiUnsupportedFileAction) { + return set("document_ai_unsupported_file_action", Conv.enumeration(DocumentAiAnalyzeParams.DocumentAiUnsupportedFileAction::of), documentAiUnsupportedFileAction); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, with the uploaded document, the extracted values, the field definitions and the name-match snapshot stored. When false, nothing is stored and request_id is a transient UUID for response correlation only; the call is still billed. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"onboarding"}) โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentAiAnalyzeParams} + * @throws IllegalStateException when a required field is missing + */ + public DocumentAiAnalyzeParams build() { + requireFile("document"); + require("fields", false); + return new DocumentAiAnalyzeParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What to do when no field could be read from the document (DOCUMENT_AI_UNREADABLE_DOCUMENT). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentAiUnreadableDocumentAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final DocumentAiUnreadableDocumentAction DECLINE = new DocumentAiUnreadableDocumentAction("DECLINE"); + + /** The value {@code "REVIEW"}. */ + public static final DocumentAiUnreadableDocumentAction REVIEW = new DocumentAiUnreadableDocumentAction("REVIEW"); + + /** The value {@code "NO_ACTION"}. */ + public static final DocumentAiUnreadableDocumentAction NO_ACTION = new DocumentAiUnreadableDocumentAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, REVIEW, NO_ACTION); + + private DocumentAiUnreadableDocumentAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentAiUnreadableDocumentAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentAiUnreadableDocumentAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when at least one required field could not be read (DOCUMENT_AI_MISSING_REQUIRED_FIELDS; additional_data.missing_fields lists them). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentAiMissingRequiredFieldsAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final DocumentAiMissingRequiredFieldsAction DECLINE = new DocumentAiMissingRequiredFieldsAction("DECLINE"); + + /** The value {@code "REVIEW"}. */ + public static final DocumentAiMissingRequiredFieldsAction REVIEW = new DocumentAiMissingRequiredFieldsAction("REVIEW"); + + /** The value {@code "NO_ACTION"}. */ + public static final DocumentAiMissingRequiredFieldsAction NO_ACTION = new DocumentAiMissingRequiredFieldsAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, REVIEW, NO_ACTION); + + private DocumentAiMissingRequiredFieldsAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentAiMissingRequiredFieldsAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentAiMissingRequiredFieldsAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when PDF/EXIF forensics suspect manipulation โ€” modified after digital signing, known PDF editor, overlay-text manipulation, suspicious re-export, image anomalies (DOCUMENT_AI_SUSPECTED_MANIPULATION). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentAiDocumentTamperingAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final DocumentAiDocumentTamperingAction DECLINE = new DocumentAiDocumentTamperingAction("DECLINE"); + + /** The value {@code "REVIEW"}. */ + public static final DocumentAiDocumentTamperingAction REVIEW = new DocumentAiDocumentTamperingAction("REVIEW"); + + /** The value {@code "NO_ACTION"}. */ + public static final DocumentAiDocumentTamperingAction NO_ACTION = new DocumentAiDocumentTamperingAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, REVIEW, NO_ACTION); + + private DocumentAiDocumentTamperingAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentAiDocumentTamperingAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentAiDocumentTamperingAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when name_match_score is below the threshold (DOCUMENT_AI_NAME_MISMATCH). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentAiNameMismatchAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final DocumentAiNameMismatchAction DECLINE = new DocumentAiNameMismatchAction("DECLINE"); + + /** The value {@code "REVIEW"}. */ + public static final DocumentAiNameMismatchAction REVIEW = new DocumentAiNameMismatchAction("REVIEW"); + + /** The value {@code "NO_ACTION"}. */ + public static final DocumentAiNameMismatchAction NO_ACTION = new DocumentAiNameMismatchAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, REVIEW, NO_ACTION); + + private DocumentAiNameMismatchAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentAiNameMismatchAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentAiNameMismatchAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the upload is empty or not a processable file (DOCUMENT_AI_UNSUPPORTED_FILE). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentAiUnsupportedFileAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final DocumentAiUnsupportedFileAction DECLINE = new DocumentAiUnsupportedFileAction("DECLINE"); + + /** The value {@code "REVIEW"}. */ + public static final DocumentAiUnsupportedFileAction REVIEW = new DocumentAiUnsupportedFileAction("REVIEW"); + + /** The value {@code "NO_ACTION"}. */ + public static final DocumentAiUnsupportedFileAction NO_ACTION = new DocumentAiUnsupportedFileAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, REVIEW, NO_ACTION); + + private DocumentAiUnsupportedFileAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentAiUnsupportedFileAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentAiUnsupportedFileAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/DocumentAiAnalyzeResponse.java b/src/main/java/me/didit/types/DocumentAiAnalyzeResponse.java new file mode 100644 index 0000000..2f28a61 --- /dev/null +++ b/src/main/java/me/didit/types/DocumentAiAnalyzeResponse.java @@ -0,0 +1,985 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class DocumentAiAnalyzeResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "document_ai", "vendor_data", "metadata", "created_at"); + + private DocumentAiAnalyzeResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentAiAnalyzeResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentAiAnalyzeResponse fromJson(JsonNode json) { + return new DocumentAiAnalyzeResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The document_ai field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentAi() { + return Json.optional(json, "document_ai", Conv.model(DocumentAiAnalyzeResponse.DocumentAi::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * When the request was processed (UTC, ISO 8601). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentAiAnalyzeResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentAiAnalyzeResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The document_ai field. + * + * @param documentAi the value + * @return this builder + */ + public Builder documentAi(DocumentAiAnalyzeResponse.DocumentAi documentAi) { + return set("document_ai", Conv.model(DocumentAiAnalyzeResponse.DocumentAi::fromJson), documentAi); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * When the request was processed (UTC, ISO 8601). + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentAiAnalyzeResponse} + */ + public DocumentAiAnalyzeResponse build() { + return new DocumentAiAnalyzeResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class DocumentAi extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "extracted_data", "detected_codes", "fields", "name_match_score", "name_on_document", "warnings"); + + private DocumentAi(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentAi} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentAi fromJson(JsonNode json) { + return new DocumentAi(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Approved when no warning resolves to a decline or review; Declined when at least one risk maps to DECLINE; otherwise In Review when at least one maps to REVIEW. The warnings list explains why. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Status::of)); + } + + /** + * One entry per requested field key. Values are typed per the field type โ€” strings for text, numbers for number, YYYY-MM-DD strings for date โ€” or null when the value could not be read. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extractedData() { + return Json.optional(json, "extracted_data", Conv.OBJECT); + } + + /** + * QR codes and barcodes detected across every processed page. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> detectedCodes() { + return Json.optional(json, "detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson))); + } + + /** + * The normalized field definitions that were used for this extraction, echoed back (also stored with the session when save_api_request=true). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> fields() { + return Json.optional(json, "fields", Conv.list(Conv.model(DocumentAiAnalyzeResponse.DocumentAi.Fields::fromJson))); + } + + /** + * Fuzzy similarity (0โ€“100) between name_on_document and the expected person/company name. Returned whenever both a name value and an expected name exist โ€” on matches and mismatches; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameMatchScore() { + return Json.optional(json, "name_match_score", Conv.DOUBLE); + } + + /** + * The name value taken from the document (the is_full_name field, or the first name-like text field) that was compared against the expected name. null when no name value was available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameOnDocument() { + return Json.optional(json, "name_on_document", Conv.STRING); + } + + /** + * Empty on a clean approval. Every entry explains one detected risk; entries with log_type: "error" set status to Declined, entries with log_type: "warning" set it to In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(DocumentAiAnalyzeResponse.DocumentAi.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentAi}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentAi from) { + super(from); + } + + /** + * Approved when no warning resolves to a decline or review; Declined when at least one risk maps to DECLINE; otherwise In Review when at least one maps to REVIEW. The warnings list explains why. + * + * @param status the value + * @return this builder + */ + public Builder status(DocumentAiAnalyzeResponse.DocumentAi.Status status) { + return set("status", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Status::of), status); + } + + /** + * One entry per requested field key. Values are typed per the field type โ€” strings for text, numbers for number, YYYY-MM-DD strings for date โ€” or null when the value could not be read. + * + * @param extractedData the value + * @return this builder + */ + public Builder extractedData(Map extractedData) { + return setAny("extracted_data", extractedData); + } + + /** + * QR codes and barcodes detected across every processed page. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @param detectedCodes the value + * @return this builder + */ + public Builder detectedCodes(List detectedCodes) { + return set("detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson)), detectedCodes); + } + + /** + * The normalized field definitions that were used for this extraction, echoed back (also stored with the session when save_api_request=true). + * + * @param fields the value + * @return this builder + */ + public Builder fields(List fields) { + return set("fields", Conv.list(Conv.model(DocumentAiAnalyzeResponse.DocumentAi.Fields::fromJson)), fields); + } + + /** + * Fuzzy similarity (0โ€“100) between name_on_document and the expected person/company name. Returned whenever both a name value and an expected name exist โ€” on matches and mismatches; null otherwise. + * + * @param nameMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameMatchScore(@Nullable Double nameMatchScore) { + return setNullable("name_match_score", Conv.DOUBLE, nameMatchScore); + } + + /** + * The name value taken from the document (the is_full_name field, or the first name-like text field) that was compared against the expected name. null when no name value was available. + * + * @param nameOnDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameOnDocument(@Nullable String nameOnDocument) { + return setNullable("name_on_document", Conv.STRING, nameOnDocument); + } + + /** + * Empty on a clean approval. Every entry explains one detected risk; entries with log_type: "error" set status to Declined, entries with log_type: "warning" set it to In Review. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(DocumentAiAnalyzeResponse.DocumentAi.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentAi} + */ + public DocumentAi build() { + return new DocumentAi(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved when no warning resolves to a decline or review; Declined when at least one risk maps to DECLINE; otherwise In Review when at least one maps to REVIEW. The warnings list explains why. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Fields extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("key", "name", "instruction", "type", "required", "is_full_name"); + + private Fields(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Fields} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Fields fromJson(JsonNode json) { + return new Fields(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional key() { + return Json.optional(json, "key", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The instruction field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instruction() { + return Json.optional(json, "instruction", Conv.STRING); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Fields.Type::of)); + } + + /** + * The required field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional required() { + return Json.optional(json, "required", Conv.BOOLEAN); + } + + /** + * The is_full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFullName() { + return Json.optional(json, "is_full_name", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Fields}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Fields from) { + super(from); + } + + /** + * The key field. + * + * @param key the value + * @return this builder + */ + public Builder key(String key) { + return set("key", Conv.STRING, key); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The instruction field. + * + * @param instruction the value + * @return this builder + */ + public Builder instruction(String instruction) { + return set("instruction", Conv.STRING, instruction); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(DocumentAiAnalyzeResponse.DocumentAi.Fields.Type type) { + return set("type", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Fields.Type::of), type); + } + + /** + * The required field. + * + * @param required the value + * @return this builder + */ + public Builder required(boolean required) { + return set("required", Conv.BOOLEAN, required); + } + + /** + * The is_full_name field. + * + * @param isFullName the value + * @return this builder + */ + public Builder isFullName(boolean isFullName) { + return set("is_full_name", Conv.BOOLEAN, isFullName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Fields} + */ + public Fields build() { + return new Fields(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "text"}. */ + public static final Type TEXT = new Type("text"); + + /** The value {@code "number"}. */ + public static final Type NUMBER = new Type("number"); + + /** The value {@code "date"}. */ + public static final Type DATE = new Type("date"); + + private static final List KNOWN_VALUES = List.of(TEXT, NUMBER, DATE); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. Each one is governed by the matching document_ai_*_action request option. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Warnings.Risk::of)); + } + + /** + * Feature that raised the warning. Always DOCUMENT_AI on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Warnings.Feature::of)); + } + + /** + * Extra context for the risk: {"missing_fields": ["Net pay"]} for missing required fields, {"name_on_document", "score", "threshold"} for a name mismatch, and the forensic finding (detection_method, producer/editor details) for suspected manipulation. null when there is nothing to add. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity derived from the configured action: error (DECLINE), warning (REVIEW), information (NO_ACTION). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Warnings.LogType::of)); + } + + /** + * Human-readable one-liner for the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation, interpolated with additional_data where relevant. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. Each one is governed by the matching document_ai_*_action request option. + * + * @param risk the value + * @return this builder + */ + public Builder risk(DocumentAiAnalyzeResponse.DocumentAi.Warnings.Risk risk) { + return set("risk", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Warnings.Risk::of), risk); + } + + /** + * Feature that raised the warning. Always DOCUMENT_AI on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(DocumentAiAnalyzeResponse.DocumentAi.Warnings.Feature feature) { + return set("feature", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Warnings.Feature::of), feature); + } + + /** + * Extra context for the risk: {"missing_fields": ["Net pay"]} for missing required fields, {"name_on_document", "score", "threshold"} for a name mismatch, and the forensic finding (detection_method, producer/editor details) for suspected manipulation. null when there is nothing to add. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity derived from the configured action: error (DECLINE), warning (REVIEW), information (NO_ACTION). + * + * @param logType the value + * @return this builder + */ + public Builder logType(DocumentAiAnalyzeResponse.DocumentAi.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(DocumentAiAnalyzeResponse.DocumentAi.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-liner for the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation, interpolated with additional_data where relevant. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Machine-readable risk code. Each one is governed by the matching document_ai_*_action request option. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Risk extends StringEnum { + /** The value {@code "DOCUMENT_AI_UNREADABLE_DOCUMENT"}. */ + public static final Risk DOCUMENT_AI_UNREADABLE_DOCUMENT = new Risk("DOCUMENT_AI_UNREADABLE_DOCUMENT"); + + /** The value {@code "DOCUMENT_AI_MISSING_REQUIRED_FIELDS"}. */ + public static final Risk DOCUMENT_AI_MISSING_REQUIRED_FIELDS = new Risk("DOCUMENT_AI_MISSING_REQUIRED_FIELDS"); + + /** The value {@code "DOCUMENT_AI_SUSPECTED_MANIPULATION"}. */ + public static final Risk DOCUMENT_AI_SUSPECTED_MANIPULATION = new Risk("DOCUMENT_AI_SUSPECTED_MANIPULATION"); + + /** The value {@code "DOCUMENT_AI_NAME_MISMATCH"}. */ + public static final Risk DOCUMENT_AI_NAME_MISMATCH = new Risk("DOCUMENT_AI_NAME_MISMATCH"); + + /** The value {@code "DOCUMENT_AI_UNSUPPORTED_FILE"}. */ + public static final Risk DOCUMENT_AI_UNSUPPORTED_FILE = new Risk("DOCUMENT_AI_UNSUPPORTED_FILE"); + + private static final List KNOWN_VALUES = List.of(DOCUMENT_AI_UNREADABLE_DOCUMENT, DOCUMENT_AI_MISSING_REQUIRED_FIELDS, DOCUMENT_AI_SUSPECTED_MANIPULATION, DOCUMENT_AI_NAME_MISMATCH, DOCUMENT_AI_UNSUPPORTED_FILE); + + private Risk(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Risk of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Risk::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Feature that raised the warning. Always DOCUMENT_AI on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + private static final List KNOWN_VALUES = List.of(DOCUMENT_AI); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity derived from the configured action: error (DECLINE), warning (REVIEW), information (NO_ACTION). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/EmailCheckCodeParams.java b/src/main/java/me/didit/types/EmailCheckCodeParams.java new file mode 100644 index 0000000..d5f8173 --- /dev/null +++ b/src/main/java/me/didit/types/EmailCheckCodeParams.java @@ -0,0 +1,395 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code email.check_code}. */ +public final class EmailCheckCodeParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "code", "duplicated_email_action", "breached_email_action", "disposable_email_action", "enable_social", "email_no_social_presence_action"); + + private EmailCheckCodeParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailCheckCodeParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailCheckCodeParams fromJson(JsonNode json) { + return new EmailCheckCodeParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The same email address used in the matching [POST /v3/email/send/](/standalone-apis/email-send) call. This is what links the check to the send. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * The OTP the end user received: 4โ€“8 digits, or 4โ€“8 letters/digits when alphanumeric_code: true was used at send time. Comparison is case-insensitive. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String code() { + return Json.required(json, "code", Conv.STRING); + } + + /** + * What to do when the same address was already used and approved by a different user (only previously Approved verifications count) (different vendor_data) of your application. DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings and fills email.matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional duplicatedEmailAction() { + return Json.optional(json, "duplicated_email_action", Conv.enumeration(EmailCheckCodeParams.DuplicatedEmailAction::of)); + } + + /** + * What to do when the address appears in known data breaches (email.is_breached). DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachedEmailAction() { + return Json.optional(json, "breached_email_action", Conv.enumeration(EmailCheckCodeParams.BreachedEmailAction::of)); + } + + /** + * What to do when the domain belongs to a disposable/temporary-mail provider (email.is_disposable). DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disposableEmailAction() { + return Json.optional(json, "disposable_email_action", Conv.enumeration(EmailCheckCodeParams.DisposableEmailAction::of)); + } + + /** + * When true, also look up the social footprint of the address - the email, social, professional, e-commerce and entertainment platforms it is registered on. Billed as one email_social unit per request in addition to this endpoint's own price. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enableSocial() { + return Json.optional(json, "enable_social", Conv.BOOLEAN); + } + + /** + * Action when the social footprint check finds the address registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint; REVIEW is available on the workflow configuration key of the same name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailNoSocialPresenceAction() { + return Json.optional(json, "email_no_social_presence_action", Conv.enumeration(EmailCheckCodeParams.EmailNoSocialPresenceAction::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailCheckCodeParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailCheckCodeParams from) { + super(from); + } + + /** + * The same email address used in the matching [POST /v3/email/send/](/standalone-apis/email-send) call. This is what links the check to the send. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * The OTP the end user received: 4โ€“8 digits, or 4โ€“8 letters/digits when alphanumeric_code: true was used at send time. Comparison is case-insensitive. + * + * @param code the value + * @return this builder + */ + public Builder code(String code) { + return set("code", Conv.STRING, code); + } + + /** + * What to do when the same address was already used and approved by a different user (only previously Approved verifications count) (different vendor_data) of your application. DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings and fills email.matches. + * + * @param duplicatedEmailAction the value + * @return this builder + */ + public Builder duplicatedEmailAction(EmailCheckCodeParams.DuplicatedEmailAction duplicatedEmailAction) { + return set("duplicated_email_action", Conv.enumeration(EmailCheckCodeParams.DuplicatedEmailAction::of), duplicatedEmailAction); + } + + /** + * What to do when the address appears in known data breaches (email.is_breached). DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings. + * + * @param breachedEmailAction the value + * @return this builder + */ + public Builder breachedEmailAction(EmailCheckCodeParams.BreachedEmailAction breachedEmailAction) { + return set("breached_email_action", Conv.enumeration(EmailCheckCodeParams.BreachedEmailAction::of), breachedEmailAction); + } + + /** + * What to do when the domain belongs to a disposable/temporary-mail provider (email.is_disposable). DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings. + * + * @param disposableEmailAction the value + * @return this builder + */ + public Builder disposableEmailAction(EmailCheckCodeParams.DisposableEmailAction disposableEmailAction) { + return set("disposable_email_action", Conv.enumeration(EmailCheckCodeParams.DisposableEmailAction::of), disposableEmailAction); + } + + /** + * When true, also look up the social footprint of the address - the email, social, professional, e-commerce and entertainment platforms it is registered on. Billed as one email_social unit per request in addition to this endpoint's own price. + * + * @param enableSocial the value + * @return this builder + */ + public Builder enableSocial(boolean enableSocial) { + return set("enable_social", Conv.BOOLEAN, enableSocial); + } + + /** + * Action when the social footprint check finds the address registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint; REVIEW is available on the workflow configuration key of the same name. + * + * @param emailNoSocialPresenceAction the value + * @return this builder + */ + public Builder emailNoSocialPresenceAction(EmailCheckCodeParams.EmailNoSocialPresenceAction emailNoSocialPresenceAction) { + return set("email_no_social_presence_action", Conv.enumeration(EmailCheckCodeParams.EmailNoSocialPresenceAction::of), emailNoSocialPresenceAction); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailCheckCodeParams} + * @throws IllegalStateException when a required field is missing + */ + public EmailCheckCodeParams build() { + require("email", false); + require("code", false); + return new EmailCheckCodeParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What to do when the same address was already used and approved by a different user (only previously Approved verifications count) (different vendor_data) of your application. DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings and fills email.matches. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DuplicatedEmailAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final DuplicatedEmailAction NO_ACTION = new DuplicatedEmailAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final DuplicatedEmailAction DECLINE = new DuplicatedEmailAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private DuplicatedEmailAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DuplicatedEmailAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DuplicatedEmailAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the address appears in known data breaches (email.is_breached). DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class BreachedEmailAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final BreachedEmailAction NO_ACTION = new BreachedEmailAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final BreachedEmailAction DECLINE = new BreachedEmailAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private BreachedEmailAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static BreachedEmailAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, BreachedEmailAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the domain belongs to a disposable/temporary-mail provider (email.is_disposable). DECLINE flips the final status to Declined; NO_ACTION records the risk in email.warnings. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DisposableEmailAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final DisposableEmailAction NO_ACTION = new DisposableEmailAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final DisposableEmailAction DECLINE = new DisposableEmailAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private DisposableEmailAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DisposableEmailAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DisposableEmailAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Action when the social footprint check finds the address registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint; REVIEW is available on the workflow configuration key of the same name. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EmailNoSocialPresenceAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final EmailNoSocialPresenceAction NO_ACTION = new EmailNoSocialPresenceAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final EmailNoSocialPresenceAction DECLINE = new EmailNoSocialPresenceAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private EmailNoSocialPresenceAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EmailNoSocialPresenceAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EmailNoSocialPresenceAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/EmailIntelligence.java b/src/main/java/me/didit/types/EmailIntelligence.java new file mode 100644 index 0000000..9e32784 --- /dev/null +++ b/src/main/java/me/didit/types/EmailIntelligence.java @@ -0,0 +1,302 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Normalized email-intelligence block. Present only when the intelligence add-on ran for this email; when present it is also exposed as the enrichment alias with identical values. + */ +public final class EmailIntelligence extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "deliverable", "breach_risk_level", "breach_risk_index", "is_recent_breach", "is_frequent_breached", "is_disposable", "is_free_domain", "is_breached", "no_of_breaches", "reason_codes"); + + private EmailIntelligence(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailIntelligence} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailIntelligence fromJson(JsonNode json) { + return new EmailIntelligence(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Normalized 0-100 risk score. Higher is riskier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Deliverability band (e.g., high). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deliverable() { + return Json.optional(json, "deliverable", Conv.STRING); + } + + /** + * Low, Medium or High. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachRiskLevel() { + return Json.optional(json, "breach_risk_level", Conv.STRING); + } + + /** + * Numeric breach-risk index. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachRiskIndex() { + return Json.optional(json, "breach_risk_index", Conv.DOUBLE); + } + + /** + * true when the address appears in a recent breach. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isRecentBreach() { + return Json.optional(json, "is_recent_breach", Conv.BOOLEAN); + } + + /** + * true when the address appears in many breaches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFrequentBreached() { + return Json.optional(json, "is_frequent_breached", Conv.BOOLEAN); + } + + /** + * true when the domain is a throwaway provider. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * true when the domain is a free mail provider. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFreeDomain() { + return Json.optional(json, "is_free_domain", Conv.BOOLEAN); + } + + /** + * true when the address appears in known breaches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBreached() { + return Json.optional(json, "is_breached", Conv.BOOLEAN); + } + + /** + * Number of known breaches containing the address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional noOfBreaches() { + return Json.optional(json, "no_of_breaches", Conv.DOUBLE); + } + + /** + * Machine-readable codes explaining the score. Values can grow over time, so do not reject unknown codes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reasonCodes() { + return Json.optional(json, "reason_codes", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailIntelligence}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailIntelligence from) { + super(from); + } + + /** + * Normalized 0-100 risk score. Higher is riskier. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Deliverability band (e.g., high). + * + * @param deliverable the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deliverable(@Nullable String deliverable) { + return setNullable("deliverable", Conv.STRING, deliverable); + } + + /** + * Low, Medium or High. + * + * @param breachRiskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder breachRiskLevel(@Nullable String breachRiskLevel) { + return setNullable("breach_risk_level", Conv.STRING, breachRiskLevel); + } + + /** + * Numeric breach-risk index. + * + * @param breachRiskIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder breachRiskIndex(@Nullable Double breachRiskIndex) { + return setNullable("breach_risk_index", Conv.DOUBLE, breachRiskIndex); + } + + /** + * true when the address appears in a recent breach. + * + * @param isRecentBreach the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isRecentBreach(@Nullable Boolean isRecentBreach) { + return setNullable("is_recent_breach", Conv.BOOLEAN, isRecentBreach); + } + + /** + * true when the address appears in many breaches. + * + * @param isFrequentBreached the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isFrequentBreached(@Nullable Boolean isFrequentBreached) { + return setNullable("is_frequent_breached", Conv.BOOLEAN, isFrequentBreached); + } + + /** + * true when the domain is a throwaway provider. + * + * @param isDisposable the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDisposable(@Nullable Boolean isDisposable) { + return setNullable("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * true when the domain is a free mail provider. + * + * @param isFreeDomain the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isFreeDomain(@Nullable Boolean isFreeDomain) { + return setNullable("is_free_domain", Conv.BOOLEAN, isFreeDomain); + } + + /** + * true when the address appears in known breaches. + * + * @param isBreached the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isBreached(@Nullable Boolean isBreached) { + return setNullable("is_breached", Conv.BOOLEAN, isBreached); + } + + /** + * Number of known breaches containing the address. + * + * @param noOfBreaches the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder noOfBreaches(@Nullable Double noOfBreaches) { + return setNullable("no_of_breaches", Conv.DOUBLE, noOfBreaches); + } + + /** + * Machine-readable codes explaining the score. Values can grow over time, so do not reject unknown codes. + * + * @param reasonCodes the value + * @return this builder + */ + public Builder reasonCodes(List reasonCodes) { + return set("reason_codes", Conv.list(Conv.STRING), reasonCodes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailIntelligence} + */ + public EmailIntelligence build() { + return new EmailIntelligence(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/EmailMatchItem.java b/src/main/java/me/didit/types/EmailMatchItem.java new file mode 100644 index 0000000..4991dc0 --- /dev/null +++ b/src/main/java/me/didit/types/EmailMatchItem.java @@ -0,0 +1,262 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Another session of your application that used the same email address with a different vendor_data. + */ +public final class EmailMatchItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "email", "status", "is_blocklisted", "api_service", "source"); + + private EmailMatchItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailMatchItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailMatchItem fromJson(JsonNode json) { + return new EmailMatchItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session id of the other verification that used this email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Human-friendly sequential number of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * vendor_data of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.STRING); + } + + /** + * The matched email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the email address is on your application's blocklist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * For API-type sessions, the standalone API that created it; null for regular verification sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry uses list_entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailMatchItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailMatchItem from) { + super(from); + } + + /** + * Session id of the other verification that used this email address. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Human-friendly sequential number of that session. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * vendor_data of that session. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @param verificationDate the value + * @return this builder + */ + public Builder verificationDate(String verificationDate) { + return set("verification_date", Conv.STRING, verificationDate); + } + + /** + * The matched email address. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Whether the email address is on your application's blocklist. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * For API-type sessions, the standalone API that created it; null for regular verification sessions. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry uses list_entry. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailMatchItem} + */ + public EmailMatchItem build() { + return new EmailMatchItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/EmailRiskRequest.java b/src/main/java/me/didit/types/EmailRiskRequest.java new file mode 100644 index 0000000..33bddac --- /dev/null +++ b/src/main/java/me/didit/types/EmailRiskRequest.java @@ -0,0 +1,201 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class EmailRiskRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "country_code", "signals", "vendor_data", "metadata", "enable_social"); + + private EmailRiskRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailRiskRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailRiskRequest fromJson(JsonNode json) { + return new EmailRiskRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Email address to score. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * Optional ISO 3166-1 alpha-2 or alpha-3 country hint for intelligence coverage. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Optional device and network context observed by your application. All fields are optional. Passing them feeds cross-session match detection in Networks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signals() { + return Json.optional(json, "signals", Conv.model(RiskSignals::fromJson)); + } + + /** + * Your stable reference for this request. Stored on the API session and echoed in the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Your non-sensitive JSON metadata. Stored on the API session and echoed in the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * When true, also look up the social footprint of the address - the email, social, professional, e-commerce and entertainment platforms it is registered on. Billed as one email_social unit per request in addition to this endpoint's own price. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enableSocial() { + return Json.optional(json, "enable_social", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailRiskRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailRiskRequest from) { + super(from); + } + + /** + * Email address to score. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Optional ISO 3166-1 alpha-2 or alpha-3 country hint for intelligence coverage. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Optional device and network context observed by your application. All fields are optional. Passing them feeds cross-session match detection in Networks. + * + * @param signals the value + * @return this builder + */ + public Builder signals(RiskSignals signals) { + return set("signals", Conv.model(RiskSignals::fromJson), signals); + } + + /** + * Your stable reference for this request. Stored on the API session and echoed in the response. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Your non-sensitive JSON metadata. Stored on the API session and echoed in the response. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * When true, also look up the social footprint of the address - the email, social, professional, e-commerce and entertainment platforms it is registered on. Billed as one email_social unit per request in addition to this endpoint's own price. + * + * @param enableSocial the value + * @return this builder + */ + public Builder enableSocial(boolean enableSocial) { + return set("enable_social", Conv.BOOLEAN, enableSocial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailRiskRequest} + * @throws IllegalStateException when a required field is missing + */ + public EmailRiskRequest build() { + require("email", false); + return new EmailRiskRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/EmailRiskResponse.java b/src/main/java/me/didit/types/EmailRiskResponse.java new file mode 100644 index 0000000..eb596fa --- /dev/null +++ b/src/main/java/me/didit/types/EmailRiskResponse.java @@ -0,0 +1,876 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class EmailRiskResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "vendor_data", "metadata", "created_at", "email"); + + private EmailRiskResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailRiskResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailRiskResponse fromJson(JsonNode json) { + return new EmailRiskResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the API session created for this request. Store it with vendor_data if you need to correlate the result with later webhooks or console activity. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * Final decision for this API session. Normally Approved; the risk evaluation can produce In Review or Declined. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public EmailRiskResponse.Status status() { + return Json.required(json, "status", Conv.enumeration(EmailRiskResponse.Status::of)); + } + + /** + * Echo of the vendor_data you sent, null when you did not send one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent, null when you did not send one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Timestamp of this response. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * Normalized email report, the same block used by Email Verification responses. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.model(EmailRiskResponse.Email::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailRiskResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailRiskResponse from) { + super(from); + } + + /** + * Id of the API session created for this request. Store it with vendor_data if you need to correlate the result with later webhooks or console activity. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Final decision for this API session. Normally Approved; the risk evaluation can produce In Review or Declined. + * + * @param status the value + * @return this builder + */ + public Builder status(EmailRiskResponse.Status status) { + return set("status", Conv.enumeration(EmailRiskResponse.Status::of), status); + } + + /** + * Echo of the vendor_data you sent, null when you did not send one. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent, null when you did not send one. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Timestamp of this response. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Normalized email report, the same block used by Email Verification responses. + * + * @param email the value + * @return this builder + */ + public Builder email(EmailRiskResponse.Email email) { + return set("email", Conv.model(EmailRiskResponse.Email::fromJson), email); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailRiskResponse} + * @throws IllegalStateException when a required field is missing + */ + public EmailRiskResponse build() { + require("request_id", false); + require("status", false); + require("created_at", false); + return new EmailRiskResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Final decision for this API session. Normally Approved; the risk evaluation can produce In Review or Declined. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Normalized email report, the same block used by Email Verification responses. */ + public static final class Email extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "email", "is_breached", "breaches", "is_disposable", "is_undeliverable", "verification_attempts", "verified_at", "warnings", "lifecycle", "matches", "email_intelligence", "enrichment", "email_social"); + + private Email(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Email} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Email fromJson(JsonNode json) { + return new Email(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Decision for this email address. Mirrors the top-level status. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public EmailRiskResponse.Email.Status status() { + return Json.required(json, "status", Conv.enumeration(EmailRiskResponse.Email.Status::of)); + } + + /** + * The scored address. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * Whether the address appears in a known credential breach. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isBreached() { + return Json.required(json, "is_breached", Conv.BOOLEAN); + } + + /** + * Up to 5 most recent known breaches containing this address. Empty array when is_breached is false. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List breaches() { + return Json.required(json, "breaches", Conv.list(Conv.model(EmailRiskResponse.Email.Breaches::fromJson))); + } + + /** + * Whether the domain belongs to a throwaway provider. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isDisposable() { + return Json.required(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * Whether the address was found undeliverable. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isUndeliverable() { + return Json.required(json, "is_undeliverable", Conv.BOOLEAN); + } + + /** + * OTP sends for this address. 0 for risk lookups. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationAttempts() { + return Json.optional(json, "verification_attempts", Conv.LONG); + } + + /** + * When the address was last verified by an OTP. null for risk lookups. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * Risk warnings recorded for this request. Empty array when there are none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(RiskWarning::fromJson))); + } + + /** + * Chronological audit trail of the request. Empty array for risk lookups without sends. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lifecycle() { + return Json.optional(json, "lifecycle", Conv.list(Conv.model(RiskLifecycleEvent::fromJson))); + } + + /** + * Other sessions of your application where the same email address was used by a different user (different vendor_data). Up to 5 entries. Empty array when there are no matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(EmailMatchItem::fromJson))); + } + + /** + * Normalized email-intelligence block. Present only when the intelligence add-on ran for this email; when present it is also exposed as the enrichment alias with identical values. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailIntelligence() { + return Json.optional(json, "email_intelligence", Conv.model(EmailIntelligence::fromJson)); + } + + /** + * Normalized email-intelligence block. Present only when the intelligence add-on ran for this email; when present it is also exposed as the enrichment alias with identical values. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enrichment() { + return Json.optional(json, "enrichment", Conv.model(EmailIntelligence::fromJson)); + } + + /** + * Social footprint of the email address: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the email address was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailSocial() { + return Json.optional(json, "email_social", Conv.model(EmailSocialFootprint::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Email}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Email from) { + super(from); + } + + /** + * Decision for this email address. Mirrors the top-level status. + * + * @param status the value + * @return this builder + */ + public Builder status(EmailRiskResponse.Email.Status status) { + return set("status", Conv.enumeration(EmailRiskResponse.Email.Status::of), status); + } + + /** + * The scored address. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Whether the address appears in a known credential breach. + * + * @param isBreached the value + * @return this builder + */ + public Builder isBreached(boolean isBreached) { + return set("is_breached", Conv.BOOLEAN, isBreached); + } + + /** + * Up to 5 most recent known breaches containing this address. Empty array when is_breached is false. + * + * @param breaches the value + * @return this builder + */ + public Builder breaches(List breaches) { + return set("breaches", Conv.list(Conv.model(EmailRiskResponse.Email.Breaches::fromJson)), breaches); + } + + /** + * Whether the domain belongs to a throwaway provider. + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * Whether the address was found undeliverable. + * + * @param isUndeliverable the value + * @return this builder + */ + public Builder isUndeliverable(boolean isUndeliverable) { + return set("is_undeliverable", Conv.BOOLEAN, isUndeliverable); + } + + /** + * OTP sends for this address. 0 for risk lookups. + * + * @param verificationAttempts the value + * @return this builder + */ + public Builder verificationAttempts(long verificationAttempts) { + return set("verification_attempts", Conv.LONG, verificationAttempts); + } + + /** + * When the address was last verified by an OTP. null for risk lookups. + * + * @param verifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verifiedAt(@Nullable OffsetDateTime verifiedAt) { + return setNullable("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Risk warnings recorded for this request. Empty array when there are none. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(RiskWarning::fromJson)), warnings); + } + + /** + * Chronological audit trail of the request. Empty array for risk lookups without sends. + * + * @param lifecycle the value + * @return this builder + */ + public Builder lifecycle(List lifecycle) { + return set("lifecycle", Conv.list(Conv.model(RiskLifecycleEvent::fromJson)), lifecycle); + } + + /** + * Other sessions of your application where the same email address was used by a different user (different vendor_data). Up to 5 entries. Empty array when there are no matches. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(EmailMatchItem::fromJson)), matches); + } + + /** + * Normalized email-intelligence block. Present only when the intelligence add-on ran for this email; when present it is also exposed as the enrichment alias with identical values. + * + * @param emailIntelligence the value + * @return this builder + */ + public Builder emailIntelligence(EmailIntelligence emailIntelligence) { + return set("email_intelligence", Conv.model(EmailIntelligence::fromJson), emailIntelligence); + } + + /** + * Normalized email-intelligence block. Present only when the intelligence add-on ran for this email; when present it is also exposed as the enrichment alias with identical values. + * + * @param enrichment the value + * @return this builder + */ + public Builder enrichment(EmailIntelligence enrichment) { + return set("enrichment", Conv.model(EmailIntelligence::fromJson), enrichment); + } + + /** + * Social footprint of the email address: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the email address was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @param emailSocial the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder emailSocial(@Nullable EmailSocialFootprint emailSocial) { + return setNullable("email_social", Conv.model(EmailSocialFootprint::fromJson), emailSocial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Email} + * @throws IllegalStateException when a required field is missing + */ + public Email build() { + require("status", false); + require("email", false); + require("is_breached", false); + require("breaches", false); + require("is_disposable", false); + require("is_undeliverable", false); + return new Email(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Decision for this email address. Mirrors the top-level status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Breaches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "domain", "breach_date", "breach_emails_count", "description", "logo_path", "data_classes", "is_verified"); + + private Breaches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Breaches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Breaches fromJson(JsonNode json) { + return new Breaches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Breach identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Domain of the breached service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional domain() { + return Json.optional(json, "domain", Conv.STRING); + } + + /** + * Date the breach occurred. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachDate() { + return Json.optional(json, "breach_date", Conv.DATE); + } + + /** + * Total number of accounts exposed in the breach. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachEmailsCount() { + return Json.optional(json, "breach_emails_count", Conv.LONG); + } + + /** + * Human-readable description of the breach (may contain HTML markup). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * URL of the breached service's logo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logoPath() { + return Json.optional(json, "logo_path", Conv.STRING); + } + + /** + * Categories of data exposed, in snake_case (e.g., email_addresses, passwords). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> dataClasses() { + return Json.optional(json, "data_classes", Conv.list(Conv.STRING)); + } + + /** + * Whether the breach has been verified as legitimate. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVerified() { + return Json.optional(json, "is_verified", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Breaches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Breaches from) { + super(from); + } + + /** + * Breach identifier. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Domain of the breached service. + * + * @param domain the value + * @return this builder + */ + public Builder domain(String domain) { + return set("domain", Conv.STRING, domain); + } + + /** + * Date the breach occurred. + * + * @param breachDate the value + * @return this builder + */ + public Builder breachDate(LocalDate breachDate) { + return set("breach_date", Conv.DATE, breachDate); + } + + /** + * Total number of accounts exposed in the breach. + * + * @param breachEmailsCount the value + * @return this builder + */ + public Builder breachEmailsCount(long breachEmailsCount) { + return set("breach_emails_count", Conv.LONG, breachEmailsCount); + } + + /** + * Human-readable description of the breach (may contain HTML markup). + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * URL of the breached service's logo. + * + * @param logoPath the value + * @return this builder + */ + public Builder logoPath(String logoPath) { + return set("logo_path", Conv.STRING, logoPath); + } + + /** + * Categories of data exposed, in snake_case (e.g., email_addresses, passwords). + * + * @param dataClasses the value + * @return this builder + */ + public Builder dataClasses(List dataClasses) { + return set("data_classes", Conv.list(Conv.STRING), dataClasses); + } + + /** + * Whether the breach has been verified as legitimate. + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Breaches} + */ + public Breaches build() { + return new Breaches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/EmailSendCodeParams.java b/src/main/java/me/didit/types/EmailSendCodeParams.java new file mode 100644 index 0000000..6526df2 --- /dev/null +++ b/src/main/java/me/didit/types/EmailSendCodeParams.java @@ -0,0 +1,788 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code email.send_code}. */ +public final class EmailSendCodeParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "options", "signals", "vendor_data", "metadata"); + + private EmailSendCodeParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailSendCodeParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailSendCodeParams fromJson(JsonNode json) { + return new EmailSendCodeParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Recipient email address. Malformed addresses return 400; syntactically valid addresses that cannot receive mail (failed DNS/MX validation) return 200 with status: "Undeliverable". + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * OTP format, localization, and branding options. All fields are optional. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional options() { + return Json.optional(json, "options", Conv.model(EmailSendCodeParams.Options::fromJson)); + } + + /** + * Optional device and network signals about the end user, forwarded to the anti-fraud layer to improve detection of abusive or automated traffic. All fields are optional. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signals() { + return Json.optional(json, "signals", Conv.model(EmailSendCodeParams.Signals::fromJson)); + } + + /** + * Optional caller-controlled identifier (your internal user id, an email, a UUID, etc.) persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. Use it to correlate Didit's request_id with your user record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional free-form JSON object persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailSendCodeParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailSendCodeParams from) { + super(from); + } + + /** + * Recipient email address. Malformed addresses return 400; syntactically valid addresses that cannot receive mail (failed DNS/MX validation) return 200 with status: "Undeliverable". + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * OTP format, localization, and branding options. All fields are optional. + * + * @param options_ the value + * @return this builder + */ + public Builder options(EmailSendCodeParams.Options options_) { + return set("options", Conv.model(EmailSendCodeParams.Options::fromJson), options_); + } + + /** + * Optional device and network signals about the end user, forwarded to the anti-fraud layer to improve detection of abusive or automated traffic. All fields are optional. + * + * @param signals the value + * @return this builder + */ + public Builder signals(EmailSendCodeParams.Signals signals) { + return set("signals", Conv.model(EmailSendCodeParams.Signals::fromJson), signals); + } + + /** + * Optional caller-controlled identifier (your internal user id, an email, a UUID, etc.) persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. Use it to correlate Didit's request_id with your user record. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional free-form JSON object persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailSendCodeParams} + * @throws IllegalStateException when a required field is missing + */ + public EmailSendCodeParams build() { + require("email", false); + return new EmailSendCodeParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** OTP format, localization, and branding options. All fields are optional. */ + public static final class Options extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("code_size", "alphanumeric_code", "locale", "use_white_label_customization"); + + private Options(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Options} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Options fromJson(JsonNode json) { + return new Options(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of characters in the OTP (digits by default; uppercase letters and digits when alphanumeric_code is true). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional codeSize() { + return Json.optional(json, "code_size", Conv.LONG); + } + + /** + * When true, the OTP is composed of uppercase letters Aโ€“Z and digits 0โ€“9 instead of digits only. The /v3/email/check/ comparison is case-insensitive. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alphanumericCode() { + return Json.optional(json, "alphanumeric_code", Conv.BOOLEAN); + } + + /** + * Language of the OTP email template. Defaults to en. Unsupported values return 400 listing all supported locales. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locale() { + return Json.optional(json, "locale", Conv.enumeration(EmailSendCodeParams.Options.Locale::of)); + } + + /** + * When true, the OTP email uses your application's white-label customization (logo, colors, sender branding) instead of the default Didit template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional useWhiteLabelCustomization() { + return Json.optional(json, "use_white_label_customization", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Options}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Options from) { + super(from); + } + + /** + * Number of characters in the OTP (digits by default; uppercase letters and digits when alphanumeric_code is true). + * + * @param codeSize the value + * @return this builder + */ + public Builder codeSize(long codeSize) { + return set("code_size", Conv.LONG, codeSize); + } + + /** + * When true, the OTP is composed of uppercase letters Aโ€“Z and digits 0โ€“9 instead of digits only. The /v3/email/check/ comparison is case-insensitive. + * + * @param alphanumericCode the value + * @return this builder + */ + public Builder alphanumericCode(boolean alphanumericCode) { + return set("alphanumeric_code", Conv.BOOLEAN, alphanumericCode); + } + + /** + * Language of the OTP email template. Defaults to en. Unsupported values return 400 listing all supported locales. + * + * @param locale the value + * @return this builder + */ + public Builder locale(EmailSendCodeParams.Options.Locale locale) { + return set("locale", Conv.enumeration(EmailSendCodeParams.Options.Locale::of), locale); + } + + /** + * When true, the OTP email uses your application's white-label customization (logo, colors, sender branding) instead of the default Didit template. + * + * @param useWhiteLabelCustomization the value + * @return this builder + */ + public Builder useWhiteLabelCustomization(boolean useWhiteLabelCustomization) { + return set("use_white_label_customization", Conv.BOOLEAN, useWhiteLabelCustomization); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Options} + */ + public Options build() { + return new Options(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Language of the OTP email template. Defaults to en. Unsupported values return 400 listing all supported locales. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Locale extends StringEnum { + /** The value {@code "en"}. */ + public static final Locale EN = new Locale("en"); + + /** The value {@code "ar"}. */ + public static final Locale AR = new Locale("ar"); + + /** The value {@code "bn"}. */ + public static final Locale BN = new Locale("bn"); + + /** The value {@code "bg"}. */ + public static final Locale BG = new Locale("bg"); + + /** The value {@code "bs"}. */ + public static final Locale BS = new Locale("bs"); + + /** The value {@code "ca"}. */ + public static final Locale CA = new Locale("ca"); + + /** The value {@code "cs"}. */ + public static final Locale CS = new Locale("cs"); + + /** The value {@code "da"}. */ + public static final Locale DA = new Locale("da"); + + /** The value {@code "de"}. */ + public static final Locale DE = new Locale("de"); + + /** The value {@code "el"}. */ + public static final Locale EL = new Locale("el"); + + /** The value {@code "es"}. */ + public static final Locale ES = new Locale("es"); + + /** The value {@code "et"}. */ + public static final Locale ET = new Locale("et"); + + /** The value {@code "fa"}. */ + public static final Locale FA = new Locale("fa"); + + /** The value {@code "fi"}. */ + public static final Locale FI = new Locale("fi"); + + /** The value {@code "fr"}. */ + public static final Locale FR = new Locale("fr"); + + /** The value {@code "he"}. */ + public static final Locale HE = new Locale("he"); + + /** The value {@code "hi"}. */ + public static final Locale HI = new Locale("hi"); + + /** The value {@code "hr"}. */ + public static final Locale HR = new Locale("hr"); + + /** The value {@code "hu"}. */ + public static final Locale HU = new Locale("hu"); + + /** The value {@code "hy"}. */ + public static final Locale HY = new Locale("hy"); + + /** The value {@code "id"}. */ + public static final Locale ID = new Locale("id"); + + /** The value {@code "it"}. */ + public static final Locale IT = new Locale("it"); + + /** The value {@code "ja"}. */ + public static final Locale JA = new Locale("ja"); + + /** The value {@code "ka"}. */ + public static final Locale KA = new Locale("ka"); + + /** The value {@code "kk"}. */ + public static final Locale KK = new Locale("kk"); + + /** The value {@code "ko"}. */ + public static final Locale KO = new Locale("ko"); + + /** The value {@code "ky"}. */ + public static final Locale KY = new Locale("ky"); + + /** The value {@code "lt"}. */ + public static final Locale LT = new Locale("lt"); + + /** The value {@code "lv"}. */ + public static final Locale LV = new Locale("lv"); + + /** The value {@code "cnr"}. */ + public static final Locale CNR = new Locale("cnr"); + + /** The value {@code "mk"}. */ + public static final Locale MK = new Locale("mk"); + + /** The value {@code "mn"}. */ + public static final Locale MN = new Locale("mn"); + + /** The value {@code "ms"}. */ + public static final Locale MS = new Locale("ms"); + + /** The value {@code "nl"}. */ + public static final Locale NL = new Locale("nl"); + + /** The value {@code "no"}. */ + public static final Locale NO = new Locale("no"); + + /** The value {@code "pl"}. */ + public static final Locale PL = new Locale("pl"); + + /** The value {@code "pt-BR"}. */ + public static final Locale PT_BR = new Locale("pt-BR"); + + /** The value {@code "pt"}. */ + public static final Locale PT = new Locale("pt"); + + /** The value {@code "ro"}. */ + public static final Locale RO = new Locale("ro"); + + /** The value {@code "ru"}. */ + public static final Locale RU = new Locale("ru"); + + /** The value {@code "sk"}. */ + public static final Locale SK = new Locale("sk"); + + /** The value {@code "sl"}. */ + public static final Locale SL = new Locale("sl"); + + /** The value {@code "so"}. */ + public static final Locale SO = new Locale("so"); + + /** The value {@code "sq"}. */ + public static final Locale SQ = new Locale("sq"); + + /** The value {@code "sr"}. */ + public static final Locale SR = new Locale("sr"); + + /** The value {@code "sv"}. */ + public static final Locale SV = new Locale("sv"); + + /** The value {@code "th"}. */ + public static final Locale TH = new Locale("th"); + + /** The value {@code "tr"}. */ + public static final Locale TR = new Locale("tr"); + + /** The value {@code "uk"}. */ + public static final Locale UK = new Locale("uk"); + + /** The value {@code "uz"}. */ + public static final Locale UZ = new Locale("uz"); + + /** The value {@code "vi"}. */ + public static final Locale VI = new Locale("vi"); + + /** The value {@code "zh-CN"}. */ + public static final Locale ZH_CN = new Locale("zh-CN"); + + /** The value {@code "zh-TW"}. */ + public static final Locale ZH_TW = new Locale("zh-TW"); + + /** The value {@code "zh"}. */ + public static final Locale ZH = new Locale("zh"); + + private static final List KNOWN_VALUES = List.of(EN, AR, BN, BG, BS, CA, CS, DA, DE, EL, ES, ET, FA, FI, FR, HE, HI, HR, HU, HY, ID, IT, JA, KA, KK, KO, KY, LT, LV, CNR, MK, MN, MS, NL, NO, PL, PT_BR, PT, RO, RU, SK, SL, SO, SQ, SR, SV, TH, TR, UK, UZ, VI, ZH_CN, ZH_TW, ZH); + + private Locale(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Locale of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Locale::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Optional device and network signals about the end user, forwarded to the anti-fraud layer to improve detection of abusive or automated traffic. All fields are optional. + */ + public static final class Signals extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip", "device_id", "device_platform", "device_model", "os_version", "app_version", "user_agent"); + + private Signals(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Signals} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Signals fromJson(JsonNode json) { + return new Signals(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * IP address of the end user's device. IPv4 or IPv6. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ip() { + return Json.optional(json, "ip", Conv.STRING); + } + + /** + * Unique identifier of the end user's device. Android: ANDROID_ID; iOS: identifierForVendor. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceId() { + return Json.optional(json, "device_id", Conv.STRING); + } + + /** + * Platform of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional devicePlatform() { + return Json.optional(json, "device_platform", Conv.enumeration(EmailSendCodeParams.Signals.DevicePlatform::of)); + } + + /** + * Model of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceModel() { + return Json.optional(json, "device_model", Conv.STRING); + } + + /** + * Operating-system version of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osVersion() { + return Json.optional(json, "os_version", Conv.STRING); + } + + /** + * Version of your application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appVersion() { + return Json.optional(json, "app_version", Conv.STRING); + } + + /** + * User agent of the end user's browser or app. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Signals}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Signals from) { + super(from); + } + + /** + * IP address of the end user's device. IPv4 or IPv6. + * + * @param ip the value + * @return this builder + */ + public Builder ip(String ip) { + return set("ip", Conv.STRING, ip); + } + + /** + * Unique identifier of the end user's device. Android: ANDROID_ID; iOS: identifierForVendor. + * + * @param deviceId the value + * @return this builder + */ + public Builder deviceId(String deviceId) { + return set("device_id", Conv.STRING, deviceId); + } + + /** + * Platform of the end user's device. + * + * @param devicePlatform the value + * @return this builder + */ + public Builder devicePlatform(EmailSendCodeParams.Signals.DevicePlatform devicePlatform) { + return set("device_platform", Conv.enumeration(EmailSendCodeParams.Signals.DevicePlatform::of), devicePlatform); + } + + /** + * Model of the end user's device. + * + * @param deviceModel the value + * @return this builder + */ + public Builder deviceModel(String deviceModel) { + return set("device_model", Conv.STRING, deviceModel); + } + + /** + * Operating-system version of the end user's device. + * + * @param osVersion the value + * @return this builder + */ + public Builder osVersion(String osVersion) { + return set("os_version", Conv.STRING, osVersion); + } + + /** + * Version of your application. + * + * @param appVersion the value + * @return this builder + */ + public Builder appVersion(String appVersion) { + return set("app_version", Conv.STRING, appVersion); + } + + /** + * User agent of the end user's browser or app. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Signals} + */ + public Signals build() { + return new Signals(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Platform of the end user's device. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DevicePlatform extends StringEnum { + /** The value {@code "android"}. */ + public static final DevicePlatform ANDROID = new DevicePlatform("android"); + + /** The value {@code "ios"}. */ + public static final DevicePlatform IOS = new DevicePlatform("ios"); + + /** The value {@code "ipados"}. */ + public static final DevicePlatform IPADOS = new DevicePlatform("ipados"); + + /** The value {@code "tvos"}. */ + public static final DevicePlatform TVOS = new DevicePlatform("tvos"); + + /** The value {@code "web"}. */ + public static final DevicePlatform WEB = new DevicePlatform("web"); + + private static final List KNOWN_VALUES = List.of(ANDROID, IOS, IPADOS, TVOS, WEB); + + private DevicePlatform(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DevicePlatform of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DevicePlatform::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/EmailSocialFootprint.java b/src/main/java/me/didit/types/EmailSocialFootprint.java new file mode 100644 index 0000000..04225c9 --- /dev/null +++ b/src/main/java/me/didit/types/EmailSocialFootprint.java @@ -0,0 +1,472 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Social footprint of the email address: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the email address was found on none of them - a valid, billable answer and a common synthetic-identity signal. + */ +public final class EmailSocialFootprint extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("profiles_registered", "profiles_checked", "names_found", "photos_found", "communication_breadth", "digital_footprint_diversity", "digital_sophistication_index", "engagement_depth_index", "subscription_affordability_index", "free_platforms", "full_paid_platforms", "partial_paid_platforms", "whatsapp_profile_completeness", "registered_platforms", "not_registered_platforms", "categories", "profiles"); + + private EmailSocialFootprint(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailSocialFootprint} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailSocialFootprint fromJson(JsonNode json) { + return new EmailSocialFootprint(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Platforms where the email address is confirmed registered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional profilesRegistered() { + return Json.optional(json, "profiles_registered", Conv.LONG); + } + + /** + * Platforms evaluated for registration. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional profilesChecked() { + return Json.optional(json, "profiles_checked", Conv.LONG); + } + + /** + * Platforms that returned an associated name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional namesFound() { + return Json.optional(json, "names_found", Conv.LONG); + } + + /** + * Platforms that returned a profile photo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional photosFound() { + return Json.optional(json, "photos_found", Conv.LONG); + } + + /** + * Communication platforms with detected presence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional communicationBreadth() { + return Json.optional(json, "communication_breadth", Conv.LONG); + } + + /** + * Distinct platform categories with detected presence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional digitalFootprintDiversity() { + return Json.optional(json, "digital_footprint_diversity", Conv.LONG); + } + + /** + * Composite digital-maturity indicator, 0-10. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional digitalSophisticationIndex() { + return Json.optional(json, "digital_sophistication_index", Conv.LONG); + } + + /** + * Profile-richness indicator, 0-10. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional engagementDepthIndex() { + return Json.optional(json, "engagement_depth_index", Conv.LONG); + } + + /** + * Free vs paid platform mix, 0-10. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subscriptionAffordabilityIndex() { + return Json.optional(json, "subscription_affordability_index", Conv.LONG); + } + + /** + * Registrations on free platforms. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional freePlatforms() { + return Json.optional(json, "free_platforms", Conv.LONG); + } + + /** + * Registrations on fully paid platforms. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullPaidPlatforms() { + return Json.optional(json, "full_paid_platforms", Conv.LONG); + } + + /** + * Registrations on freemium platforms. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional partialPaidPlatforms() { + return Json.optional(json, "partial_paid_platforms", Conv.LONG); + } + + /** + * Completeness of the WhatsApp profile. Phone only; null for email. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional whatsappProfileCompleteness() { + return Json.optional(json, "whatsapp_profile_completeness", Conv.enumeration(EmailSocialFootprint.WhatsappProfileCompleteness::of)); + } + + /** + * Platforms where registration is confirmed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registeredPlatforms() { + return Json.optional(json, "registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson))); + } + + /** + * Platforms checked with a negative result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> notRegisteredPlatforms() { + return Json.optional(json, "not_registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson))); + } + + /** + * Registered count and ratio per platform category. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> categories() { + return Json.optional(json, "categories", Conv.map(Conv.model(SocialFootprintCategorySummary::fromJson))); + } + + /** + * Per-platform profile details, keyed by platform, when the platform exposes them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> profiles() { + return Json.optional(json, "profiles", Conv.map(Conv.model(SocialFootprintProfile::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailSocialFootprint}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailSocialFootprint from) { + super(from); + } + + /** + * Platforms where the email address is confirmed registered. + * + * @param profilesRegistered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder profilesRegistered(@Nullable Long profilesRegistered) { + return setNullable("profiles_registered", Conv.LONG, profilesRegistered); + } + + /** + * Platforms evaluated for registration. + * + * @param profilesChecked the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder profilesChecked(@Nullable Long profilesChecked) { + return setNullable("profiles_checked", Conv.LONG, profilesChecked); + } + + /** + * Platforms that returned an associated name. + * + * @param namesFound the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder namesFound(@Nullable Long namesFound) { + return setNullable("names_found", Conv.LONG, namesFound); + } + + /** + * Platforms that returned a profile photo. + * + * @param photosFound the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder photosFound(@Nullable Long photosFound) { + return setNullable("photos_found", Conv.LONG, photosFound); + } + + /** + * Communication platforms with detected presence. + * + * @param communicationBreadth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder communicationBreadth(@Nullable Long communicationBreadth) { + return setNullable("communication_breadth", Conv.LONG, communicationBreadth); + } + + /** + * Distinct platform categories with detected presence. + * + * @param digitalFootprintDiversity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder digitalFootprintDiversity(@Nullable Long digitalFootprintDiversity) { + return setNullable("digital_footprint_diversity", Conv.LONG, digitalFootprintDiversity); + } + + /** + * Composite digital-maturity indicator, 0-10. + * + * @param digitalSophisticationIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder digitalSophisticationIndex(@Nullable Long digitalSophisticationIndex) { + return setNullable("digital_sophistication_index", Conv.LONG, digitalSophisticationIndex); + } + + /** + * Profile-richness indicator, 0-10. + * + * @param engagementDepthIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder engagementDepthIndex(@Nullable Long engagementDepthIndex) { + return setNullable("engagement_depth_index", Conv.LONG, engagementDepthIndex); + } + + /** + * Free vs paid platform mix, 0-10. + * + * @param subscriptionAffordabilityIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subscriptionAffordabilityIndex(@Nullable Long subscriptionAffordabilityIndex) { + return setNullable("subscription_affordability_index", Conv.LONG, subscriptionAffordabilityIndex); + } + + /** + * Registrations on free platforms. + * + * @param freePlatforms the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder freePlatforms(@Nullable Long freePlatforms) { + return setNullable("free_platforms", Conv.LONG, freePlatforms); + } + + /** + * Registrations on fully paid platforms. + * + * @param fullPaidPlatforms the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullPaidPlatforms(@Nullable Long fullPaidPlatforms) { + return setNullable("full_paid_platforms", Conv.LONG, fullPaidPlatforms); + } + + /** + * Registrations on freemium platforms. + * + * @param partialPaidPlatforms the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder partialPaidPlatforms(@Nullable Long partialPaidPlatforms) { + return setNullable("partial_paid_platforms", Conv.LONG, partialPaidPlatforms); + } + + /** + * Completeness of the WhatsApp profile. Phone only; null for email. + * + * @param whatsappProfileCompleteness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder whatsappProfileCompleteness(EmailSocialFootprint.@Nullable WhatsappProfileCompleteness whatsappProfileCompleteness) { + return setNullable("whatsapp_profile_completeness", Conv.enumeration(EmailSocialFootprint.WhatsappProfileCompleteness::of), whatsappProfileCompleteness); + } + + /** + * Platforms where registration is confirmed. + * + * @param registeredPlatforms the value + * @return this builder + */ + public Builder registeredPlatforms(List registeredPlatforms) { + return set("registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson)), registeredPlatforms); + } + + /** + * Platforms checked with a negative result. + * + * @param notRegisteredPlatforms the value + * @return this builder + */ + public Builder notRegisteredPlatforms(List notRegisteredPlatforms) { + return set("not_registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson)), notRegisteredPlatforms); + } + + /** + * Registered count and ratio per platform category. + * + * @param categories the value + * @return this builder + */ + public Builder categories(Map categories) { + return set("categories", Conv.map(Conv.model(SocialFootprintCategorySummary::fromJson)), categories); + } + + /** + * Per-platform profile details, keyed by platform, when the platform exposes them. + * + * @param profiles the value + * @return this builder + */ + public Builder profiles(Map profiles) { + return set("profiles", Conv.map(Conv.model(SocialFootprintProfile::fromJson)), profiles); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailSocialFootprint} + */ + public EmailSocialFootprint build() { + return new EmailSocialFootprint(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Completeness of the WhatsApp profile. Phone only; null for email. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WhatsappProfileCompleteness extends StringEnum { + /** The value {@code "Basic"}. */ + public static final WhatsappProfileCompleteness BASIC = new WhatsappProfileCompleteness("Basic"); + + /** The value {@code "Partial"}. */ + public static final WhatsappProfileCompleteness PARTIAL = new WhatsappProfileCompleteness("Partial"); + + /** The value {@code "Complete"}. */ + public static final WhatsappProfileCompleteness COMPLETE = new WhatsappProfileCompleteness("Complete"); + + /** The value {@code "Not Present"}. */ + public static final WhatsappProfileCompleteness NOT_PRESENT = new WhatsappProfileCompleteness("Not Present"); + + private static final List KNOWN_VALUES = List.of(BASIC, PARTIAL, COMPLETE, NOT_PRESENT); + + private WhatsappProfileCompleteness(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WhatsappProfileCompleteness of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WhatsappProfileCompleteness::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/EmailVerificationCheckResponse.java b/src/main/java/me/didit/types/EmailVerificationCheckResponse.java new file mode 100644 index 0000000..a7556b0 --- /dev/null +++ b/src/main/java/me/didit/types/EmailVerificationCheckResponse.java @@ -0,0 +1,1477 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class EmailVerificationCheckResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "message", "email", "vendor_data", "metadata", "created_at"); + + private EmailVerificationCheckResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailVerificationCheckResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailVerificationCheckResponse fromJson(JsonNode json) { + return new EmailVerificationCheckResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * On Approved/Declined: the session id of the matched verification โ€” identical to the request_id returned by POST /v3/email/send/. On Failed and Expired or Not Found: a random one-off UUID that cannot be looked up later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * Approved โ€” correct code, no declining risk. Declined โ€” terminal: a declining risk matched or the attempt budget (3) was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” no pending verification for this address in the last 5 minutes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(EmailVerificationCheckResponse.Status::of)); + } + + /** + * Human-readable explanation of the outcome, including the number of attempts remaining after a wrong code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + /** + * Full email report. Present (non-null) only on finalized outcomes (Approved/Declined); null on Failed and absent on Expired or Not Found. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.model(EmailVerificationCheckResponse.Email::fromJson)); + } + + /** + * vendor_data of the matched verification's session. null on Expired or Not Found. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * metadata of the matched verification's session. null on Expired or Not Found. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Timestamp of this check response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailVerificationCheckResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailVerificationCheckResponse from) { + super(from); + } + + /** + * On Approved/Declined: the session id of the matched verification โ€” identical to the request_id returned by POST /v3/email/send/. On Failed and Expired or Not Found: a random one-off UUID that cannot be looked up later. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Approved โ€” correct code, no declining risk. Declined โ€” terminal: a declining risk matched or the attempt budget (3) was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” no pending verification for this address in the last 5 minutes. + * + * @param status the value + * @return this builder + */ + public Builder status(EmailVerificationCheckResponse.Status status) { + return set("status", Conv.enumeration(EmailVerificationCheckResponse.Status::of), status); + } + + /** + * Human-readable explanation of the outcome, including the number of attempts remaining after a wrong code. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * Full email report. Present (non-null) only on finalized outcomes (Approved/Declined); null on Failed and absent on Expired or Not Found. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(EmailVerificationCheckResponse.@Nullable Email email) { + return setNullable("email", Conv.model(EmailVerificationCheckResponse.Email::fromJson), email); + } + + /** + * vendor_data of the matched verification's session. null on Expired or Not Found. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * metadata of the matched verification's session. null on Expired or Not Found. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Timestamp of this check response. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailVerificationCheckResponse} + */ + public EmailVerificationCheckResponse build() { + return new EmailVerificationCheckResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved โ€” correct code, no declining risk. Declined โ€” terminal: a declining risk matched or the attempt budget (3) was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” no pending verification for this address in the last 5 minutes. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "Failed"}. */ + public static final Status FAILED = new Status("Failed"); + + /** The value {@code "Expired or Not Found"}. */ + public static final Status EXPIRED_OR_NOT_FOUND = new Status("Expired or Not Found"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, FAILED, EXPIRED_OR_NOT_FOUND); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Full email report. Present (non-null) only on finalized outcomes (Approved/Declined); null on Failed and absent on Expired or Not Found. + */ + public static final class Email extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "email", "is_breached", "breaches", "is_disposable", "is_undeliverable", "verification_attempts", "verified_at", "warnings", "lifecycle", "matches", "email_social"); + + private Email(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Email} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Email fromJson(JsonNode json) { + return new Email(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Final status of the email verification. Matches the top-level status for finalized checks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(EmailVerificationCheckResponse.Email.Status::of)); + } + + /** + * The verified email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * true when the address appears in known data breaches (breach intelligence lookup run at finalization). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBreached() { + return Json.optional(json, "is_breached", Conv.BOOLEAN); + } + + /** + * Up to 5 most recent known breaches containing this address. Empty array (or omitted) when is_breached is false. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> breaches() { + return Json.optional(json, "breaches", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Breaches::fromJson))); + } + + /** + * true when the domain belongs to a known disposable/temporary-mail provider. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * true when the address cannot receive mail (failed syntax or DNS/MX validation, or the message bounced). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isUndeliverable() { + return Json.optional(json, "is_undeliverable", Conv.BOOLEAN); + } + + /** + * Number of OTP sends for this verification (1, or 2 after a retry). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationAttempts() { + return Json.optional(json, "verification_attempts", Conv.LONG); + } + + /** + * When the correct code was entered. null if the verification was never approved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * Risk warnings recorded during the verification (duplicate, breached, disposable, undeliverable, attempts exceeded, blocklist, etc.). Empty array when there are none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Warnings::fromJson))); + } + + /** + * Chronological audit trail of the verification. Event type is one of EMAIL_VERIFICATION_MESSAGE_SENT, EMAIL_VERIFICATION_RETRY_MESSAGE_SENT, VALID_CODE_ENTERED, INVALID_CODE_ENTERED, EMAIL_VERIFICATION_APPROVED, EMAIL_VERIFICATION_DECLINED, EMAIL_VERIFICATION_IN_REVIEW, EMAIL_VERIFICATION_EXPIRED. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lifecycle() { + return Json.optional(json, "lifecycle", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Lifecycle::fromJson))); + } + + /** + * Other sessions of your application (KYC, KYB, or API) where the same email address was used by a different user (different vendor_data). Up to 5 entries; a synthetic list-entry blocklist match is prepended when present (and only when no session-derived blocklisted email exists) โ€” session-derived matches keep created_at order. Empty array when there are no matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Matches::fromJson))); + } + + /** + * Social footprint of the email address: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the email address was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailSocial() { + return Json.optional(json, "email_social", Conv.model(EmailSocialFootprint::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Email}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Email from) { + super(from); + } + + /** + * Final status of the email verification. Matches the top-level status for finalized checks. + * + * @param status the value + * @return this builder + */ + public Builder status(EmailVerificationCheckResponse.Email.Status status) { + return set("status", Conv.enumeration(EmailVerificationCheckResponse.Email.Status::of), status); + } + + /** + * The verified email address. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * true when the address appears in known data breaches (breach intelligence lookup run at finalization). + * + * @param isBreached the value + * @return this builder + */ + public Builder isBreached(boolean isBreached) { + return set("is_breached", Conv.BOOLEAN, isBreached); + } + + /** + * Up to 5 most recent known breaches containing this address. Empty array (or omitted) when is_breached is false. + * + * @param breaches the value + * @return this builder + */ + public Builder breaches(List breaches) { + return set("breaches", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Breaches::fromJson)), breaches); + } + + /** + * true when the domain belongs to a known disposable/temporary-mail provider. + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * true when the address cannot receive mail (failed syntax or DNS/MX validation, or the message bounced). + * + * @param isUndeliverable the value + * @return this builder + */ + public Builder isUndeliverable(boolean isUndeliverable) { + return set("is_undeliverable", Conv.BOOLEAN, isUndeliverable); + } + + /** + * Number of OTP sends for this verification (1, or 2 after a retry). + * + * @param verificationAttempts the value + * @return this builder + */ + public Builder verificationAttempts(long verificationAttempts) { + return set("verification_attempts", Conv.LONG, verificationAttempts); + } + + /** + * When the correct code was entered. null if the verification was never approved. + * + * @param verifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verifiedAt(@Nullable OffsetDateTime verifiedAt) { + return setNullable("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Risk warnings recorded during the verification (duplicate, breached, disposable, undeliverable, attempts exceeded, blocklist, etc.). Empty array when there are none. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Warnings::fromJson)), warnings); + } + + /** + * Chronological audit trail of the verification. Event type is one of EMAIL_VERIFICATION_MESSAGE_SENT, EMAIL_VERIFICATION_RETRY_MESSAGE_SENT, VALID_CODE_ENTERED, INVALID_CODE_ENTERED, EMAIL_VERIFICATION_APPROVED, EMAIL_VERIFICATION_DECLINED, EMAIL_VERIFICATION_IN_REVIEW, EMAIL_VERIFICATION_EXPIRED. + * + * @param lifecycle the value + * @return this builder + */ + public Builder lifecycle(List lifecycle) { + return set("lifecycle", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Lifecycle::fromJson)), lifecycle); + } + + /** + * Other sessions of your application (KYC, KYB, or API) where the same email address was used by a different user (different vendor_data). Up to 5 entries; a synthetic list-entry blocklist match is prepended when present (and only when no session-derived blocklisted email exists) โ€” session-derived matches keep created_at order. Empty array when there are no matches. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(EmailVerificationCheckResponse.Email.Matches::fromJson)), matches); + } + + /** + * Social footprint of the email address: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the email address was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @param emailSocial the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder emailSocial(@Nullable EmailSocialFootprint emailSocial) { + return setNullable("email_social", Conv.model(EmailSocialFootprint::fromJson), emailSocial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Email} + */ + public Email build() { + return new Email(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Final status of the email verification. Matches the top-level status for finalized checks. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW, NOT_FINISHED, EXPIRED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Breaches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "domain", "breach_date", "breach_emails_count", "description", "logo_path", "data_classes", "is_verified"); + + private Breaches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Breaches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Breaches fromJson(JsonNode json) { + return new Breaches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Breach identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Domain of the breached service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional domain() { + return Json.optional(json, "domain", Conv.STRING); + } + + /** + * Date the breach occurred. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachDate() { + return Json.optional(json, "breach_date", Conv.DATE); + } + + /** + * Total number of accounts exposed in the breach. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachEmailsCount() { + return Json.optional(json, "breach_emails_count", Conv.LONG); + } + + /** + * Human-readable description of the breach (may contain HTML markup). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * URL of the breached service's logo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logoPath() { + return Json.optional(json, "logo_path", Conv.STRING); + } + + /** + * Categories of data exposed, in snake_case (e.g., email_addresses, passwords). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> dataClasses() { + return Json.optional(json, "data_classes", Conv.list(Conv.STRING)); + } + + /** + * Whether the breach has been verified as legitimate. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVerified() { + return Json.optional(json, "is_verified", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Breaches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Breaches from) { + super(from); + } + + /** + * Breach identifier. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Domain of the breached service. + * + * @param domain the value + * @return this builder + */ + public Builder domain(String domain) { + return set("domain", Conv.STRING, domain); + } + + /** + * Date the breach occurred. + * + * @param breachDate the value + * @return this builder + */ + public Builder breachDate(LocalDate breachDate) { + return set("breach_date", Conv.DATE, breachDate); + } + + /** + * Total number of accounts exposed in the breach. + * + * @param breachEmailsCount the value + * @return this builder + */ + public Builder breachEmailsCount(long breachEmailsCount) { + return set("breach_emails_count", Conv.LONG, breachEmailsCount); + } + + /** + * Human-readable description of the breach (may contain HTML markup). + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * URL of the breached service's logo. + * + * @param logoPath the value + * @return this builder + */ + public Builder logoPath(String logoPath) { + return set("logo_path", Conv.STRING, logoPath); + } + + /** + * Categories of data exposed, in snake_case (e.g., email_addresses, passwords). + * + * @param dataClasses the value + * @return this builder + */ + public Builder dataClasses(List dataClasses) { + return set("data_classes", Conv.list(Conv.STRING), dataClasses); + } + + /** + * Whether the breach has been verified as legitimate. + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Breaches} + */ + public Breaches build() { + return new Breaches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature that produced the warning. Always EMAIL here. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Machine-readable risk code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Risk-specific context (e.g., the duplicated session id for duplicate risks). null when the risk carries no extra data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error risks decline the verification, warning flags it for review, information is recorded without affecting the status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(EmailVerificationCheckResponse.Email.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Feature that produced the warning. Always EMAIL here. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Machine-readable risk code. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Risk-specific context (e.g., the duplicated session id for duplicate risks). null when the risk carries no extra data. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error risks decline the verification, warning flags it for review, information is recorded without affecting the status. + * + * @param logType the value + * @return this builder + */ + public Builder logType(EmailVerificationCheckResponse.Email.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(EmailVerificationCheckResponse.Email.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Severity. error risks decline the verification, warning flags it for review, information is recorded without affecting the status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Lifecycle extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "timestamp", "details", "fee"); + + private Lifecycle(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Lifecycle} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Lifecycle fromJson(JsonNode json) { + return new Lifecycle(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Event type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * When the event happened. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timestamp() { + return Json.optional(json, "timestamp", Conv.DATE_TIME); + } + + /** + * Event-specific payload. Send events: {status, reason}. Code-entry events: {code_tried, status}. Final-status events: null, or {reason} when declined or in review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.OBJECT); + } + + /** + * USD amount billed for this event. Non-zero only on the first successful send; 0 for retries, code entries, and status events. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fee() { + return Json.optional(json, "fee", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Lifecycle}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Lifecycle from) { + super(from); + } + + /** + * Event type. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * When the event happened. + * + * @param timestamp the value + * @return this builder + */ + public Builder timestamp(OffsetDateTime timestamp) { + return set("timestamp", Conv.DATE_TIME, timestamp); + } + + /** + * Event-specific payload. Send events: {status, reason}. Code-entry events: {code_tried, status}. Final-status events: null, or {reason} when declined or in review. + * + * @param details the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder details(@Nullable Map details) { + return setAny("details", details); + } + + /** + * USD amount billed for this event. Non-zero only on the first successful send; 0 for retries, code entries, and status events. + * + * @param fee the value + * @return this builder + */ + public Builder fee(double fee) { + return set("fee", Conv.DOUBLE, fee); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Lifecycle} + */ + public Lifecycle build() { + return new Lifecycle(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "email", "status", "is_blocklisted", "api_service", "source"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session id of the other verification that used this email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Human-friendly sequential number of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * vendor_data of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.STRING); + } + + /** + * The matched email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the email address is on your application's blocklist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * For API-type sessions, the standalone API that created it (e.g., PHONE_VERIFICATION); null for regular verification sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry prepends a synthetic match with source: "list_entry" and null session_id/session_number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * Session id of the other verification that used this email address. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Human-friendly sequential number of that session. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * vendor_data of that session. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @param verificationDate the value + * @return this builder + */ + public Builder verificationDate(String verificationDate) { + return set("verification_date", Conv.STRING, verificationDate); + } + + /** + * The matched email address. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Whether the email address is on your application's blocklist. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * For API-type sessions, the standalone API that created it (e.g., PHONE_VERIFICATION); null for regular verification sessions. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry prepends a synthetic match with source: "list_entry" and null session_id/session_number. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/EmailVerificationSendResponse.java b/src/main/java/me/didit/types/EmailVerificationSendResponse.java new file mode 100644 index 0000000..3996e0c --- /dev/null +++ b/src/main/java/me/didit/types/EmailVerificationSendResponse.java @@ -0,0 +1,266 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class EmailVerificationSendResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "reason", "vendor_data", "metadata"); + + private EmailVerificationSendResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailVerificationSendResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailVerificationSendResponse fromJson(JsonNode json) { + return new EmailVerificationSendResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session id of the verification. A Retry send returns the same request_id as the original send. This id appears in the Business Console, is returned again by a finalized POST /v3/email/check/, and can be passed to GET /v3/session/{sessionId}/decision/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * Success โ€” OTP emailed to a new verification (billed). Retry โ€” fresh OTP emailed for the pending verification created by a previous send (free). Undeliverable โ€” the address failed deliverability validation or the message could not be sent; the verification is immediately finalized as Declined and nothing is billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(EmailVerificationSendResponse.Status::of)); + } + + /** + * email_can_not_be_delivered when status is Undeliverable; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.enumeration(EmailVerificationSendResponse.Reason::of)); + } + + /** + * Echo of the vendor_data stored on the session (from the first send). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata stored on the session (from the first send). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailVerificationSendResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailVerificationSendResponse from) { + super(from); + } + + /** + * Session id of the verification. A Retry send returns the same request_id as the original send. This id appears in the Business Console, is returned again by a finalized POST /v3/email/check/, and can be passed to GET /v3/session/{sessionId}/decision/. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Success โ€” OTP emailed to a new verification (billed). Retry โ€” fresh OTP emailed for the pending verification created by a previous send (free). Undeliverable โ€” the address failed deliverability validation or the message could not be sent; the verification is immediately finalized as Declined and nothing is billed. + * + * @param status the value + * @return this builder + */ + public Builder status(EmailVerificationSendResponse.Status status) { + return set("status", Conv.enumeration(EmailVerificationSendResponse.Status::of), status); + } + + /** + * email_can_not_be_delivered when status is Undeliverable; null otherwise. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(EmailVerificationSendResponse.@Nullable Reason reason) { + return setNullable("reason", Conv.enumeration(EmailVerificationSendResponse.Reason::of), reason); + } + + /** + * Echo of the vendor_data stored on the session (from the first send). + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata stored on the session (from the first send). + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailVerificationSendResponse} + */ + public EmailVerificationSendResponse build() { + return new EmailVerificationSendResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Success โ€” OTP emailed to a new verification (billed). Retry โ€” fresh OTP emailed for the pending verification created by a previous send (free). Undeliverable โ€” the address failed deliverability validation or the message could not be sent; the verification is immediately finalized as Declined and nothing is billed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Success"}. */ + public static final Status SUCCESS = new Status("Success"); + + /** The value {@code "Retry"}. */ + public static final Status RETRY = new Status("Retry"); + + /** The value {@code "Undeliverable"}. */ + public static final Status UNDELIVERABLE = new Status("Undeliverable"); + + private static final List KNOWN_VALUES = List.of(SUCCESS, RETRY, UNDELIVERABLE); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * email_can_not_be_delivered when status is Undeliverable; null otherwise. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Reason extends StringEnum { + /** The value {@code "email_can_not_be_delivered"}. */ + public static final Reason EMAIL_CAN_NOT_BE_DELIVERED = new Reason("email_can_not_be_delivered"); + + private static final List KNOWN_VALUES = List.of(EMAIL_CAN_NOT_BE_DELIVERED); + + private Reason(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Reason of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Reason::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/EntityNetworkMembership.java b/src/main/java/me/didit/types/EntityNetworkMembership.java new file mode 100644 index 0000000..5c7d6d2 --- /dev/null +++ b/src/main/java/me/didit/types/EntityNetworkMembership.java @@ -0,0 +1,258 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class EntityNetworkMembership extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("network", "subject", "signal_types", "signal_count", "joined_at", "last_seen_at"); + + private EntityNetworkMembership(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EntityNetworkMembership} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EntityNetworkMembership fromJson(JsonNode json) { + return new EntityNetworkMembership(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The network field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional network() { + return Json.optional(json, "network", Conv.model(NetworkListItem::fromJson)); + } + + /** + * The subject field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subject() { + return Json.optional(json, "subject", Conv.OBJECT); + } + + /** + * The signal_types field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signalTypes() { + return Json.optional(json, "signal_types", Conv.list(Conv.enumeration(EntityNetworkMembership.SignalTypes::of))); + } + + /** + * The signal_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signalCount() { + return Json.optional(json, "signal_count", Conv.LONG); + } + + /** + * The joined_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional joinedAt() { + return Json.optional(json, "joined_at", Conv.DATE_TIME); + } + + /** + * The last_seen_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSeenAt() { + return Json.optional(json, "last_seen_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EntityNetworkMembership}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EntityNetworkMembership from) { + super(from); + } + + /** + * The network field. + * + * @param network the value + * @return this builder + */ + public Builder network(NetworkListItem network) { + return set("network", Conv.model(NetworkListItem::fromJson), network); + } + + /** + * The subject field. + * + * @param subject the value + * @return this builder + */ + public Builder subject(Map subject) { + return setAny("subject", subject); + } + + /** + * The signal_types field. + * + * @param signalTypes the value + * @return this builder + */ + public Builder signalTypes(List signalTypes) { + return set("signal_types", Conv.list(Conv.enumeration(EntityNetworkMembership.SignalTypes::of)), signalTypes); + } + + /** + * The signal_count field. + * + * @param signalCount the value + * @return this builder + */ + public Builder signalCount(long signalCount) { + return set("signal_count", Conv.LONG, signalCount); + } + + /** + * The joined_at field. + * + * @param joinedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder joinedAt(@Nullable OffsetDateTime joinedAt) { + return setNullable("joined_at", Conv.DATE_TIME, joinedAt); + } + + /** + * The last_seen_at field. + * + * @param lastSeenAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSeenAt(@Nullable OffsetDateTime lastSeenAt) { + return setNullable("last_seen_at", Conv.DATE_TIME, lastSeenAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EntityNetworkMembership} + */ + public EntityNetworkMembership build() { + return new EntityNetworkMembership(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SignalTypes extends StringEnum { + /** The value {@code "ip_address"}. */ + public static final SignalTypes IP_ADDRESS = new SignalTypes("ip_address"); + + /** The value {@code "device"}. */ + public static final SignalTypes DEVICE = new SignalTypes("device"); + + /** The value {@code "face"}. */ + public static final SignalTypes FACE = new SignalTypes("face"); + + /** The value {@code "document_number"}. */ + public static final SignalTypes DOCUMENT_NUMBER = new SignalTypes("document_number"); + + /** The value {@code "phone"}. */ + public static final SignalTypes PHONE = new SignalTypes("phone"); + + /** The value {@code "email"}. */ + public static final SignalTypes EMAIL = new SignalTypes("email"); + + /** The value {@code "address"}. */ + public static final SignalTypes ADDRESS = new SignalTypes("address"); + + private static final List KNOWN_VALUES = List.of(IP_ADDRESS, DEVICE, FACE, DOCUMENT_NUMBER, PHONE, EMAIL, ADDRESS); + + private SignalTypes(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SignalTypes of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SignalTypes::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/FaceMatchCompareParams.java b/src/main/java/me/didit/types/FaceMatchCompareParams.java new file mode 100644 index 0000000..0f9ccbf --- /dev/null +++ b/src/main/java/me/didit/types/FaceMatchCompareParams.java @@ -0,0 +1,241 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code face_match.compare}. */ +public final class FaceMatchCompareParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_image", "ref_image", "face_match_score_decline_threshold", "rotate_image", "save_api_request", "vendor_data", "metadata"); + + private FaceMatchCompareParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceMatchCompareParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceMatchCompareParams fromJson(JsonNode json) { + return new FaceMatchCompareParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Live or candidate face image to verify (e.g. a selfie). Submit a single front-facing photo with the subject's face clearly visible and well lit. Allowed extensions: tiff, jpg, jpeg, png, webp. Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not improve accuracy. + * + * @return the file to upload, if set + */ + public Optional userImage() { + return file("user_image"); + } + + /** + * Reference face image to compare against (e.g. an ID document portrait or a previously enrolled photo). Same format and size limits as user_image. + * + * @return the file to upload, if set + */ + public Optional refImage() { + return file("ref_image"); + } + + /** + * Similarity threshold (0โ€“100) that drives the response status. A computed score at or below this value sets status to Declined and adds a LOW_FACE_MATCH_SIMILARITY warning; a score strictly above it returns Approved. Default 30 is permissive โ€” raise it (e.g. 50โ€“60) for stricter verification. Values outside 0โ€“100 return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatchScoreDeclineThreshold() { + return Json.optional(json, "face_match_score_decline_threshold", Conv.DOUBLE); + } + + /** + * When true, the service tries the input images in 90-degree increments (0, 90, 180, 270) and uses the orientation that yields the best face detection โ€” useful for mobile captures with missing EXIF orientation. Adds latency, so only enable it if you cannot guarantee upright images. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rotateImage() { + return Json.optional(json, "rotate_image", Conv.BOOLEAN); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, and announced through a status.updated webhook. When false, nothing is stored and request_id is a transient UUID for response correlation only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"login"}) โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceMatchCompareParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceMatchCompareParams from) { + super(from); + } + + /** + * Live or candidate face image to verify (e.g. a selfie). Submit a single front-facing photo with the subject's face clearly visible and well lit. Allowed extensions: tiff, jpg, jpeg, png, webp. Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not improve accuracy. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(FileUpload userImage) { + return setFile("user_image", userImage); + } + + /** + * Uploads the file at {@code path} as {@code user_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder userImage(Path path) { + return setFile("user_image", FileUpload.of(path)); + } + + /** + * Reference face image to compare against (e.g. an ID document portrait or a previously enrolled photo). Same format and size limits as user_image. + * + * @param refImage the value + * @return this builder + */ + public Builder refImage(FileUpload refImage) { + return setFile("ref_image", refImage); + } + + /** + * Uploads the file at {@code path} as {@code ref_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder refImage(Path path) { + return setFile("ref_image", FileUpload.of(path)); + } + + /** + * Similarity threshold (0โ€“100) that drives the response status. A computed score at or below this value sets status to Declined and adds a LOW_FACE_MATCH_SIMILARITY warning; a score strictly above it returns Approved. Default 30 is permissive โ€” raise it (e.g. 50โ€“60) for stricter verification. Values outside 0โ€“100 return 400. + * + * @param faceMatchScoreDeclineThreshold the value + * @return this builder + */ + public Builder faceMatchScoreDeclineThreshold(double faceMatchScoreDeclineThreshold) { + return set("face_match_score_decline_threshold", Conv.DOUBLE, faceMatchScoreDeclineThreshold); + } + + /** + * When true, the service tries the input images in 90-degree increments (0, 90, 180, 270) and uses the orientation that yields the best face detection โ€” useful for mobile captures with missing EXIF orientation. Adds latency, so only enable it if you cannot guarantee upright images. + * + * @param rotateImage the value + * @return this builder + */ + public Builder rotateImage(boolean rotateImage) { + return set("rotate_image", Conv.BOOLEAN, rotateImage); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, and announced through a status.updated webhook. When false, nothing is stored and request_id is a transient UUID for response correlation only. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"login"}) โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceMatchCompareParams} + * @throws IllegalStateException when a required field is missing + */ + public FaceMatchCompareParams build() { + requireFile("user_image"); + requireFile("ref_image"); + return new FaceMatchCompareParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FaceMatchCompareResponse.java b/src/main/java/me/didit/types/FaceMatchCompareResponse.java new file mode 100644 index 0000000..80b03a8 --- /dev/null +++ b/src/main/java/me/didit/types/FaceMatchCompareResponse.java @@ -0,0 +1,1245 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class FaceMatchCompareResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "face_match", "vendor_data", "metadata", "created_at"); + + private FaceMatchCompareResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceMatchCompareResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceMatchCompareResponse fromJson(JsonNode json) { + return new FaceMatchCompareResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The face_match field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatch() { + return Json.optional(json, "face_match", Conv.model(FaceMatchCompareResponse.FaceMatch::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated, e.g. 2026-06-12T01:04:42.763237+00:00. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceMatchCompareResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceMatchCompareResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The face_match field. + * + * @param faceMatch the value + * @return this builder + */ + public Builder faceMatch(FaceMatchCompareResponse.FaceMatch faceMatch) { + return set("face_match", Conv.model(FaceMatchCompareResponse.FaceMatch::fromJson), faceMatch); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated, e.g. 2026-06-12T01:04:42.763237+00:00. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceMatchCompareResponse} + */ + public FaceMatchCompareResponse build() { + return new FaceMatchCompareResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class FaceMatch extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "score", "user_image", "ref_image", "warnings"); + + private FaceMatch(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceMatch} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceMatch fromJson(JsonNode json) { + return new FaceMatch(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Approved when the similarity score is strictly above face_match_score_decline_threshold and a score could be computed; Declined otherwise (a warning explains why). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Status::of)); + } + + /** + * Similarity score from 0 to 100 โ€” the model's confidence that both images depict the same person. Rounded to two decimals only when save_api_request is true; with save_api_request=false the raw float is returned. null when no face pair could be scored (with the default save_api_request=true); with save_api_request=false the same condition can surface as score: 0. Either way a NO_REFERENCE_IMAGE warning is present and status is Declined. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Face-detection results for the analyzed images. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userImage() { + return Json.optional(json, "user_image", Conv.model(FaceMatchCompareResponse.FaceMatch.UserImage::fromJson)); + } + + /** + * Face-detection results for the reference image, same shape as user_image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional refImage() { + return Json.optional(json, "ref_image", Conv.model(FaceMatchCompareResponse.FaceMatch.RefImage::fromJson)); + } + + /** + * Empty on a clean approval. NO_REFERENCE_IMAGE (error) โ€” no face pair could be scored; LOW_FACE_MATCH_SIMILARITY (error) โ€” score at or below the decline threshold. Any of these sets status to Declined. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(FaceMatchCompareResponse.FaceMatch.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceMatch}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceMatch from) { + super(from); + } + + /** + * Approved when the similarity score is strictly above face_match_score_decline_threshold and a score could be computed; Declined otherwise (a warning explains why). + * + * @param status the value + * @return this builder + */ + public Builder status(FaceMatchCompareResponse.FaceMatch.Status status) { + return set("status", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Status::of), status); + } + + /** + * Similarity score from 0 to 100 โ€” the model's confidence that both images depict the same person. Rounded to two decimals only when save_api_request is true; with save_api_request=false the raw float is returned. null when no face pair could be scored (with the default save_api_request=true); with save_api_request=false the same condition can surface as score: 0. Either way a NO_REFERENCE_IMAGE warning is present and status is Declined. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Face-detection results for the analyzed images. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(FaceMatchCompareResponse.FaceMatch.UserImage userImage) { + return set("user_image", Conv.model(FaceMatchCompareResponse.FaceMatch.UserImage::fromJson), userImage); + } + + /** + * Face-detection results for the reference image, same shape as user_image. + * + * @param refImage the value + * @return this builder + */ + public Builder refImage(FaceMatchCompareResponse.FaceMatch.RefImage refImage) { + return set("ref_image", Conv.model(FaceMatchCompareResponse.FaceMatch.RefImage::fromJson), refImage); + } + + /** + * Empty on a clean approval. NO_REFERENCE_IMAGE (error) โ€” no face pair could be scored; LOW_FACE_MATCH_SIMILARITY (error) โ€” score at or below the decline threshold. Any of these sets status to Declined. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(FaceMatchCompareResponse.FaceMatch.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceMatch} + */ + public FaceMatch build() { + return new FaceMatch(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved when the similarity score is strictly above face_match_score_decline_threshold and a score could be computed; Declined otherwise (a warning explains why). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Face-detection results for the analyzed images. */ + public static final class UserImage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entities", "best_angle"); + + private UserImage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserImage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserImage fromJson(JsonNode json) { + return new UserImage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * One entry per detected face. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> entities() { + return Json.optional(json, "entities", Conv.list(Conv.model(FaceMatchCompareResponse.FaceMatch.UserImage.Entities::fromJson))); + } + + /** + * Rotation (degrees: 0, 90, 180, or 270) that produced the best face detection. Only non-zero when rotate_image=true corrected the orientation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bestAngle() { + return Json.optional(json, "best_angle", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserImage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserImage from) { + super(from); + } + + /** + * One entry per detected face. + * + * @param entities the value + * @return this builder + */ + public Builder entities(List entities) { + return set("entities", Conv.list(Conv.model(FaceMatchCompareResponse.FaceMatch.UserImage.Entities::fromJson)), entities); + } + + /** + * Rotation (degrees: 0, 90, 180, or 270) that produced the best face detection. Only non-zero when rotate_image=true corrected the orientation. + * + * @param bestAngle the value + * @return this builder + */ + public Builder bestAngle(long bestAngle) { + return set("best_angle", Conv.LONG, bestAngle); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserImage} + */ + public UserImage build() { + return new UserImage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Entities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bbox", "confidence", "age", "gender", "race"); + + private Entities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Entities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Entities fromJson(JsonNode json) { + return new Entities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> bbox() { + return Json.optional(json, "bbox", Conv.list(Conv.LONG)); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + /** + * Model-estimated age of the detected face, in years. Informational only โ€” it does not affect the face-match decision. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional age() { + return Json.optional(json, "age", Conv.DOUBLE); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * Reserved field โ€” always null in responses from this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional race() { + return Json.optional(json, "race", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Entities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Entities from) { + super(from); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @param bbox the value + * @return this builder + */ + public Builder bbox(List bbox) { + return set("bbox", Conv.list(Conv.LONG), bbox); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * Model-estimated age of the detected face, in years. Informational only โ€” it does not affect the face-match decision. + * + * @param age the value + * @return this builder + */ + public Builder age(double age) { + return set("age", Conv.DOUBLE, age); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * Reserved field โ€” always null in responses from this endpoint. + * + * @param race the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder race(@Nullable String race) { + return setNullable("race", Conv.STRING, race); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Entities} + */ + public Entities build() { + return new Entities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** Face-detection results for the reference image, same shape as user_image. */ + public static final class RefImage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entities", "best_angle"); + + private RefImage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RefImage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RefImage fromJson(JsonNode json) { + return new RefImage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * One entry per detected face. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> entities() { + return Json.optional(json, "entities", Conv.list(Conv.model(FaceMatchCompareResponse.FaceMatch.RefImage.Entities::fromJson))); + } + + /** + * The best_angle field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bestAngle() { + return Json.optional(json, "best_angle", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RefImage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RefImage from) { + super(from); + } + + /** + * One entry per detected face. + * + * @param entities the value + * @return this builder + */ + public Builder entities(List entities) { + return set("entities", Conv.list(Conv.model(FaceMatchCompareResponse.FaceMatch.RefImage.Entities::fromJson)), entities); + } + + /** + * The best_angle field. + * + * @param bestAngle the value + * @return this builder + */ + public Builder bestAngle(long bestAngle) { + return set("best_angle", Conv.LONG, bestAngle); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RefImage} + */ + public RefImage build() { + return new RefImage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Entities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bbox", "confidence", "age", "gender", "race"); + + private Entities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Entities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Entities fromJson(JsonNode json) { + return new Entities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> bbox() { + return Json.optional(json, "bbox", Conv.list(Conv.LONG)); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + /** + * Model-estimated age of the detected face, in years. Informational only โ€” it does not affect the face-match decision. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional age() { + return Json.optional(json, "age", Conv.DOUBLE); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * Reserved field โ€” always null in responses from this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional race() { + return Json.optional(json, "race", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Entities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Entities from) { + super(from); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @param bbox the value + * @return this builder + */ + public Builder bbox(List bbox) { + return set("bbox", Conv.list(Conv.LONG), bbox); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * Model-estimated age of the detected face, in years. Informational only โ€” it does not affect the face-match decision. + * + * @param age the value + * @return this builder + */ + public Builder age(double age) { + return set("age", Conv.DOUBLE, age); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * Reserved field โ€” always null in responses from this endpoint. + * + * @param race the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder race(@Nullable String race) { + return setNullable("race", Conv.STRING, race); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Entities} + */ + public Entities build() { + return new Entities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Warnings.Risk::of)); + } + + /** + * Feature that raised the warning. Always FACEMATCH on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Warnings.Feature::of)); + } + + /** + * Always null for face-match warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. + * + * @param risk the value + * @return this builder + */ + public Builder risk(FaceMatchCompareResponse.FaceMatch.Warnings.Risk risk) { + return set("risk", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Warnings.Risk::of), risk); + } + + /** + * Feature that raised the warning. Always FACEMATCH on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(FaceMatchCompareResponse.FaceMatch.Warnings.Feature feature) { + return set("feature", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Warnings.Feature::of), feature); + } + + /** + * Always null for face-match warnings. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + * @param logType the value + * @return this builder + */ + public Builder logType(FaceMatchCompareResponse.FaceMatch.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(FaceMatchCompareResponse.FaceMatch.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Machine-readable risk code. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Risk extends StringEnum { + /** The value {@code "NO_REFERENCE_IMAGE"}. */ + public static final Risk NO_REFERENCE_IMAGE = new Risk("NO_REFERENCE_IMAGE"); + + /** The value {@code "LOW_FACE_MATCH_SIMILARITY"}. */ + public static final Risk LOW_FACE_MATCH_SIMILARITY = new Risk("LOW_FACE_MATCH_SIMILARITY"); + + private static final List KNOWN_VALUES = List.of(NO_REFERENCE_IMAGE, LOW_FACE_MATCH_SIMILARITY); + + private Risk(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Risk of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Risk::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Feature that raised the warning. Always FACEMATCH on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + private static final List KNOWN_VALUES = List.of(FACEMATCH); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/FaceSearchSearchParams.java b/src/main/java/me/didit/types/FaceSearchSearchParams.java new file mode 100644 index 0000000..a73c9ad --- /dev/null +++ b/src/main/java/me/didit/types/FaceSearchSearchParams.java @@ -0,0 +1,255 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code face_search.search}. */ +public final class FaceSearchSearchParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_image", "search_type", "rotate_image", "save_api_request", "vendor_data", "metadata"); + + private FaceSearchSearchParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceSearchSearchParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceSearchSearchParams fromJson(JsonNode json) { + return new FaceSearchSearchParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Front-facing face image to search with. Allowed extensions: tiff, jpg, jpeg, png, webp. Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not improve accuracy. The image must contain at least one detectable face โ€” otherwise the endpoint returns 400. When several faces are present, the largest one is searched and a MULTIPLE_FACES_DETECTED warning is added. + * + * @return the file to upload, if set + */ + public Optional userImage() { + return file("user_image"); + } + + /** + * Search policy. most_similar (default) ranks every enrolled face in your application by similarity. blocklisted_or_approved restricts candidates to blocklisted faces, allowlisted faces, faces from approved sessions, and imported user-profile faces โ€” with blocklisted entries ranked first. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional searchType() { + return Json.optional(json, "search_type", Conv.enumeration(FaceSearchSearchParams.SearchType::of)); + } + + /** + * When true, the service tries 90-degree rotations of the input and uses the orientation that yields the best face detection. Useful when EXIF orientation is missing. Adds latency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rotateImage() { + return Json.optional(json, "rotate_image", Conv.BOOLEAN); + } + + /** + * When true (default), persists the call as an API-type session, emits a status.updated webhook, presigns match_image_url values, and enrolls the searched face into your face search index (Face Search enrollments are excluded from future searches). When false, the search is one-shot โ€” no session is stored and the face is not enrolled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque identifier (your user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back. It does not exclude same-user faces from the search results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back. In multipart requests, send it as a JSON-encoded string field โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceSearchSearchParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceSearchSearchParams from) { + super(from); + } + + /** + * Front-facing face image to search with. Allowed extensions: tiff, jpg, jpeg, png, webp. Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not improve accuracy. The image must contain at least one detectable face โ€” otherwise the endpoint returns 400. When several faces are present, the largest one is searched and a MULTIPLE_FACES_DETECTED warning is added. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(FileUpload userImage) { + return setFile("user_image", userImage); + } + + /** + * Uploads the file at {@code path} as {@code user_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder userImage(Path path) { + return setFile("user_image", FileUpload.of(path)); + } + + /** + * Search policy. most_similar (default) ranks every enrolled face in your application by similarity. blocklisted_or_approved restricts candidates to blocklisted faces, allowlisted faces, faces from approved sessions, and imported user-profile faces โ€” with blocklisted entries ranked first. + * + * @param searchType the value + * @return this builder + */ + public Builder searchType(FaceSearchSearchParams.SearchType searchType) { + return set("search_type", Conv.enumeration(FaceSearchSearchParams.SearchType::of), searchType); + } + + /** + * When true, the service tries 90-degree rotations of the input and uses the orientation that yields the best face detection. Useful when EXIF orientation is missing. Adds latency. + * + * @param rotateImage the value + * @return this builder + */ + public Builder rotateImage(boolean rotateImage) { + return set("rotate_image", Conv.BOOLEAN, rotateImage); + } + + /** + * When true (default), persists the call as an API-type session, emits a status.updated webhook, presigns match_image_url values, and enrolls the searched face into your face search index (Face Search enrollments are excluded from future searches). When false, the search is one-shot โ€” no session is stored and the face is not enrolled. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque identifier (your user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back. It does not exclude same-user faces from the search results. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back. In multipart requests, send it as a JSON-encoded string field โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceSearchSearchParams} + * @throws IllegalStateException when a required field is missing + */ + public FaceSearchSearchParams build() { + requireFile("user_image"); + return new FaceSearchSearchParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Search policy. most_similar (default) ranks every enrolled face in your application by similarity. blocklisted_or_approved restricts candidates to blocklisted faces, allowlisted faces, faces from approved sessions, and imported user-profile faces โ€” with blocklisted entries ranked first. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SearchType extends StringEnum { + /** The value {@code "most_similar"}. */ + public static final SearchType MOST_SIMILAR = new SearchType("most_similar"); + + /** The value {@code "blocklisted_or_approved"}. */ + public static final SearchType BLOCKLISTED_OR_APPROVED = new SearchType("blocklisted_or_approved"); + + private static final List KNOWN_VALUES = List.of(MOST_SIMILAR, BLOCKLISTED_OR_APPROVED); + + private SearchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SearchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SearchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/FaceSearchSearchResponse.java b/src/main/java/me/didit/types/FaceSearchSearchResponse.java new file mode 100644 index 0000000..4b0dc88 --- /dev/null +++ b/src/main/java/me/didit/types/FaceSearchSearchResponse.java @@ -0,0 +1,1447 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class FaceSearchSearchResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "face_search", "vendor_data", "metadata", "created_at"); + + private FaceSearchSearchResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceSearchSearchResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceSearchSearchResponse fromJson(JsonNode json) { + return new FaceSearchSearchResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The face_search field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceSearch() { + return Json.optional(json, "face_search", Conv.model(FaceSearchSearchResponse.FaceSearch::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated, e.g. 2026-06-12T01:04:42.763237+00:00. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceSearchSearchResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceSearchSearchResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The face_search field. + * + * @param faceSearch the value + * @return this builder + */ + public Builder faceSearch(FaceSearchSearchResponse.FaceSearch faceSearch) { + return set("face_search", Conv.model(FaceSearchSearchResponse.FaceSearch::fromJson), faceSearch); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated, e.g. 2026-06-12T01:04:42.763237+00:00. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceSearchSearchResponse} + */ + public FaceSearchSearchResponse build() { + return new FaceSearchSearchResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class FaceSearch extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "total_matches", "matches", "user_image", "warnings"); + + private FaceSearch(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceSearch} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceSearch fromJson(JsonNode json) { + return new FaceSearch(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Declined only when a FACE_IN_BLOCKLIST or POSSIBLE_FACE_IN_BLOCKLIST warning fired. Duplicate matches and multiple-face warnings never decline. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Status::of)); + } + + /** + * Number of entries in matches (0โ€“5). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalMatches() { + return Json.optional(json, "total_matches", Conv.LONG); + } + + /** + * Up to 5 faces from your face search index that exceed the similarity floor, ordered by similarity (with blocklisted entries ranked first when search_type=blocklisted_or_approved). Empty when no enrolled face is similar enough. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(FaceSearchSearchResponse.FaceSearch.Matches::fromJson))); + } + + /** + * Face-detection results for the submitted image. Entries here carry only bbox and confidence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userImage() { + return Json.optional(json, "user_image", Conv.model(FaceSearchSearchResponse.FaceSearch.UserImage::fromJson)); + } + + /** + * Risk signals. FACE_IN_BLOCKLIST / POSSIBLE_FACE_IN_BLOCKLIST (error) decline the search; MULTIPLE_FACES_DETECTED (warning) and DUPLICATED_FACE / POSSIBLE_DUPLICATED_FACE (information) are advisory. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(FaceSearchSearchResponse.FaceSearch.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceSearch}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceSearch from) { + super(from); + } + + /** + * Declined only when a FACE_IN_BLOCKLIST or POSSIBLE_FACE_IN_BLOCKLIST warning fired. Duplicate matches and multiple-face warnings never decline. + * + * @param status the value + * @return this builder + */ + public Builder status(FaceSearchSearchResponse.FaceSearch.Status status) { + return set("status", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Status::of), status); + } + + /** + * Number of entries in matches (0โ€“5). + * + * @param totalMatches the value + * @return this builder + */ + public Builder totalMatches(long totalMatches) { + return set("total_matches", Conv.LONG, totalMatches); + } + + /** + * Up to 5 faces from your face search index that exceed the similarity floor, ordered by similarity (with blocklisted entries ranked first when search_type=blocklisted_or_approved). Empty when no enrolled face is similar enough. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(FaceSearchSearchResponse.FaceSearch.Matches::fromJson)), matches); + } + + /** + * Face-detection results for the submitted image. Entries here carry only bbox and confidence. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(FaceSearchSearchResponse.FaceSearch.UserImage userImage) { + return set("user_image", Conv.model(FaceSearchSearchResponse.FaceSearch.UserImage::fromJson), userImage); + } + + /** + * Risk signals. FACE_IN_BLOCKLIST / POSSIBLE_FACE_IN_BLOCKLIST (error) decline the search; MULTIPLE_FACES_DETECTED (warning) and DUPLICATED_FACE / POSSIBLE_DUPLICATED_FACE (information) are advisory. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(FaceSearchSearchResponse.FaceSearch.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceSearch} + */ + public FaceSearch build() { + return new FaceSearch(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Declined only when a FACE_IN_BLOCKLIST or POSSIBLE_FACE_IN_BLOCKLIST warning fired. Duplicate matches and multiple-face warnings never decline. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "similarity_percentage", "source", "vendor_data", "vendor_user_id", "biometric_template_id", "verification_date", "user_details", "match_image_url", "status", "is_blocklisted", "is_allowlisted", "api_service"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the verification session the matched face belongs to. null when source is imported, list_entry, or retained_template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Human-friendly session number shown in the Business Console. null for non-session matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * Similarity between the submitted face and the matched face (0โ€“100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional similarityPercentage() { + return Json.optional(json, "similarity_percentage", Conv.DOUBLE); + } + + /** + * Where the matched face was enrolled from: session โ€” a verification session or a saved standalone API call; imported โ€” a face uploaded directly to a User profile; list_entry โ€” a face attached to one of your lists; retained_template โ€” an image-free biometric template stored on a User, listed under /v3/biometric-templates/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Matches.Source::of)); + } + + /** + * vendor_data of the matched session or linked User for imported and retained-template faces. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Linked User id. null for list entries and session matches without a User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserId() { + return Json.optional(json, "vendor_user_id", Conv.STRING); + } + + /** + * Id of the retained biometric template. Set only when source is retained_template; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateId() { + return Json.optional(json, "biometric_template_id", Conv.STRING); + } + + /** + * When the matched face was originally captured, or when a retained template was created (YYYY-MM-DDThh:mm:ssZ). null for list_entry matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * Identity data extracted during the matched session's document verification. null when the matched session has no document data (e.g. liveness-only sessions) and always null for retained_template matches. For source: imported matches it is populated from the User profile instead: full_name set, document_type/document_number null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userDetails() { + return Json.optional(json, "user_details", Conv.model(FaceSearchSearchResponse.FaceSearch.Matches.UserDetails::fromJson)); + } + + /** + * Time-limited URL (https://<media-host>/...) of the matched face's reference image when save_api_request=true. With save_api_request=false this is an internal storage path that is not directly downloadable. Always null for retained_template matches because retained templates contain no image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchImageUrl() { + return Json.optional(json, "match_image_url", Conv.STRING); + } + + /** + * Status of the matched session (Approved, Declined, In Review, โ€ฆ). null for imported/list_entry matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * true when the matched face is on your face blocklist. Any sufficiently similar blocklisted match declines the search. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * true when the matched face is on one of your allowlists. Allowlisted matches suppress duplicate warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isAllowlisted() { + return Json.optional(json, "is_allowlisted", Conv.BOOLEAN); + } + + /** + * Set when the matched face was enrolled by a standalone API call (e.g. PASSIVE_LIVENESS); null for regular verification sessions and imported faces. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * Id of the verification session the matched face belongs to. null when source is imported, list_entry, or retained_template. + * + * @param sessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionId(@Nullable String sessionId) { + return setNullable("session_id", Conv.STRING, sessionId); + } + + /** + * Human-friendly session number shown in the Business Console. null for non-session matches. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * Similarity between the submitted face and the matched face (0โ€“100). + * + * @param similarityPercentage the value + * @return this builder + */ + public Builder similarityPercentage(double similarityPercentage) { + return set("similarity_percentage", Conv.DOUBLE, similarityPercentage); + } + + /** + * Where the matched face was enrolled from: session โ€” a verification session or a saved standalone API call; imported โ€” a face uploaded directly to a User profile; list_entry โ€” a face attached to one of your lists; retained_template โ€” an image-free biometric template stored on a User, listed under /v3/biometric-templates/. + * + * @param source the value + * @return this builder + */ + public Builder source(FaceSearchSearchResponse.FaceSearch.Matches.Source source) { + return set("source", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Matches.Source::of), source); + } + + /** + * vendor_data of the matched session or linked User for imported and retained-template faces. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Linked User id. null for list entries and session matches without a User. + * + * @param vendorUserId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorUserId(@Nullable String vendorUserId) { + return setNullable("vendor_user_id", Conv.STRING, vendorUserId); + } + + /** + * Id of the retained biometric template. Set only when source is retained_template; null otherwise. + * + * @param biometricTemplateId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateId(@Nullable String biometricTemplateId) { + return setNullable("biometric_template_id", Conv.STRING, biometricTemplateId); + } + + /** + * When the matched face was originally captured, or when a retained template was created (YYYY-MM-DDThh:mm:ssZ). null for list_entry matches. + * + * @param verificationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationDate(@Nullable OffsetDateTime verificationDate) { + return setNullable("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * Identity data extracted during the matched session's document verification. null when the matched session has no document data (e.g. liveness-only sessions) and always null for retained_template matches. For source: imported matches it is populated from the User profile instead: full_name set, document_type/document_number null. + * + * @param userDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userDetails(FaceSearchSearchResponse.FaceSearch.Matches.@Nullable UserDetails userDetails) { + return setNullable("user_details", Conv.model(FaceSearchSearchResponse.FaceSearch.Matches.UserDetails::fromJson), userDetails); + } + + /** + * Time-limited URL (https://<media-host>/...) of the matched face's reference image when save_api_request=true. With save_api_request=false this is an internal storage path that is not directly downloadable. Always null for retained_template matches because retained templates contain no image. + * + * @param matchImageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchImageUrl(@Nullable String matchImageUrl) { + return setNullable("match_image_url", Conv.STRING, matchImageUrl); + } + + /** + * Status of the matched session (Approved, Declined, In Review, โ€ฆ). null for imported/list_entry matches. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * true when the matched face is on your face blocklist. Any sufficiently similar blocklisted match declines the search. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * true when the matched face is on one of your allowlists. Allowlisted matches suppress duplicate warnings. + * + * @param isAllowlisted the value + * @return this builder + */ + public Builder isAllowlisted(boolean isAllowlisted) { + return set("is_allowlisted", Conv.BOOLEAN, isAllowlisted); + } + + /** + * Set when the matched face was enrolled by a standalone API call (e.g. PASSIVE_LIVENESS); null for regular verification sessions and imported faces. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Where the matched face was enrolled from: session โ€” a verification session or a saved standalone API call; imported โ€” a face uploaded directly to a User profile; list_entry โ€” a face attached to one of your lists; retained_template โ€” an image-free biometric template stored on a User, listed under /v3/biometric-templates/. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "session"}. */ + public static final Source SESSION = new Source("session"); + + /** The value {@code "imported"}. */ + public static final Source IMPORTED = new Source("imported"); + + /** The value {@code "list_entry"}. */ + public static final Source LIST_ENTRY = new Source("list_entry"); + + /** The value {@code "retained_template"}. */ + public static final Source RETAINED_TEMPLATE = new Source("retained_template"); + + private static final List KNOWN_VALUES = List.of(SESSION, IMPORTED, LIST_ENTRY, RETAINED_TEMPLATE); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Identity data extracted during the matched session's document verification. null when the matched session has no document data (e.g. liveness-only sessions) and always null for retained_template matches. For source: imported matches it is populated from the User profile instead: full_name set, document_type/document_number null. + */ + public static final class UserDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "document_type", "document_number"); + + private UserDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserDetails fromJson(JsonNode json) { + return new UserDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserDetails from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The document_type field. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(@Nullable String documentType) { + return setNullable("document_type", Conv.STRING, documentType); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserDetails} + */ + public UserDetails build() { + return new UserDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Face-detection results for the submitted image. Entries here carry only bbox and confidence. + */ + public static final class UserImage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entities", "best_angle"); + + private UserImage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserImage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserImage fromJson(JsonNode json) { + return new UserImage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * One entry per detected face. The largest face is the one searched. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> entities() { + return Json.optional(json, "entities", Conv.list(Conv.model(FaceSearchSearchResponse.FaceSearch.UserImage.Entities::fromJson))); + } + + /** + * Rotation (degrees) that produced the best face detection; non-zero only when rotate_image=true corrected the orientation. Never null on this endpoint (defaults to 0 when the model omits it). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bestAngle() { + return Json.optional(json, "best_angle", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserImage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserImage from) { + super(from); + } + + /** + * One entry per detected face. The largest face is the one searched. + * + * @param entities the value + * @return this builder + */ + public Builder entities(List entities) { + return set("entities", Conv.list(Conv.model(FaceSearchSearchResponse.FaceSearch.UserImage.Entities::fromJson)), entities); + } + + /** + * Rotation (degrees) that produced the best face detection; non-zero only when rotate_image=true corrected the orientation. Never null on this endpoint (defaults to 0 when the model omits it). + * + * @param bestAngle the value + * @return this builder + */ + public Builder bestAngle(long bestAngle) { + return set("best_angle", Conv.LONG, bestAngle); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserImage} + */ + public UserImage build() { + return new UserImage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Entities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bbox", "confidence"); + + private Entities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Entities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Entities fromJson(JsonNode json) { + return new Entities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Bounding box [x_min, y_min, x_max, y_max] in pixels. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> bbox() { + return Json.optional(json, "bbox", Conv.list(Conv.LONG)); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Entities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Entities from) { + super(from); + } + + /** + * Bounding box [x_min, y_min, x_max, y_max] in pixels. + * + * @param bbox the value + * @return this builder + */ + public Builder bbox(List bbox) { + return set("bbox", Conv.list(Conv.LONG), bbox); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Entities} + */ + public Entities build() { + return new Entities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Warnings.Risk::of)); + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Warnings.Feature::of)); + } + + /** + * null for MULTIPLE_FACES_DETECTED. Blocklist hits carry {blocklisted_session_id, blocklisted_session_number, api_service}; duplicate hits carry {duplicated_session_id, duplicated_session_number, api_service} pointing at the first matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. + * + * @param risk the value + * @return this builder + */ + public Builder risk(FaceSearchSearchResponse.FaceSearch.Warnings.Risk risk) { + return set("risk", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Warnings.Risk::of), risk); + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(FaceSearchSearchResponse.FaceSearch.Warnings.Feature feature) { + return set("feature", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Warnings.Feature::of), feature); + } + + /** + * null for MULTIPLE_FACES_DETECTED. Blocklist hits carry {blocklisted_session_id, blocklisted_session_number, api_service}; duplicate hits carry {duplicated_session_id, duplicated_session_number, api_service} pointing at the first matching session. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + * @param logType the value + * @return this builder + */ + public Builder logType(FaceSearchSearchResponse.FaceSearch.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(FaceSearchSearchResponse.FaceSearch.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Machine-readable risk code. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Risk extends StringEnum { + /** The value {@code "MULTIPLE_FACES_DETECTED"}. */ + public static final Risk MULTIPLE_FACES_DETECTED = new Risk("MULTIPLE_FACES_DETECTED"); + + /** The value {@code "FACE_IN_BLOCKLIST"}. */ + public static final Risk FACE_IN_BLOCKLIST = new Risk("FACE_IN_BLOCKLIST"); + + /** The value {@code "POSSIBLE_FACE_IN_BLOCKLIST"}. */ + public static final Risk POSSIBLE_FACE_IN_BLOCKLIST = new Risk("POSSIBLE_FACE_IN_BLOCKLIST"); + + /** The value {@code "DUPLICATED_FACE"}. */ + public static final Risk DUPLICATED_FACE = new Risk("DUPLICATED_FACE"); + + /** The value {@code "POSSIBLE_DUPLICATED_FACE"}. */ + public static final Risk POSSIBLE_DUPLICATED_FACE = new Risk("POSSIBLE_DUPLICATED_FACE"); + + private static final List KNOWN_VALUES = List.of(MULTIPLE_FACES_DETECTED, FACE_IN_BLOCKLIST, POSSIBLE_FACE_IN_BLOCKLIST, DUPLICATED_FACE, POSSIBLE_DUPLICATED_FACE); + + private Risk(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Risk of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Risk::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + private static final List KNOWN_VALUES = List.of(LIVENESS); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/FraudAvailabilityEnum.java b/src/main/java/me/didit/types/FraudAvailabilityEnum.java new file mode 100644 index 0000000..48232b9 --- /dev/null +++ b/src/main/java/me/didit/types/FraudAvailabilityEnum.java @@ -0,0 +1,65 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudAvailabilityEnum extends StringEnum { + /** The value {@code "available"}. */ + public static final FraudAvailabilityEnum AVAILABLE = new FraudAvailabilityEnum("available"); + + /** The value {@code "not_requested"}. */ + public static final FraudAvailabilityEnum NOT_REQUESTED = new FraudAvailabilityEnum("not_requested"); + + /** The value {@code "no_reference"}. */ + public static final FraudAvailabilityEnum NO_REFERENCE = new FraudAvailabilityEnum("no_reference"); + + /** The value {@code "insufficient_history"}. */ + public static final FraudAvailabilityEnum INSUFFICIENT_HISTORY = new FraudAvailabilityEnum("insufficient_history"); + + /** The value {@code "unsupported_region"}. */ + public static final FraudAvailabilityEnum UNSUPPORTED_REGION = new FraudAvailabilityEnum("unsupported_region"); + + /** The value {@code "source_unavailable"}. */ + public static final FraudAvailabilityEnum SOURCE_UNAVAILABLE = new FraudAvailabilityEnum("source_unavailable"); + + private static final List KNOWN_VALUES = List.of(AVAILABLE, NOT_REQUESTED, NO_REFERENCE, INSUFFICIENT_HISTORY, UNSUPPORTED_REGION, SOURCE_UNAVAILABLE); + + private FraudAvailabilityEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudAvailabilityEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudAvailabilityEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudBadRequestErrorMessage.java b/src/main/java/me/didit/types/FraudBadRequestErrorMessage.java new file mode 100644 index 0000000..da85b6f --- /dev/null +++ b/src/main/java/me/didit/types/FraudBadRequestErrorMessage.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudBadRequestErrorMessage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private FraudBadRequestErrorMessage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudBadRequestErrorMessage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudBadRequestErrorMessage fromJson(JsonNode json) { + return new FraudBadRequestErrorMessage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudBadRequestErrorMessage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudBadRequestErrorMessage from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudBadRequestErrorMessage} + */ + public FraudBadRequestErrorMessage build() { + return new FraudBadRequestErrorMessage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudBandEnum.java b/src/main/java/me/didit/types/FraudBandEnum.java new file mode 100644 index 0000000..a2fd589 --- /dev/null +++ b/src/main/java/me/didit/types/FraudBandEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - low - Low + * - medium - Medium + * - high - High + * - unknown - Unknown + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudBandEnum extends StringEnum { + /** The value {@code "low"}. */ + public static final FraudBandEnum LOW = new FraudBandEnum("low"); + + /** The value {@code "medium"}. */ + public static final FraudBandEnum MEDIUM = new FraudBandEnum("medium"); + + /** The value {@code "high"}. */ + public static final FraudBandEnum HIGH = new FraudBandEnum("high"); + + /** The value {@code "unknown"}. */ + public static final FraudBandEnum UNKNOWN = new FraudBandEnum("unknown"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH, UNKNOWN); + + private FraudBandEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudBandEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudBandEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudCheckAttributesRequest.java b/src/main/java/me/didit/types/FraudCheckAttributesRequest.java new file mode 100644 index 0000000..94ccbdc --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckAttributesRequest.java @@ -0,0 +1,280 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Corroborating attributes. All optional; they widen module coverage. */ +public final class FraudCheckAttributesRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("first_name", "last_name", "full_name", "date_of_birth", "nationality", "gender", "address", "city", "state", "postal_code"); + + private FraudCheckAttributesRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckAttributesRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckAttributesRequest fromJson(JsonNode json) { + return new FraudCheckAttributesRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The gender field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * The address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * The state field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional state() { + return Json.optional(json, "state", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckAttributesRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckAttributesRequest from) { + super(from); + } + + /** + * The first_name field. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * The full_name field. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * The nationality field. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * The gender field. + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * The address field. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * The city field. + * + * @param city the value + * @return this builder + */ + public Builder city(String city) { + return set("city", Conv.STRING, city); + } + + /** + * The state field. + * + * @param state the value + * @return this builder + */ + public Builder state(String state) { + return set("state", Conv.STRING, state); + } + + /** + * The postal_code field. + * + * @param postalCode the value + * @return this builder + */ + public Builder postalCode(String postalCode) { + return set("postal_code", Conv.STRING, postalCode); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckAttributesRequest} + */ + public FraudCheckAttributesRequest build() { + return new FraudCheckAttributesRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckContextRequest.java b/src/main/java/me/didit/types/FraudCheckContextRequest.java new file mode 100644 index 0000000..ad7b8a0 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckContextRequest.java @@ -0,0 +1,178 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudCheckContextRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip_address", "user_agent", "country", "purpose", "consent_obtained"); + + private FraudCheckContextRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckContextRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckContextRequest fromJson(JsonNode json) { + return new FraudCheckContextRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The ip_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * The user_agent field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + /** + * Country the subject claims to be in. Contextual only - never proof of identity ownership. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The purpose field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional purpose() { + return Json.optional(json, "purpose", Conv.STRING); + } + + /** + * The consent_obtained field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional consentObtained() { + return Json.optional(json, "consent_obtained", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckContextRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckContextRequest from) { + super(from); + } + + /** + * The ip_address field. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * The user_agent field. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Country the subject claims to be in. Contextual only - never proof of identity ownership. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * The purpose field. + * + * @param purpose the value + * @return this builder + */ + public Builder purpose(String purpose) { + return set("purpose", Conv.STRING, purpose); + } + + /** + * The consent_obtained field. + * + * @param consentObtained the value + * @return this builder + */ + public Builder consentObtained(boolean consentObtained) { + return set("consent_obtained", Conv.BOOLEAN, consentObtained); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckContextRequest} + */ + public FraudCheckContextRequest build() { + return new FraudCheckContextRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckIdentifierRequest.java b/src/main/java/me/didit/types/FraudCheckIdentifierRequest.java new file mode 100644 index 0000000..0ba46ca --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckIdentifierRequest.java @@ -0,0 +1,181 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudCheckIdentifierRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "value", "country", "issuer"); + + private FraudCheckIdentifierRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckIdentifierRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckIdentifierRequest fromJson(JsonNode json) { + return new FraudCheckIdentifierRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Identifier type. Determines which namespace fields are required. + * + *

- email - Email + * - phone - Phone + * - national_id - National Id + * - tax_number - Tax Number + * - passport_number - Passport Number + * - driving_licence_number - Driving Licence Number + * - residence_permit_number - Residence Permit Number + * - voter_id - Voter Id + * - external_id - External Id + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudTypeEnum type() { + return Json.required(json, "type", Conv.enumeration(FraudTypeEnum::of)); + } + + /** + * The identifier value, in any customary format. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String value() { + return Json.required(json, "value", Conv.STRING); + } + + /** + * ISO-3166 alpha-2 or alpha-3 issuing country. Required for government identifier types: the same digits mean different people in different countries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Optional issuing authority or sub-national issuer, when the country alone is not unique. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckIdentifierRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckIdentifierRequest from) { + super(from); + } + + /** + * Identifier type. Determines which namespace fields are required. + * + *

- email - Email + * - phone - Phone + * - national_id - National Id + * - tax_number - Tax Number + * - passport_number - Passport Number + * - driving_licence_number - Driving Licence Number + * - residence_permit_number - Residence Permit Number + * - voter_id - Voter Id + * - external_id - External Id + * + * @param type the value + * @return this builder + */ + public Builder type(FraudTypeEnum type) { + return set("type", Conv.enumeration(FraudTypeEnum::of), type); + } + + /** + * The identifier value, in any customary format. + * + * @param value the value + * @return this builder + */ + public Builder value(String value) { + return set("value", Conv.STRING, value); + } + + /** + * ISO-3166 alpha-2 or alpha-3 issuing country. Required for government identifier types: the same digits mean different people in different countries. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Optional issuing authority or sub-national issuer, when the country alone is not unique. + * + * @param issuer the value + * @return this builder + */ + public Builder issuer(String issuer) { + return set("issuer", Conv.STRING, issuer); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckIdentifierRequest} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckIdentifierRequest build() { + require("type", false); + require("value", false); + return new FraudCheckIdentifierRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckIdentityRelationship.java b/src/main/java/me/didit/types/FraudCheckIdentityRelationship.java new file mode 100644 index 0000000..0e4d302 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckIdentityRelationship.java @@ -0,0 +1,199 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudCheckIdentityRelationship extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("result", "reference_type", "country", "availability", "reason_codes"); + + private FraudCheckIdentityRelationship(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckIdentityRelationship} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckIdentityRelationship fromJson(JsonNode json) { + return new FraudCheckIdentityRelationship(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - match - Match + * - mismatch - Mismatch + * - inconclusive - Inconclusive + * - no_reference - No Reference + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudResultEnum result() { + return Json.required(json, "result", Conv.enumeration(FraudResultEnum::of)); + } + + /** + * The reference_type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String referenceType() { + return Json.required(json, "reference_type", Conv.STRING); + } + + /** + * The country field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String country() { + return Json.required(json, "country", Conv.STRING); + } + + /** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudAvailabilityEnum availability() { + return Json.required(json, "availability", Conv.enumeration(FraudAvailabilityEnum::of)); + } + + /** + * The reason_codes field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List reasonCodes() { + return Json.required(json, "reason_codes", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckIdentityRelationship}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckIdentityRelationship from) { + super(from); + } + + /** + * - match - Match + * - mismatch - Mismatch + * - inconclusive - Inconclusive + * - no_reference - No Reference + * + * @param result the value + * @return this builder + */ + public Builder result(FraudResultEnum result) { + return set("result", Conv.enumeration(FraudResultEnum::of), result); + } + + /** + * The reference_type field. + * + * @param referenceType the value + * @return this builder + */ + public Builder referenceType(String referenceType) { + return set("reference_type", Conv.STRING, referenceType); + } + + /** + * The country field. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + * @param availability the value + * @return this builder + */ + public Builder availability(FraudAvailabilityEnum availability) { + return set("availability", Conv.enumeration(FraudAvailabilityEnum::of), availability); + } + + /** + * The reason_codes field. + * + * @param reasonCodes the value + * @return this builder + */ + public Builder reasonCodes(List reasonCodes) { + return set("reason_codes", Conv.list(Conv.STRING), reasonCodes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckIdentityRelationship} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckIdentityRelationship build() { + require("result", false); + require("reference_type", false); + require("country", false); + require("availability", false); + require("reason_codes", false); + return new FraudCheckIdentityRelationship(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckInput.java b/src/main/java/me/didit/types/FraudCheckInput.java new file mode 100644 index 0000000..891a48e --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckInput.java @@ -0,0 +1,230 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudCheckInput extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("reference", "type", "namespace", "quality", "normalization", "availability"); + + private FraudCheckInput(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckInput} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckInput fromJson(JsonNode json) { + return new FraudCheckInput(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Redacted handle for the submitted identifier. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String reference() { + return Json.required(json, "reference", Conv.STRING); + } + + /** + * - email - Email + * - phone - Phone + * - national_id - National Id + * - tax_number - Tax Number + * - passport_number - Passport Number + * - driving_licence_number - Driving Licence Number + * - residence_permit_number - Residence Permit Number + * - voter_id - Voter Id + * - external_id - External Id + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudTypeEnum type() { + return Json.required(json, "type", Conv.enumeration(FraudTypeEnum::of)); + } + + /** + * The namespace field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map namespace() { + return Json.required(json, "namespace", Conv.OBJECT); + } + + /** + * The quality field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String quality() { + return Json.required(json, "quality", Conv.STRING); + } + + /** + * The normalization field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map normalization() { + return Json.required(json, "normalization", Conv.OBJECT); + } + + /** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudAvailabilityEnum availability() { + return Json.required(json, "availability", Conv.enumeration(FraudAvailabilityEnum::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckInput}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckInput from) { + super(from); + } + + /** + * Redacted handle for the submitted identifier. + * + * @param reference the value + * @return this builder + */ + public Builder reference(String reference) { + return set("reference", Conv.STRING, reference); + } + + /** + * - email - Email + * - phone - Phone + * - national_id - National Id + * - tax_number - Tax Number + * - passport_number - Passport Number + * - driving_licence_number - Driving Licence Number + * - residence_permit_number - Residence Permit Number + * - voter_id - Voter Id + * - external_id - External Id + * + * @param type the value + * @return this builder + */ + public Builder type(FraudTypeEnum type) { + return set("type", Conv.enumeration(FraudTypeEnum::of), type); + } + + /** + * The namespace field. + * + * @param namespace the value + * @return this builder + */ + public Builder namespace(Map namespace) { + return setAny("namespace", namespace); + } + + /** + * The quality field. + * + * @param quality the value + * @return this builder + */ + public Builder quality(String quality) { + return set("quality", Conv.STRING, quality); + } + + /** + * The normalization field. + * + * @param normalization the value + * @return this builder + */ + public Builder normalization(Map normalization) { + return setAny("normalization", normalization); + } + + /** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + * @param availability the value + * @return this builder + */ + public Builder availability(FraudAvailabilityEnum availability) { + return set("availability", Conv.enumeration(FraudAvailabilityEnum::of), availability); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckInput} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckInput build() { + require("reference", false); + require("type", false); + require("namespace", false); + require("quality", false); + require("normalization", false); + require("availability", false); + return new FraudCheckInput(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckModuleReport.java b/src/main/java/me/didit/types/FraudCheckModuleReport.java new file mode 100644 index 0000000..786ab1f --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckModuleReport.java @@ -0,0 +1,230 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class FraudCheckModuleReport extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("module", "status", "reason", "latency_ms", "freshness", "billable_units"); + + private FraudCheckModuleReport(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckModuleReport} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckModuleReport fromJson(JsonNode json) { + return new FraudCheckModuleReport(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - normalization - Normalization + * - email_risk - Email Risk + * - email_social - Email Social + * - phone_social - Phone Social + * - phone_risk - Phone Risk + * - ip_risk - Ip Risk + * - database_validation - Database Validation + * - networks_same_org - Networks Same Org + * - networks_cross_org - Networks Cross Org + * - biometric_identity - Biometric Identity + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudExcludeEnum module() { + return Json.required(json, "module", Conv.enumeration(FraudExcludeEnum::of)); + } + + /** + * - planned - Planned + * - completed - Completed + * - skipped - Skipped + * - failed - Failed + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudStatusEnum status() { + return Json.required(json, "status", Conv.enumeration(FraudStatusEnum::of)); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The latency_ms field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long latencyMs() { + return Json.required(json, "latency_ms", Conv.LONG); + } + + /** + * The freshness field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional freshness() { + return Json.optional(json, "freshness", Conv.STRING); + } + + /** + * The billable_units field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long billableUnits() { + return Json.required(json, "billable_units", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckModuleReport}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckModuleReport from) { + super(from); + } + + /** + * - normalization - Normalization + * - email_risk - Email Risk + * - email_social - Email Social + * - phone_social - Phone Social + * - phone_risk - Phone Risk + * - ip_risk - Ip Risk + * - database_validation - Database Validation + * - networks_same_org - Networks Same Org + * - networks_cross_org - Networks Cross Org + * - biometric_identity - Biometric Identity + * + * @param module the value + * @return this builder + */ + public Builder module(FraudExcludeEnum module) { + return set("module", Conv.enumeration(FraudExcludeEnum::of), module); + } + + /** + * - planned - Planned + * - completed - Completed + * - skipped - Skipped + * - failed - Failed + * + * @param status the value + * @return this builder + */ + public Builder status(FraudStatusEnum status) { + return set("status", Conv.enumeration(FraudStatusEnum::of), status); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The latency_ms field. + * + * @param latencyMs the value + * @return this builder + */ + public Builder latencyMs(long latencyMs) { + return set("latency_ms", Conv.LONG, latencyMs); + } + + /** + * The freshness field. + * + * @param freshness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder freshness(@Nullable String freshness) { + return setNullable("freshness", Conv.STRING, freshness); + } + + /** + * The billable_units field. + * + * @param billableUnits the value + * @return this builder + */ + public Builder billableUnits(long billableUnits) { + return set("billable_units", Conv.LONG, billableUnits); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckModuleReport} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckModuleReport build() { + require("module", false); + require("status", false); + require("reason", true); + require("latency_ms", false); + require("freshness", true); + require("billable_units", false); + return new FraudCheckModuleReport(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckModuleSelectionRequest.java b/src/main/java/me/didit/types/FraudCheckModuleSelectionRequest.java new file mode 100644 index 0000000..a1fcb2e --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckModuleSelectionRequest.java @@ -0,0 +1,118 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudCheckModuleSelectionRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("include", "exclude"); + + private FraudCheckModuleSelectionRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckModuleSelectionRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckModuleSelectionRequest fromJson(JsonNode json) { + return new FraudCheckModuleSelectionRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The include field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> include() { + return Json.optional(json, "include", Conv.list(Conv.enumeration(FraudExcludeEnum::of))); + } + + /** + * The exclude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> exclude() { + return Json.optional(json, "exclude", Conv.list(Conv.enumeration(FraudExcludeEnum::of))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckModuleSelectionRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckModuleSelectionRequest from) { + super(from); + } + + /** + * The include field. + * + * @param include the value + * @return this builder + */ + public Builder include(List include) { + return set("include", Conv.list(Conv.enumeration(FraudExcludeEnum::of)), include); + } + + /** + * The exclude field. + * + * @param exclude the value + * @return this builder + */ + public Builder exclude(List exclude) { + return set("exclude", Conv.list(Conv.enumeration(FraudExcludeEnum::of)), exclude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckModuleSelectionRequest} + */ + public FraudCheckModuleSelectionRequest build() { + return new FraudCheckModuleSelectionRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckPlan.java b/src/main/java/me/didit/types/FraudCheckPlan.java new file mode 100644 index 0000000..884c989 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckPlan.java @@ -0,0 +1,227 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class FraudCheckPlan extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("profile_id", "profile_version", "modules", "estimated_price", "currency", "is_sandbox", "can_afford"); + + private FraudCheckPlan(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckPlan} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckPlan fromJson(JsonNode json) { + return new FraudCheckPlan(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The profile_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String profileId() { + return Json.required(json, "profile_id", Conv.STRING); + } + + /** + * The profile_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String profileVersion() { + return Json.required(json, "profile_version", Conv.STRING); + } + + /** + * The modules field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List modules() { + return Json.required(json, "modules", Conv.list(Conv.model(FraudCheckPlannedModule::fromJson))); + } + + /** + * The estimated_price field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedPrice() { + return Json.optional(json, "estimated_price", Conv.STRING); + } + + /** + * The currency field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currency() { + return Json.optional(json, "currency", Conv.STRING); + } + + /** + * The is_sandbox field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isSandbox() { + return Json.required(json, "is_sandbox", Conv.BOOLEAN); + } + + /** + * The can_afford field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean canAfford() { + return Json.required(json, "can_afford", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckPlan}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckPlan from) { + super(from); + } + + /** + * The profile_id field. + * + * @param profileId the value + * @return this builder + */ + public Builder profileId(String profileId) { + return set("profile_id", Conv.STRING, profileId); + } + + /** + * The profile_version field. + * + * @param profileVersion the value + * @return this builder + */ + public Builder profileVersion(String profileVersion) { + return set("profile_version", Conv.STRING, profileVersion); + } + + /** + * The modules field. + * + * @param modules the value + * @return this builder + */ + public Builder modules(List modules) { + return set("modules", Conv.list(Conv.model(FraudCheckPlannedModule::fromJson)), modules); + } + + /** + * The estimated_price field. + * + * @param estimatedPrice the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder estimatedPrice(@Nullable String estimatedPrice) { + return setNullable("estimated_price", Conv.STRING, estimatedPrice); + } + + /** + * The currency field. + * + * @param currency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currency(@Nullable String currency) { + return setNullable("currency", Conv.STRING, currency); + } + + /** + * The is_sandbox field. + * + * @param isSandbox the value + * @return this builder + */ + public Builder isSandbox(boolean isSandbox) { + return set("is_sandbox", Conv.BOOLEAN, isSandbox); + } + + /** + * The can_afford field. + * + * @param canAfford the value + * @return this builder + */ + public Builder canAfford(boolean canAfford) { + return set("can_afford", Conv.BOOLEAN, canAfford); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckPlan} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckPlan build() { + require("profile_id", false); + require("profile_version", false); + require("modules", false); + require("estimated_price", true); + require("currency", true); + require("is_sandbox", false); + require("can_afford", false); + return new FraudCheckPlan(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckPlannedModule.java b/src/main/java/me/didit/types/FraudCheckPlannedModule.java new file mode 100644 index 0000000..50c7927 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckPlannedModule.java @@ -0,0 +1,224 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class FraudCheckPlannedModule extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("module", "available", "availability_reason", "will_run", "selection_reason", "estimated_price"); + + private FraudCheckPlannedModule(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckPlannedModule} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckPlannedModule fromJson(JsonNode json) { + return new FraudCheckPlannedModule(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - normalization - Normalization + * - email_risk - Email Risk + * - email_social - Email Social + * - phone_social - Phone Social + * - phone_risk - Phone Risk + * - ip_risk - Ip Risk + * - database_validation - Database Validation + * - networks_same_org - Networks Same Org + * - networks_cross_org - Networks Cross Org + * - biometric_identity - Biometric Identity + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudExcludeEnum module() { + return Json.required(json, "module", Conv.enumeration(FraudExcludeEnum::of)); + } + + /** + * The available field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean available() { + return Json.required(json, "available", Conv.BOOLEAN); + } + + /** + * The availability_reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional availabilityReason() { + return Json.optional(json, "availability_reason", Conv.STRING); + } + + /** + * The will_run field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean willRun() { + return Json.required(json, "will_run", Conv.BOOLEAN); + } + + /** + * The selection_reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional selectionReason() { + return Json.optional(json, "selection_reason", Conv.STRING); + } + + /** + * The estimated_price field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedPrice() { + return Json.optional(json, "estimated_price", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckPlannedModule}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckPlannedModule from) { + super(from); + } + + /** + * - normalization - Normalization + * - email_risk - Email Risk + * - email_social - Email Social + * - phone_social - Phone Social + * - phone_risk - Phone Risk + * - ip_risk - Ip Risk + * - database_validation - Database Validation + * - networks_same_org - Networks Same Org + * - networks_cross_org - Networks Cross Org + * - biometric_identity - Biometric Identity + * + * @param module the value + * @return this builder + */ + public Builder module(FraudExcludeEnum module) { + return set("module", Conv.enumeration(FraudExcludeEnum::of), module); + } + + /** + * The available field. + * + * @param available the value + * @return this builder + */ + public Builder available(boolean available) { + return set("available", Conv.BOOLEAN, available); + } + + /** + * The availability_reason field. + * + * @param availabilityReason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder availabilityReason(@Nullable String availabilityReason) { + return setNullable("availability_reason", Conv.STRING, availabilityReason); + } + + /** + * The will_run field. + * + * @param willRun the value + * @return this builder + */ + public Builder willRun(boolean willRun) { + return set("will_run", Conv.BOOLEAN, willRun); + } + + /** + * The selection_reason field. + * + * @param selectionReason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder selectionReason(@Nullable String selectionReason) { + return setNullable("selection_reason", Conv.STRING, selectionReason); + } + + /** + * The estimated_price field. + * + * @param estimatedPrice the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder estimatedPrice(@Nullable String estimatedPrice) { + return setNullable("estimated_price", Conv.STRING, estimatedPrice); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckPlannedModule} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckPlannedModule build() { + require("module", false); + require("available", false); + require("availability_reason", true); + require("will_run", false); + require("selection_reason", true); + require("estimated_price", true); + return new FraudCheckPlannedModule(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckRequestRequest.java b/src/main/java/me/didit/types/FraudCheckRequestRequest.java new file mode 100644 index 0000000..91d3c46 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckRequestRequest.java @@ -0,0 +1,241 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class FraudCheckRequestRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("client_reference", "profile", "profile_version", "subject", "context", "checks", "vendor_data", "metadata"); + + private FraudCheckRequestRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckRequestRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckRequestRequest fromJson(JsonNode json) { + return new FraudCheckRequestRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own reference for this check. Doubles as the idempotency key: reusing it with the same body returns the original check without running or billing the modules again; reusing it with a different body returns 409. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientReference() { + return Json.optional(json, "client_reference", Conv.STRING); + } + + /** + * Orchestration profile id. Defaults to the Didit standard profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional profile() { + return Json.optional(json, "profile", Conv.STRING); + } + + /** + * Pin a frozen profile version. Defaults to the current version of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional profileVersion() { + return Json.optional(json, "profile_version", Conv.STRING); + } + + /** + * The subject field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudCheckSubjectRequest subject() { + return Json.required(json, "subject", Conv.model(FraudCheckSubjectRequest::fromJson)); + } + + /** + * The context field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional context() { + return Json.optional(json, "context", Conv.model(FraudCheckContextRequest::fromJson)); + } + + /** + * The checks field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional checks() { + return Json.optional(json, "checks", Conv.model(FraudCheckModuleSelectionRequest::fromJson)); + } + + /** + * The vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional metadata() { + return Json.optional(json, "metadata", Conv.ANY); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckRequestRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckRequestRequest from) { + super(from); + } + + /** + * Your own reference for this check. Doubles as the idempotency key: reusing it with the same body returns the original check without running or billing the modules again; reusing it with a different body returns 409. + * + * @param clientReference the value + * @return this builder + */ + public Builder clientReference(String clientReference) { + return set("client_reference", Conv.STRING, clientReference); + } + + /** + * Orchestration profile id. Defaults to the Didit standard profile. + * + * @param profile the value + * @return this builder + */ + public Builder profile(String profile) { + return set("profile", Conv.STRING, profile); + } + + /** + * Pin a frozen profile version. Defaults to the current version of the profile. + * + * @param profileVersion the value + * @return this builder + */ + public Builder profileVersion(String profileVersion) { + return set("profile_version", Conv.STRING, profileVersion); + } + + /** + * The subject field. + * + * @param subject the value + * @return this builder + */ + public Builder subject(FraudCheckSubjectRequest subject) { + return set("subject", Conv.model(FraudCheckSubjectRequest::fromJson), subject); + } + + /** + * The context field. + * + * @param context the value + * @return this builder + */ + public Builder context(FraudCheckContextRequest context) { + return set("context", Conv.model(FraudCheckContextRequest::fromJson), context); + } + + /** + * The checks field. + * + * @param checks the value + * @return this builder + */ + public Builder checks(FraudCheckModuleSelectionRequest checks) { + return set("checks", Conv.model(FraudCheckModuleSelectionRequest::fromJson), checks); + } + + /** + * The vendor_data field. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(@Nullable Object metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckRequestRequest} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckRequestRequest build() { + require("subject", false); + return new FraudCheckRequestRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckResponse.java b/src/main/java/me/didit/types/FraudCheckResponse.java new file mode 100644 index 0000000..9710453 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckResponse.java @@ -0,0 +1,575 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class FraudCheckResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("check_id", "request_id", "client_reference", "processing_status", "profile_id", "profile_version", "created_at", "completed_at", "inputs", "modules", "attribute_evidence", "compound_evidence", "risk", "network", "enrichment", "identity_relationship", "recommendation", "next_action", "decision_reasons", "coverage", "usage", "vendor_data", "metadata"); + + private FraudCheckResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckResponse fromJson(JsonNode json) { + return new FraudCheckResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The check_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String checkId() { + return Json.required(json, "check_id", Conv.STRING); + } + + /** + * Native verification session created for this check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The client_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional clientReference() { + return Json.optional(json, "client_reference", Conv.STRING); + } + + /** + * - pending - Pending + * - running - Running + * - completed - Completed + * - failed - Failed + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudProcessingStatusEnum processingStatus() { + return Json.required(json, "processing_status", Conv.enumeration(FraudProcessingStatusEnum::of)); + } + + /** + * The profile_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String profileId() { + return Json.required(json, "profile_id", Conv.STRING); + } + + /** + * The profile_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String profileVersion() { + return Json.required(json, "profile_version", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * The inputs field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List inputs() { + return Json.required(json, "inputs", Conv.list(Conv.model(FraudCheckInput::fromJson))); + } + + /** + * The modules field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List modules() { + return Json.required(json, "modules", Conv.list(Conv.model(FraudCheckModuleReport::fromJson))); + } + + /** + * The attribute_evidence field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List> attributeEvidence() { + return Json.required(json, "attribute_evidence", Conv.list(Conv.OBJECT)); + } + + /** + * The compound_evidence field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List> compoundEvidence() { + return Json.required(json, "compound_evidence", Conv.list(Conv.OBJECT)); + } + + /** + * The risk field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List risk() { + return Json.required(json, "risk", Conv.list(Conv.model(FraudCheckRisk::fromJson))); + } + + /** + * The network field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map network() { + return Json.required(json, "network", Conv.OBJECT); + } + + /** + * The enrichment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> enrichment() { + return Json.optional(json, "enrichment", Conv.OBJECT); + } + + /** + * The identity_relationship field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identityRelationship() { + return Json.optional(json, "identity_relationship", Conv.model(FraudCheckIdentityRelationship::fromJson)); + } + + /** + * - approve - Approve + * - review - Review + * - reject - Reject + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudRecommendationEnum recommendation() { + return Json.required(json, "recommendation", Conv.enumeration(FraudRecommendationEnum::of)); + } + + /** + * - none - None + * - manual_review - Manual Review + * - step_up - Step Up + * - resubmit_capture - Resubmit Capture + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudNextActionEnum nextAction() { + return Json.required(json, "next_action", Conv.enumeration(FraudNextActionEnum::of)); + } + + /** + * The decision_reasons field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List decisionReasons() { + return Json.required(json, "decision_reasons", Conv.list(Conv.STRING)); + } + + /** + * The coverage field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map coverage() { + return Json.required(json, "coverage", Conv.OBJECT); + } + + /** + * The usage field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List> usage() { + return Json.required(json, "usage", Conv.list(Conv.OBJECT)); + } + + /** + * The vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional metadata() { + return Json.optional(json, "metadata", Conv.ANY); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckResponse from) { + super(from); + } + + /** + * The check_id field. + * + * @param checkId the value + * @return this builder + */ + public Builder checkId(String checkId) { + return set("check_id", Conv.STRING, checkId); + } + + /** + * Native verification session created for this check. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The client_reference field. + * + * @param clientReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder clientReference(@Nullable String clientReference) { + return setNullable("client_reference", Conv.STRING, clientReference); + } + + /** + * - pending - Pending + * - running - Running + * - completed - Completed + * - failed - Failed + * + * @param processingStatus the value + * @return this builder + */ + public Builder processingStatus(FraudProcessingStatusEnum processingStatus) { + return set("processing_status", Conv.enumeration(FraudProcessingStatusEnum::of), processingStatus); + } + + /** + * The profile_id field. + * + * @param profileId the value + * @return this builder + */ + public Builder profileId(String profileId) { + return set("profile_id", Conv.STRING, profileId); + } + + /** + * The profile_version field. + * + * @param profileVersion the value + * @return this builder + */ + public Builder profileVersion(String profileVersion) { + return set("profile_version", Conv.STRING, profileVersion); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * The inputs field. + * + * @param inputs the value + * @return this builder + */ + public Builder inputs(List inputs) { + return set("inputs", Conv.list(Conv.model(FraudCheckInput::fromJson)), inputs); + } + + /** + * The modules field. + * + * @param modules the value + * @return this builder + */ + public Builder modules(List modules) { + return set("modules", Conv.list(Conv.model(FraudCheckModuleReport::fromJson)), modules); + } + + /** + * The attribute_evidence field. + * + * @param attributeEvidence the value + * @return this builder + */ + public Builder attributeEvidence(List> attributeEvidence) { + return setAny("attribute_evidence", attributeEvidence); + } + + /** + * The compound_evidence field. + * + * @param compoundEvidence the value + * @return this builder + */ + public Builder compoundEvidence(List> compoundEvidence) { + return setAny("compound_evidence", compoundEvidence); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(List risk) { + return set("risk", Conv.list(Conv.model(FraudCheckRisk::fromJson)), risk); + } + + /** + * The network field. + * + * @param network the value + * @return this builder + */ + public Builder network(Map network) { + return setAny("network", network); + } + + /** + * The enrichment field. + * + * @param enrichment the value + * @return this builder + */ + public Builder enrichment(Map enrichment) { + return setAny("enrichment", enrichment); + } + + /** + * The identity_relationship field. + * + * @param identityRelationship the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder identityRelationship(@Nullable FraudCheckIdentityRelationship identityRelationship) { + return setNullable("identity_relationship", Conv.model(FraudCheckIdentityRelationship::fromJson), identityRelationship); + } + + /** + * - approve - Approve + * - review - Review + * - reject - Reject + * + * @param recommendation the value + * @return this builder + */ + public Builder recommendation(FraudRecommendationEnum recommendation) { + return set("recommendation", Conv.enumeration(FraudRecommendationEnum::of), recommendation); + } + + /** + * - none - None + * - manual_review - Manual Review + * - step_up - Step Up + * - resubmit_capture - Resubmit Capture + * + * @param nextAction the value + * @return this builder + */ + public Builder nextAction(FraudNextActionEnum nextAction) { + return set("next_action", Conv.enumeration(FraudNextActionEnum::of), nextAction); + } + + /** + * The decision_reasons field. + * + * @param decisionReasons the value + * @return this builder + */ + public Builder decisionReasons(List decisionReasons) { + return set("decision_reasons", Conv.list(Conv.STRING), decisionReasons); + } + + /** + * The coverage field. + * + * @param coverage the value + * @return this builder + */ + public Builder coverage(Map coverage) { + return setAny("coverage", coverage); + } + + /** + * The usage field. + * + * @param usage the value + * @return this builder + */ + public Builder usage(List> usage) { + return setAny("usage", usage); + } + + /** + * The vendor_data field. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The metadata field. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Object metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckResponse} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckResponse build() { + require("check_id", false); + require("client_reference", true); + require("processing_status", false); + require("profile_id", false); + require("profile_version", false); + require("created_at", false); + require("completed_at", true); + require("inputs", false); + require("modules", false); + require("attribute_evidence", false); + require("compound_evidence", false); + require("risk", false); + require("network", false); + require("recommendation", false); + require("next_action", false); + require("decision_reasons", false); + require("coverage", false); + require("usage", false); + return new FraudCheckResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckRisk.java b/src/main/java/me/didit/types/FraudCheckRisk.java new file mode 100644 index 0000000..79f153e --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckRisk.java @@ -0,0 +1,251 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class FraudCheckRisk extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("dimension", "score", "band", "availability", "requested_but_unavailable", "reason_codes", "evidence_indexes"); + + private FraudCheckRisk(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckRisk} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckRisk fromJson(JsonNode json) { + return new FraudCheckRisk(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - identity - Identity + * - contact - Contact + * - device_network - Device Network + * - behavioral - Behavioral + * - fraud_network - Fraud Network + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudDimensionEnum dimension() { + return Json.required(json, "dimension", Conv.enumeration(FraudDimensionEnum::of)); + } + + /** + * The score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * - low - Low + * - medium - Medium + * - high - High + * - unknown - Unknown + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudBandEnum band() { + return Json.required(json, "band", Conv.enumeration(FraudBandEnum::of)); + } + + /** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public FraudAvailabilityEnum availability() { + return Json.required(json, "availability", Conv.enumeration(FraudAvailabilityEnum::of)); + } + + /** + * True when the request supplied everything this dimension needed and the platform still could not answer it. Such a check is never recommended for approval on the strength of the dimensions that did answer. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean requestedButUnavailable() { + return Json.required(json, "requested_but_unavailable", Conv.BOOLEAN); + } + + /** + * The reason_codes field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List reasonCodes() { + return Json.required(json, "reason_codes", Conv.list(Conv.STRING)); + } + + /** + * The evidence_indexes field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List evidenceIndexes() { + return Json.required(json, "evidence_indexes", Conv.list(Conv.LONG)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckRisk}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckRisk from) { + super(from); + } + + /** + * - identity - Identity + * - contact - Contact + * - device_network - Device Network + * - behavioral - Behavioral + * - fraud_network - Fraud Network + * + * @param dimension the value + * @return this builder + */ + public Builder dimension(FraudDimensionEnum dimension) { + return set("dimension", Conv.enumeration(FraudDimensionEnum::of), dimension); + } + + /** + * The score field. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Long score) { + return setNullable("score", Conv.LONG, score); + } + + /** + * - low - Low + * - medium - Medium + * - high - High + * - unknown - Unknown + * + * @param band the value + * @return this builder + */ + public Builder band(FraudBandEnum band) { + return set("band", Conv.enumeration(FraudBandEnum::of), band); + } + + /** + * - available - Available + * - not_requested - Not Requested + * - no_reference - No Reference + * - insufficient_history - Insufficient History + * - unsupported_region - Unsupported Region + * - source_unavailable - Source Unavailable + * + * @param availability the value + * @return this builder + */ + public Builder availability(FraudAvailabilityEnum availability) { + return set("availability", Conv.enumeration(FraudAvailabilityEnum::of), availability); + } + + /** + * True when the request supplied everything this dimension needed and the platform still could not answer it. Such a check is never recommended for approval on the strength of the dimensions that did answer. + * + * @param requestedButUnavailable the value + * @return this builder + */ + public Builder requestedButUnavailable(boolean requestedButUnavailable) { + return set("requested_but_unavailable", Conv.BOOLEAN, requestedButUnavailable); + } + + /** + * The reason_codes field. + * + * @param reasonCodes the value + * @return this builder + */ + public Builder reasonCodes(List reasonCodes) { + return set("reason_codes", Conv.list(Conv.STRING), reasonCodes); + } + + /** + * The evidence_indexes field. + * + * @param evidenceIndexes the value + * @return this builder + */ + public Builder evidenceIndexes(List evidenceIndexes) { + return set("evidence_indexes", Conv.list(Conv.LONG), evidenceIndexes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckRisk} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckRisk build() { + require("dimension", false); + require("score", true); + require("band", false); + require("availability", false); + require("requested_but_unavailable", false); + require("reason_codes", false); + require("evidence_indexes", false); + return new FraudCheckRisk(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudCheckSubjectRequest.java b/src/main/java/me/didit/types/FraudCheckSubjectRequest.java new file mode 100644 index 0000000..b323cd9 --- /dev/null +++ b/src/main/java/me/didit/types/FraudCheckSubjectRequest.java @@ -0,0 +1,140 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudCheckSubjectRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("selfie", "identifiers", "attributes"); + + private FraudCheckSubjectRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudCheckSubjectRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudCheckSubjectRequest fromJson(JsonNode json) { + return new FraudCheckSubjectRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Base64 JPEG, PNG or WebP selfie, up to 6 MB. No reference image or URL. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional selfie() { + return Json.optional(json, "selfie", Conv.STRING); + } + + /** + * One or more typed identifiers. One is enough. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List identifiers() { + return Json.required(json, "identifiers", Conv.list(Conv.model(FraudCheckIdentifierRequest::fromJson))); + } + + /** + * Corroborating attributes. All optional; they widen module coverage. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional attributes() { + return Json.optional(json, "attributes", Conv.model(FraudCheckAttributesRequest::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudCheckSubjectRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudCheckSubjectRequest from) { + super(from); + } + + /** + * Base64 JPEG, PNG or WebP selfie, up to 6 MB. No reference image or URL. + * + * @param selfie the value + * @return this builder + */ + public Builder selfie(String selfie) { + return set("selfie", Conv.STRING, selfie); + } + + /** + * One or more typed identifiers. One is enough. + * + * @param identifiers the value + * @return this builder + */ + public Builder identifiers(List identifiers) { + return set("identifiers", Conv.list(Conv.model(FraudCheckIdentifierRequest::fromJson)), identifiers); + } + + /** + * Corroborating attributes. All optional; they widen module coverage. + * + * @param attributes the value + * @return this builder + */ + public Builder attributes(FraudCheckAttributesRequest attributes) { + return set("attributes", Conv.model(FraudCheckAttributesRequest::fromJson), attributes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudCheckSubjectRequest} + * @throws IllegalStateException when a required field is missing + */ + public FraudCheckSubjectRequest build() { + require("identifiers", false); + return new FraudCheckSubjectRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudClientCredentialsErrorMessage.java b/src/main/java/me/didit/types/FraudClientCredentialsErrorMessage.java new file mode 100644 index 0000000..9183067 --- /dev/null +++ b/src/main/java/me/didit/types/FraudClientCredentialsErrorMessage.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudClientCredentialsErrorMessage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private FraudClientCredentialsErrorMessage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudClientCredentialsErrorMessage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudClientCredentialsErrorMessage fromJson(JsonNode json) { + return new FraudClientCredentialsErrorMessage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudClientCredentialsErrorMessage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudClientCredentialsErrorMessage from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudClientCredentialsErrorMessage} + */ + public FraudClientCredentialsErrorMessage build() { + return new FraudClientCredentialsErrorMessage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudClientCredentialsForbiddenErrorMessage.java b/src/main/java/me/didit/types/FraudClientCredentialsForbiddenErrorMessage.java new file mode 100644 index 0000000..cc623fc --- /dev/null +++ b/src/main/java/me/didit/types/FraudClientCredentialsForbiddenErrorMessage.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class FraudClientCredentialsForbiddenErrorMessage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private FraudClientCredentialsForbiddenErrorMessage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FraudClientCredentialsForbiddenErrorMessage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FraudClientCredentialsForbiddenErrorMessage fromJson(JsonNode json) { + return new FraudClientCredentialsForbiddenErrorMessage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FraudClientCredentialsForbiddenErrorMessage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FraudClientCredentialsForbiddenErrorMessage from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FraudClientCredentialsForbiddenErrorMessage} + */ + public FraudClientCredentialsForbiddenErrorMessage build() { + return new FraudClientCredentialsForbiddenErrorMessage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/FraudDimensionEnum.java b/src/main/java/me/didit/types/FraudDimensionEnum.java new file mode 100644 index 0000000..a1835d5 --- /dev/null +++ b/src/main/java/me/didit/types/FraudDimensionEnum.java @@ -0,0 +1,61 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - identity - Identity + * - contact - Contact + * - device_network - Device Network + * - behavioral - Behavioral + * - fraud_network - Fraud Network + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudDimensionEnum extends StringEnum { + /** The value {@code "identity"}. */ + public static final FraudDimensionEnum IDENTITY = new FraudDimensionEnum("identity"); + + /** The value {@code "contact"}. */ + public static final FraudDimensionEnum CONTACT = new FraudDimensionEnum("contact"); + + /** The value {@code "device_network"}. */ + public static final FraudDimensionEnum DEVICE_NETWORK = new FraudDimensionEnum("device_network"); + + /** The value {@code "behavioral"}. */ + public static final FraudDimensionEnum BEHAVIORAL = new FraudDimensionEnum("behavioral"); + + /** The value {@code "fraud_network"}. */ + public static final FraudDimensionEnum FRAUD_NETWORK = new FraudDimensionEnum("fraud_network"); + + private static final List KNOWN_VALUES = List.of(IDENTITY, CONTACT, DEVICE_NETWORK, BEHAVIORAL, FRAUD_NETWORK); + + private FraudDimensionEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudDimensionEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudDimensionEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudExcludeEnum.java b/src/main/java/me/didit/types/FraudExcludeEnum.java new file mode 100644 index 0000000..5158114 --- /dev/null +++ b/src/main/java/me/didit/types/FraudExcludeEnum.java @@ -0,0 +1,81 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - normalization - Normalization + * - email_risk - Email Risk + * - email_social - Email Social + * - phone_social - Phone Social + * - phone_risk - Phone Risk + * - ip_risk - Ip Risk + * - database_validation - Database Validation + * - networks_same_org - Networks Same Org + * - networks_cross_org - Networks Cross Org + * - biometric_identity - Biometric Identity + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudExcludeEnum extends StringEnum { + /** The value {@code "normalization"}. */ + public static final FraudExcludeEnum NORMALIZATION = new FraudExcludeEnum("normalization"); + + /** The value {@code "email_risk"}. */ + public static final FraudExcludeEnum EMAIL_RISK = new FraudExcludeEnum("email_risk"); + + /** The value {@code "email_social"}. */ + public static final FraudExcludeEnum EMAIL_SOCIAL = new FraudExcludeEnum("email_social"); + + /** The value {@code "phone_social"}. */ + public static final FraudExcludeEnum PHONE_SOCIAL = new FraudExcludeEnum("phone_social"); + + /** The value {@code "phone_risk"}. */ + public static final FraudExcludeEnum PHONE_RISK = new FraudExcludeEnum("phone_risk"); + + /** The value {@code "ip_risk"}. */ + public static final FraudExcludeEnum IP_RISK = new FraudExcludeEnum("ip_risk"); + + /** The value {@code "database_validation"}. */ + public static final FraudExcludeEnum DATABASE_VALIDATION = new FraudExcludeEnum("database_validation"); + + /** The value {@code "networks_same_org"}. */ + public static final FraudExcludeEnum NETWORKS_SAME_ORG = new FraudExcludeEnum("networks_same_org"); + + /** The value {@code "networks_cross_org"}. */ + public static final FraudExcludeEnum NETWORKS_CROSS_ORG = new FraudExcludeEnum("networks_cross_org"); + + /** The value {@code "biometric_identity"}. */ + public static final FraudExcludeEnum BIOMETRIC_IDENTITY = new FraudExcludeEnum("biometric_identity"); + + private static final List KNOWN_VALUES = List.of(NORMALIZATION, EMAIL_RISK, EMAIL_SOCIAL, PHONE_SOCIAL, PHONE_RISK, IP_RISK, DATABASE_VALIDATION, NETWORKS_SAME_ORG, NETWORKS_CROSS_ORG, BIOMETRIC_IDENTITY); + + private FraudExcludeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudExcludeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudExcludeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudNextActionEnum.java b/src/main/java/me/didit/types/FraudNextActionEnum.java new file mode 100644 index 0000000..beca7c2 --- /dev/null +++ b/src/main/java/me/didit/types/FraudNextActionEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - none - None + * - manual_review - Manual Review + * - step_up - Step Up + * - resubmit_capture - Resubmit Capture + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudNextActionEnum extends StringEnum { + /** The value {@code "none"}. */ + public static final FraudNextActionEnum NONE = new FraudNextActionEnum("none"); + + /** The value {@code "manual_review"}. */ + public static final FraudNextActionEnum MANUAL_REVIEW = new FraudNextActionEnum("manual_review"); + + /** The value {@code "step_up"}. */ + public static final FraudNextActionEnum STEP_UP = new FraudNextActionEnum("step_up"); + + /** The value {@code "resubmit_capture"}. */ + public static final FraudNextActionEnum RESUBMIT_CAPTURE = new FraudNextActionEnum("resubmit_capture"); + + private static final List KNOWN_VALUES = List.of(NONE, MANUAL_REVIEW, STEP_UP, RESUBMIT_CAPTURE); + + private FraudNextActionEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudNextActionEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudNextActionEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudProcessingStatusEnum.java b/src/main/java/me/didit/types/FraudProcessingStatusEnum.java new file mode 100644 index 0000000..060222f --- /dev/null +++ b/src/main/java/me/didit/types/FraudProcessingStatusEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - pending - Pending + * - running - Running + * - completed - Completed + * - failed - Failed + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudProcessingStatusEnum extends StringEnum { + /** The value {@code "pending"}. */ + public static final FraudProcessingStatusEnum PENDING = new FraudProcessingStatusEnum("pending"); + + /** The value {@code "running"}. */ + public static final FraudProcessingStatusEnum RUNNING = new FraudProcessingStatusEnum("running"); + + /** The value {@code "completed"}. */ + public static final FraudProcessingStatusEnum COMPLETED = new FraudProcessingStatusEnum("completed"); + + /** The value {@code "failed"}. */ + public static final FraudProcessingStatusEnum FAILED = new FraudProcessingStatusEnum("failed"); + + private static final List KNOWN_VALUES = List.of(PENDING, RUNNING, COMPLETED, FAILED); + + private FraudProcessingStatusEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudProcessingStatusEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudProcessingStatusEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudRecommendationEnum.java b/src/main/java/me/didit/types/FraudRecommendationEnum.java new file mode 100644 index 0000000..5c91676 --- /dev/null +++ b/src/main/java/me/didit/types/FraudRecommendationEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - approve - Approve + * - review - Review + * - reject - Reject + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudRecommendationEnum extends StringEnum { + /** The value {@code "approve"}. */ + public static final FraudRecommendationEnum APPROVE = new FraudRecommendationEnum("approve"); + + /** The value {@code "review"}. */ + public static final FraudRecommendationEnum REVIEW = new FraudRecommendationEnum("review"); + + /** The value {@code "reject"}. */ + public static final FraudRecommendationEnum REJECT = new FraudRecommendationEnum("reject"); + + private static final List KNOWN_VALUES = List.of(APPROVE, REVIEW, REJECT); + + private FraudRecommendationEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudRecommendationEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudRecommendationEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudResultEnum.java b/src/main/java/me/didit/types/FraudResultEnum.java new file mode 100644 index 0000000..4bcb735 --- /dev/null +++ b/src/main/java/me/didit/types/FraudResultEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - match - Match + * - mismatch - Mismatch + * - inconclusive - Inconclusive + * - no_reference - No Reference + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudResultEnum extends StringEnum { + /** The value {@code "match"}. */ + public static final FraudResultEnum MATCH = new FraudResultEnum("match"); + + /** The value {@code "mismatch"}. */ + public static final FraudResultEnum MISMATCH = new FraudResultEnum("mismatch"); + + /** The value {@code "inconclusive"}. */ + public static final FraudResultEnum INCONCLUSIVE = new FraudResultEnum("inconclusive"); + + /** The value {@code "no_reference"}. */ + public static final FraudResultEnum NO_REFERENCE = new FraudResultEnum("no_reference"); + + private static final List KNOWN_VALUES = List.of(MATCH, MISMATCH, INCONCLUSIVE, NO_REFERENCE); + + private FraudResultEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudResultEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudResultEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudStatusEnum.java b/src/main/java/me/didit/types/FraudStatusEnum.java new file mode 100644 index 0000000..2bbde4d --- /dev/null +++ b/src/main/java/me/didit/types/FraudStatusEnum.java @@ -0,0 +1,57 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - planned - Planned + * - completed - Completed + * - skipped - Skipped + * - failed - Failed + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudStatusEnum extends StringEnum { + /** The value {@code "planned"}. */ + public static final FraudStatusEnum PLANNED = new FraudStatusEnum("planned"); + + /** The value {@code "completed"}. */ + public static final FraudStatusEnum COMPLETED = new FraudStatusEnum("completed"); + + /** The value {@code "skipped"}. */ + public static final FraudStatusEnum SKIPPED = new FraudStatusEnum("skipped"); + + /** The value {@code "failed"}. */ + public static final FraudStatusEnum FAILED = new FraudStatusEnum("failed"); + + private static final List KNOWN_VALUES = List.of(PLANNED, COMPLETED, SKIPPED, FAILED); + + private FraudStatusEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudStatusEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudStatusEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/FraudTypeEnum.java b/src/main/java/me/didit/types/FraudTypeEnum.java new file mode 100644 index 0000000..764f2b4 --- /dev/null +++ b/src/main/java/me/didit/types/FraudTypeEnum.java @@ -0,0 +1,77 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - email - Email + * - phone - Phone + * - national_id - National Id + * - tax_number - Tax Number + * - passport_number - Passport Number + * - driving_licence_number - Driving Licence Number + * - residence_permit_number - Residence Permit Number + * - voter_id - Voter Id + * - external_id - External Id + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class FraudTypeEnum extends StringEnum { + /** The value {@code "email"}. */ + public static final FraudTypeEnum EMAIL = new FraudTypeEnum("email"); + + /** The value {@code "phone"}. */ + public static final FraudTypeEnum PHONE = new FraudTypeEnum("phone"); + + /** The value {@code "national_id"}. */ + public static final FraudTypeEnum NATIONAL_ID = new FraudTypeEnum("national_id"); + + /** The value {@code "tax_number"}. */ + public static final FraudTypeEnum TAX_NUMBER = new FraudTypeEnum("tax_number"); + + /** The value {@code "passport_number"}. */ + public static final FraudTypeEnum PASSPORT_NUMBER = new FraudTypeEnum("passport_number"); + + /** The value {@code "driving_licence_number"}. */ + public static final FraudTypeEnum DRIVING_LICENCE_NUMBER = new FraudTypeEnum("driving_licence_number"); + + /** The value {@code "residence_permit_number"}. */ + public static final FraudTypeEnum RESIDENCE_PERMIT_NUMBER = new FraudTypeEnum("residence_permit_number"); + + /** The value {@code "voter_id"}. */ + public static final FraudTypeEnum VOTER_ID = new FraudTypeEnum("voter_id"); + + /** The value {@code "external_id"}. */ + public static final FraudTypeEnum EXTERNAL_ID = new FraudTypeEnum("external_id"); + + private static final List KNOWN_VALUES = List.of(EMAIL, PHONE, NATIONAL_ID, TAX_NUMBER, PASSPORT_NUMBER, DRIVING_LICENCE_NUMBER, RESIDENCE_PERMIT_NUMBER, VOTER_ID, EXTERNAL_ID); + + private FraudTypeEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FraudTypeEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FraudTypeEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/IPRiskRequest.java b/src/main/java/me/didit/types/IPRiskRequest.java new file mode 100644 index 0000000..e9a41b3 --- /dev/null +++ b/src/main/java/me/didit/types/IPRiskRequest.java @@ -0,0 +1,181 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class IPRiskRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip_address", "claimed_country", "user_agent", "vendor_data", "metadata"); + + private IPRiskRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IPRiskRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IPRiskRequest fromJson(JsonNode json) { + return new IPRiskRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * IPv4 or IPv6 address to score. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String ipAddress() { + return Json.required(json, "ip_address", Conv.STRING); + } + + /** + * Optional ISO 3166-1 alpha-2 or alpha-3 country claimed by the user or session. Used to calculate country_mismatch. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional claimedCountry() { + return Json.optional(json, "claimed_country", Conv.STRING); + } + + /** + * User agent observed by your backend. Stored as request context; it does not provide device fingerprinting. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + /** + * Your stable reference for this request. Stored on the API session and echoed in the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Your non-sensitive JSON metadata. Stored on the API session and echoed in the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IPRiskRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IPRiskRequest from) { + super(from); + } + + /** + * IPv4 or IPv6 address to score. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Optional ISO 3166-1 alpha-2 or alpha-3 country claimed by the user or session. Used to calculate country_mismatch. + * + * @param claimedCountry the value + * @return this builder + */ + public Builder claimedCountry(String claimedCountry) { + return set("claimed_country", Conv.STRING, claimedCountry); + } + + /** + * User agent observed by your backend. Stored as request context; it does not provide device fingerprinting. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Your stable reference for this request. Stored on the API session and echoed in the response. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Your non-sensitive JSON metadata. Stored on the API session and echoed in the response. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IPRiskRequest} + * @throws IllegalStateException when a required field is missing + */ + public IPRiskRequest build() { + require("ip_address", false); + return new IPRiskRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/IPRiskResponse.java b/src/main/java/me/didit/types/IPRiskResponse.java new file mode 100644 index 0000000..1e5f2fd --- /dev/null +++ b/src/main/java/me/didit/types/IPRiskResponse.java @@ -0,0 +1,802 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class IPRiskResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "vendor_data", "metadata", "created_at", "ip"); + + private IPRiskResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IPRiskResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IPRiskResponse fromJson(JsonNode json) { + return new IPRiskResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the API session created for this request. Store it with vendor_data if you need to correlate the result with later webhooks or console activity. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * Decision for this API session: In Review on network or country-mismatch risk, otherwise Approved. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public IPRiskResponse.Status status() { + return Json.required(json, "status", Conv.enumeration(IPRiskResponse.Status::of)); + } + + /** + * Echo of the vendor_data you sent, null when you did not send one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent, null when you did not send one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Timestamp of this response. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * IP risk result. Individual enrichment fields can be null when the lookup returned no usable data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ip() { + return Json.optional(json, "ip", Conv.model(IPRiskResponse.Ip::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IPRiskResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IPRiskResponse from) { + super(from); + } + + /** + * Id of the API session created for this request. Store it with vendor_data if you need to correlate the result with later webhooks or console activity. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Decision for this API session: In Review on network or country-mismatch risk, otherwise Approved. + * + * @param status the value + * @return this builder + */ + public Builder status(IPRiskResponse.Status status) { + return set("status", Conv.enumeration(IPRiskResponse.Status::of), status); + } + + /** + * Echo of the vendor_data you sent, null when you did not send one. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent, null when you did not send one. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Timestamp of this response. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * IP risk result. Individual enrichment fields can be null when the lookup returned no usable data. + * + * @param ip the value + * @return this builder + */ + public Builder ip(IPRiskResponse.Ip ip) { + return set("ip", Conv.model(IPRiskResponse.Ip::fromJson), ip); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IPRiskResponse} + * @throws IllegalStateException when a required field is missing + */ + public IPRiskResponse build() { + require("request_id", false); + require("status", false); + require("created_at", false); + return new IPRiskResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Decision for this API session: In Review on network or country-mismatch risk, otherwise Approved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * IP risk result. Individual enrichment fields can be null when the lookup returned no usable data. + */ + public static final class Ip extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "ip_address", "ip_country", "ip_country_code", "ip_state", "ip_city", "latitude", "longitude", "isp", "organization", "is_vpn_or_tor", "is_data_center", "time_zone", "time_zone_offset", "asn_number", "asn_organization", "connection_type", "carrier", "proxy_type", "claimed_country", "country_mismatch", "threat"); + + private Ip(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Ip} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Ip fromJson(JsonNode json) { + return new Ip(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise Approved. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public IPRiskResponse.Ip.Status status() { + return Json.required(json, "status", Conv.enumeration(IPRiskResponse.Ip.Status::of)); + } + + /** + * The scored address. null when no enrichment source returned usable data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Resolved country name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountry() { + return Json.optional(json, "ip_country", Conv.STRING); + } + + /** + * Resolved country code. Compare countries through country_mismatch instead of comparing raw country strings yourself. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * Resolved state or region. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipState() { + return Json.optional(json, "ip_state", Conv.STRING); + } + + /** + * Resolved city. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCity() { + return Json.optional(json, "ip_city", Conv.STRING); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + /** + * Internet service provider serving the address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isp() { + return Json.optional(json, "isp", Conv.STRING); + } + + /** + * Organization owning the address block. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organization() { + return Json.optional(json, "organization", Conv.STRING); + } + + /** + * true when the address is associated with VPN or Tor infrastructure. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVpnOrTor() { + return Json.optional(json, "is_vpn_or_tor", Conv.BOOLEAN); + } + + /** + * true when the address belongs to a hosting or data-center network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDataCenter() { + return Json.optional(json, "is_data_center", Conv.BOOLEAN); + } + + /** + * Time zone of the resolved location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZone() { + return Json.optional(json, "time_zone", Conv.STRING); + } + + /** + * UTC offset of the resolved location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZoneOffset() { + return Json.optional(json, "time_zone_offset", Conv.STRING); + } + + /** + * Autonomous system number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional asnNumber() { + return Json.optional(json, "asn_number", Conv.DOUBLE); + } + + /** + * Organization operating the autonomous system. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional asnOrganization() { + return Json.optional(json, "asn_organization", Conv.STRING); + } + + /** + * Connection classification (e.g., cellular, hosting). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional connectionType() { + return Json.optional(json, "connection_type", Conv.STRING); + } + + /** + * Mobile carrier when the address is on a mobile network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional carrier() { + return Json.optional(json, "carrier", Conv.STRING); + } + + /** + * Proxy classification when the address is behind a proxy. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional proxyType() { + return Json.optional(json, "proxy_type", Conv.STRING); + } + + /** + * Echo of the claimed_country you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional claimedCountry() { + return Json.optional(json, "claimed_country", Conv.STRING); + } + + /** + * true when the resolved country differs from claimed_country. null when no enrichment data or no claimed country is available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryMismatch() { + return Json.optional(json, "country_mismatch", Conv.BOOLEAN); + } + + /** + * Free-form network-threat evidence from the enrichment source (e.g., is_proxy, is_tor). Empty object when no enrichment data is available. Treat as diagnostic detail, not a stable contract. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map threat() { + return Json.required(json, "threat", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Ip}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Ip from) { + super(from); + } + + /** + * In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise Approved. + * + * @param status the value + * @return this builder + */ + public Builder status(IPRiskResponse.Ip.Status status) { + return set("status", Conv.enumeration(IPRiskResponse.Ip.Status::of), status); + } + + /** + * The scored address. null when no enrichment source returned usable data. + * + * @param ipAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipAddress(@Nullable String ipAddress) { + return setNullable("ip_address", Conv.STRING, ipAddress); + } + + /** + * Resolved country name. + * + * @param ipCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCountry(@Nullable String ipCountry) { + return setNullable("ip_country", Conv.STRING, ipCountry); + } + + /** + * Resolved country code. Compare countries through country_mismatch instead of comparing raw country strings yourself. + * + * @param ipCountryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCountryCode(@Nullable String ipCountryCode) { + return setNullable("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * Resolved state or region. + * + * @param ipState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipState(@Nullable String ipState) { + return setNullable("ip_state", Conv.STRING, ipState); + } + + /** + * Resolved city. + * + * @param ipCity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCity(@Nullable String ipCity) { + return setNullable("ip_city", Conv.STRING, ipCity); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @param latitude the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder latitude(@Nullable Double latitude) { + return setNullable("latitude", Conv.DOUBLE, latitude); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @param longitude the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder longitude(@Nullable Double longitude) { + return setNullable("longitude", Conv.DOUBLE, longitude); + } + + /** + * Internet service provider serving the address. + * + * @param isp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isp(@Nullable String isp) { + return setNullable("isp", Conv.STRING, isp); + } + + /** + * Organization owning the address block. + * + * @param organization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder organization(@Nullable String organization) { + return setNullable("organization", Conv.STRING, organization); + } + + /** + * true when the address is associated with VPN or Tor infrastructure. + * + * @param isVpnOrTor the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isVpnOrTor(@Nullable Boolean isVpnOrTor) { + return setNullable("is_vpn_or_tor", Conv.BOOLEAN, isVpnOrTor); + } + + /** + * true when the address belongs to a hosting or data-center network. + * + * @param isDataCenter the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDataCenter(@Nullable Boolean isDataCenter) { + return setNullable("is_data_center", Conv.BOOLEAN, isDataCenter); + } + + /** + * Time zone of the resolved location. + * + * @param timeZone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder timeZone(@Nullable String timeZone) { + return setNullable("time_zone", Conv.STRING, timeZone); + } + + /** + * UTC offset of the resolved location. + * + * @param timeZoneOffset the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder timeZoneOffset(@Nullable String timeZoneOffset) { + return setNullable("time_zone_offset", Conv.STRING, timeZoneOffset); + } + + /** + * Autonomous system number. + * + * @param asnNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder asnNumber(@Nullable Double asnNumber) { + return setNullable("asn_number", Conv.DOUBLE, asnNumber); + } + + /** + * Organization operating the autonomous system. + * + * @param asnOrganization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder asnOrganization(@Nullable String asnOrganization) { + return setNullable("asn_organization", Conv.STRING, asnOrganization); + } + + /** + * Connection classification (e.g., cellular, hosting). + * + * @param connectionType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder connectionType(@Nullable String connectionType) { + return setNullable("connection_type", Conv.STRING, connectionType); + } + + /** + * Mobile carrier when the address is on a mobile network. + * + * @param carrier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder carrier(@Nullable String carrier) { + return setNullable("carrier", Conv.STRING, carrier); + } + + /** + * Proxy classification when the address is behind a proxy. + * + * @param proxyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder proxyType(@Nullable String proxyType) { + return setNullable("proxy_type", Conv.STRING, proxyType); + } + + /** + * Echo of the claimed_country you sent. + * + * @param claimedCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder claimedCountry(@Nullable String claimedCountry) { + return setNullable("claimed_country", Conv.STRING, claimedCountry); + } + + /** + * true when the resolved country differs from claimed_country. null when no enrichment data or no claimed country is available. + * + * @param countryMismatch the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryMismatch(@Nullable Boolean countryMismatch) { + return setNullable("country_mismatch", Conv.BOOLEAN, countryMismatch); + } + + /** + * Free-form network-threat evidence from the enrichment source (e.g., is_proxy, is_tor). Empty object when no enrichment data is available. Treat as diagnostic detail, not a stable contract. + * + * @param threat the value + * @return this builder + */ + public Builder threat(Map threat) { + return setAny("threat", threat); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Ip} + * @throws IllegalStateException when a required field is missing + */ + public Ip build() { + require("status", false); + require("threat", false); + return new Ip(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise Approved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/IPRiskResult.java b/src/main/java/me/didit/types/IPRiskResult.java new file mode 100644 index 0000000..2bdb707 --- /dev/null +++ b/src/main/java/me/didit/types/IPRiskResult.java @@ -0,0 +1,569 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * IP risk result. Individual enrichment fields can be null when the lookup returned no usable data. + */ +public final class IPRiskResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "ip_address", "ip_country", "ip_country_code", "ip_state", "ip_city", "latitude", "longitude", "isp", "organization", "is_vpn_or_tor", "is_data_center", "time_zone", "time_zone_offset", "asn_number", "asn_organization", "connection_type", "carrier", "proxy_type", "claimed_country", "country_mismatch", "threat"); + + private IPRiskResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IPRiskResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IPRiskResult fromJson(JsonNode json) { + return new IPRiskResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise Approved. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public IPRiskResult.Status status() { + return Json.required(json, "status", Conv.enumeration(IPRiskResult.Status::of)); + } + + /** + * The scored address. null when no enrichment source returned usable data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Resolved country name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountry() { + return Json.optional(json, "ip_country", Conv.STRING); + } + + /** + * Resolved country code. Compare countries through country_mismatch instead of comparing raw country strings yourself. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * Resolved state or region. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipState() { + return Json.optional(json, "ip_state", Conv.STRING); + } + + /** + * Resolved city. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCity() { + return Json.optional(json, "ip_city", Conv.STRING); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + /** + * Internet service provider serving the address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isp() { + return Json.optional(json, "isp", Conv.STRING); + } + + /** + * Organization owning the address block. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organization() { + return Json.optional(json, "organization", Conv.STRING); + } + + /** + * true when the address is associated with VPN or Tor infrastructure. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVpnOrTor() { + return Json.optional(json, "is_vpn_or_tor", Conv.BOOLEAN); + } + + /** + * true when the address belongs to a hosting or data-center network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDataCenter() { + return Json.optional(json, "is_data_center", Conv.BOOLEAN); + } + + /** + * Time zone of the resolved location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZone() { + return Json.optional(json, "time_zone", Conv.STRING); + } + + /** + * UTC offset of the resolved location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZoneOffset() { + return Json.optional(json, "time_zone_offset", Conv.STRING); + } + + /** + * Autonomous system number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional asnNumber() { + return Json.optional(json, "asn_number", Conv.DOUBLE); + } + + /** + * Organization operating the autonomous system. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional asnOrganization() { + return Json.optional(json, "asn_organization", Conv.STRING); + } + + /** + * Connection classification (e.g., cellular, hosting). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional connectionType() { + return Json.optional(json, "connection_type", Conv.STRING); + } + + /** + * Mobile carrier when the address is on a mobile network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional carrier() { + return Json.optional(json, "carrier", Conv.STRING); + } + + /** + * Proxy classification when the address is behind a proxy. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional proxyType() { + return Json.optional(json, "proxy_type", Conv.STRING); + } + + /** + * Echo of the claimed_country you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional claimedCountry() { + return Json.optional(json, "claimed_country", Conv.STRING); + } + + /** + * true when the resolved country differs from claimed_country. null when no enrichment data or no claimed country is available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryMismatch() { + return Json.optional(json, "country_mismatch", Conv.BOOLEAN); + } + + /** + * Free-form network-threat evidence from the enrichment source (e.g., is_proxy, is_tor). Empty object when no enrichment data is available. Treat as diagnostic detail, not a stable contract. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map threat() { + return Json.required(json, "threat", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IPRiskResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IPRiskResult from) { + super(from); + } + + /** + * In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise Approved. + * + * @param status the value + * @return this builder + */ + public Builder status(IPRiskResult.Status status) { + return set("status", Conv.enumeration(IPRiskResult.Status::of), status); + } + + /** + * The scored address. null when no enrichment source returned usable data. + * + * @param ipAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipAddress(@Nullable String ipAddress) { + return setNullable("ip_address", Conv.STRING, ipAddress); + } + + /** + * Resolved country name. + * + * @param ipCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCountry(@Nullable String ipCountry) { + return setNullable("ip_country", Conv.STRING, ipCountry); + } + + /** + * Resolved country code. Compare countries through country_mismatch instead of comparing raw country strings yourself. + * + * @param ipCountryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCountryCode(@Nullable String ipCountryCode) { + return setNullable("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * Resolved state or region. + * + * @param ipState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipState(@Nullable String ipState) { + return setNullable("ip_state", Conv.STRING, ipState); + } + + /** + * Resolved city. + * + * @param ipCity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCity(@Nullable String ipCity) { + return setNullable("ip_city", Conv.STRING, ipCity); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @param latitude the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder latitude(@Nullable Double latitude) { + return setNullable("latitude", Conv.DOUBLE, latitude); + } + + /** + * Approximate network geolocation, not a precise device location. + * + * @param longitude the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder longitude(@Nullable Double longitude) { + return setNullable("longitude", Conv.DOUBLE, longitude); + } + + /** + * Internet service provider serving the address. + * + * @param isp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isp(@Nullable String isp) { + return setNullable("isp", Conv.STRING, isp); + } + + /** + * Organization owning the address block. + * + * @param organization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder organization(@Nullable String organization) { + return setNullable("organization", Conv.STRING, organization); + } + + /** + * true when the address is associated with VPN or Tor infrastructure. + * + * @param isVpnOrTor the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isVpnOrTor(@Nullable Boolean isVpnOrTor) { + return setNullable("is_vpn_or_tor", Conv.BOOLEAN, isVpnOrTor); + } + + /** + * true when the address belongs to a hosting or data-center network. + * + * @param isDataCenter the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDataCenter(@Nullable Boolean isDataCenter) { + return setNullable("is_data_center", Conv.BOOLEAN, isDataCenter); + } + + /** + * Time zone of the resolved location. + * + * @param timeZone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder timeZone(@Nullable String timeZone) { + return setNullable("time_zone", Conv.STRING, timeZone); + } + + /** + * UTC offset of the resolved location. + * + * @param timeZoneOffset the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder timeZoneOffset(@Nullable String timeZoneOffset) { + return setNullable("time_zone_offset", Conv.STRING, timeZoneOffset); + } + + /** + * Autonomous system number. + * + * @param asnNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder asnNumber(@Nullable Double asnNumber) { + return setNullable("asn_number", Conv.DOUBLE, asnNumber); + } + + /** + * Organization operating the autonomous system. + * + * @param asnOrganization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder asnOrganization(@Nullable String asnOrganization) { + return setNullable("asn_organization", Conv.STRING, asnOrganization); + } + + /** + * Connection classification (e.g., cellular, hosting). + * + * @param connectionType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder connectionType(@Nullable String connectionType) { + return setNullable("connection_type", Conv.STRING, connectionType); + } + + /** + * Mobile carrier when the address is on a mobile network. + * + * @param carrier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder carrier(@Nullable String carrier) { + return setNullable("carrier", Conv.STRING, carrier); + } + + /** + * Proxy classification when the address is behind a proxy. + * + * @param proxyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder proxyType(@Nullable String proxyType) { + return setNullable("proxy_type", Conv.STRING, proxyType); + } + + /** + * Echo of the claimed_country you sent. + * + * @param claimedCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder claimedCountry(@Nullable String claimedCountry) { + return setNullable("claimed_country", Conv.STRING, claimedCountry); + } + + /** + * true when the resolved country differs from claimed_country. null when no enrichment data or no claimed country is available. + * + * @param countryMismatch the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryMismatch(@Nullable Boolean countryMismatch) { + return setNullable("country_mismatch", Conv.BOOLEAN, countryMismatch); + } + + /** + * Free-form network-threat evidence from the enrichment source (e.g., is_proxy, is_tor). Empty object when no enrichment data is available. Treat as diagnostic detail, not a stable contract. + * + * @param threat the value + * @return this builder + */ + public Builder threat(Map threat) { + return setAny("threat", threat); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IPRiskResult} + * @throws IllegalStateException when a required field is missing + */ + public IPRiskResult build() { + require("status", false); + require("threat", false); + return new IPRiskResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * In Review when the resolved country conflicts with claimed_country, or when the address is associated with VPN, Tor, or data-center infrastructure. Otherwise Approved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/IdVerificationVerifyParams.java b/src/main/java/me/didit/types/IdVerificationVerifyParams.java new file mode 100644 index 0000000..701db06 --- /dev/null +++ b/src/main/java/me/didit/types/IdVerificationVerifyParams.java @@ -0,0 +1,660 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code id_verification.verify}. */ +public final class IdVerificationVerifyParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("front_image", "front_image_password", "back_image", "back_image_password", "perform_document_liveness", "minimum_age", "expiration_date_not_detected_action", "invalid_mrz_action", "inconsistent_data_action", "critical_field_occlusion_action", "document_or_personal_number_format_mismatch_action", "preferred_characters", "save_api_request", "vendor_data", "metadata"); + + private IdVerificationVerifyParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IdVerificationVerifyParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IdVerificationVerifyParams fromJson(JsonNode json) { + return new IdVerificationVerifyParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Front side of the identity document. Allowed extensions: tiff, jpg, jpeg, png, webp, pdf. Maximum upload size: 10 MB (larger files are rejected with 400). PDFs are rendered to an image before OCR; encrypted PDFs require front_image_password. Images are automatically compressed to ~0.5 MB and EXIF orientation is applied. Upload the full, uncropped capture with all four corners of the document visible. + * + * @return the file to upload, if set + */ + public Optional frontImage() { + return file("front_image"); + } + + /** + * Password to decrypt front_image when it is an encrypted PDF. Sending an encrypted PDF without (or with a wrong) password returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImagePassword() { + return Json.optional(json, "front_image_password", Conv.STRING); + } + + /** + * Back side of the document โ€” send it whenever the document has one (many ID cards carry the MRZ or a barcode on the back; omitting it simply leaves the MRZ and back-side fields empty in the response โ€” this endpoint does not raise a missing-MRZ warning). Same format and size limits as front_image. When omitted, back_image and back-side fields are null in the response. + * + * @return the file to upload, if set + */ + public Optional backImage() { + return file("back_image"); + } + + /** + * Password to decrypt back_image when it is an encrypted PDF. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImagePassword() { + return Json.optional(json, "back_image_password", Conv.STRING); + } + + /** + * Screens both images for presentation fraud: screen replays (SCREEN_CAPTURE_DETECTED), printed copies (PRINTED_COPY_DETECTED), and portrait manipulation (PORTRAIT_MANIPULATION_DETECTED). Any of these auto-declines. Enabled by default; set to false to skip fraud screening and reduce latency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional performDocumentLiveness() { + return Json.optional(json, "perform_document_liveness", Conv.BOOLEAN); + } + + /** + * Accepted and validated (1โ€“120) but currently not applied by this endpoint โ€” it never produces a MINIMUM_AGE_NOT_MET warning from this field. Enforce age rules from the returned date_of_birth/age, or use a verification-session workflow with age restrictions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minimumAge() { + return Json.optional(json, "minimum_age", Conv.LONG); + } + + /** + * What to do when no expiration date can be read (EXPIRATION_DATE_NOT_DETECTED). Default NO_ACTION because many identity documents print no expiry date. Note: a *detected and past* expiry date always declines (DOCUMENT_EXPIRED), regardless of this option. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDateNotDetectedAction() { + return Json.optional(json, "expiration_date_not_detected_action", Conv.enumeration(IdVerificationVerifyParams.ExpirationDateNotDetectedAction::of)); + } + + /** + * What to do when the extracted MRZ fails check-digit validation (MRZ_VALIDATION_FAILED). A missing MRZ raises no warning on this endpoint. Only relevant for documents that carry an MRZ. REVIEW is not supported on this endpoint and returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional invalidMrzAction() { + return Json.optional(json, "invalid_mrz_action", Conv.enumeration(IdVerificationVerifyParams.InvalidMrzAction::of)); + } + + /** + * What to do when extracted data is internally inconsistent: DATA_INCONSISTENT, MRZ_AND_DATA_EXTRACTED_FROM_OCR_NOT_SAME (visual zone disagrees with the MRZ), or DOCUMENT_NAME_DIFFERENT_FROM_OTHER_APPROVED_DOCUMENTS. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inconsistentDataAction() { + return Json.optional(json, "inconsistent_data_action", Conv.enumeration(IdVerificationVerifyParams.InconsistentDataAction::of)); + } + + /** + * What to do when a critical printed field was physically covered on the capture (CRITICAL_FIELD_OCCLUSION_DETECTED) - an identity number, a name, the date of birth, or the expiry date. Declines by default, like this endpoint's other document-integrity risks: covering the numbers a report is reconciled against is what a redacted document looks like. The value read for a covered field is dropped from the extraction either way, so the matching *_NOT_DETECTED warning usually accompanies it. REVIEW is not supported on this endpoint and returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional criticalFieldOcclusionAction() { + return Json.optional(json, "critical_field_occlusion_action", Conv.enumeration(IdVerificationVerifyParams.CriticalFieldOcclusionAction::of)); + } + + /** + * What to do when a number does not match the format its issuing authority uses for that document type (DOCUMENT_NUMBER_FORMAT_MISMATCH, PERSONAL_NUMBER_FORMAT_MISMATCH). Default NO_ACTION, which reports the warning without changing the status. REVIEW is not supported on this endpoint and returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentOrPersonalNumberFormatMismatchAction() { + return Json.optional(json, "document_or_personal_number_format_mismatch_action", Conv.enumeration(IdVerificationVerifyParams.DocumentOrPersonalNumberFormatMismatchAction::of)); + } + + /** + * Preferred script for name/address fields on documents that print both Latin and non-Latin text (Arabic, Cyrillic, CJK, โ€ฆ). latin returns transliterated/Latin values; non_latin prefers the native script. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional preferredCharacters() { + return Json.optional(json, "preferred_characters", Conv.enumeration(IdVerificationVerifyParams.PreferredCharacters::of)); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, announced through a status.updated webhook, and with document images returned as media URLs. When false, nothing is stored, request_id is a transient UUID, and images are returned inline as base64 JPEG strings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"onboarding"}) โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IdVerificationVerifyParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IdVerificationVerifyParams from) { + super(from); + } + + /** + * Front side of the identity document. Allowed extensions: tiff, jpg, jpeg, png, webp, pdf. Maximum upload size: 10 MB (larger files are rejected with 400). PDFs are rendered to an image before OCR; encrypted PDFs require front_image_password. Images are automatically compressed to ~0.5 MB and EXIF orientation is applied. Upload the full, uncropped capture with all four corners of the document visible. + * + * @param frontImage the value + * @return this builder + */ + public Builder frontImage(FileUpload frontImage) { + return setFile("front_image", frontImage); + } + + /** + * Uploads the file at {@code path} as {@code front_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder frontImage(Path path) { + return setFile("front_image", FileUpload.of(path)); + } + + /** + * Password to decrypt front_image when it is an encrypted PDF. Sending an encrypted PDF without (or with a wrong) password returns 400. + * + * @param frontImagePassword the value + * @return this builder + */ + public Builder frontImagePassword(String frontImagePassword) { + return set("front_image_password", Conv.STRING, frontImagePassword); + } + + /** + * Back side of the document โ€” send it whenever the document has one (many ID cards carry the MRZ or a barcode on the back; omitting it simply leaves the MRZ and back-side fields empty in the response โ€” this endpoint does not raise a missing-MRZ warning). Same format and size limits as front_image. When omitted, back_image and back-side fields are null in the response. + * + * @param backImage the value + * @return this builder + */ + public Builder backImage(FileUpload backImage) { + return setFile("back_image", backImage); + } + + /** + * Uploads the file at {@code path} as {@code back_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder backImage(Path path) { + return setFile("back_image", FileUpload.of(path)); + } + + /** + * Password to decrypt back_image when it is an encrypted PDF. + * + * @param backImagePassword the value + * @return this builder + */ + public Builder backImagePassword(String backImagePassword) { + return set("back_image_password", Conv.STRING, backImagePassword); + } + + /** + * Screens both images for presentation fraud: screen replays (SCREEN_CAPTURE_DETECTED), printed copies (PRINTED_COPY_DETECTED), and portrait manipulation (PORTRAIT_MANIPULATION_DETECTED). Any of these auto-declines. Enabled by default; set to false to skip fraud screening and reduce latency. + * + * @param performDocumentLiveness the value + * @return this builder + */ + public Builder performDocumentLiveness(boolean performDocumentLiveness) { + return set("perform_document_liveness", Conv.BOOLEAN, performDocumentLiveness); + } + + /** + * Accepted and validated (1โ€“120) but currently not applied by this endpoint โ€” it never produces a MINIMUM_AGE_NOT_MET warning from this field. Enforce age rules from the returned date_of_birth/age, or use a verification-session workflow with age restrictions. + * + * @param minimumAge the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder minimumAge(@Nullable Long minimumAge) { + return setNullable("minimum_age", Conv.LONG, minimumAge); + } + + /** + * What to do when no expiration date can be read (EXPIRATION_DATE_NOT_DETECTED). Default NO_ACTION because many identity documents print no expiry date. Note: a *detected and past* expiry date always declines (DOCUMENT_EXPIRED), regardless of this option. + * + * @param expirationDateNotDetectedAction the value + * @return this builder + */ + public Builder expirationDateNotDetectedAction(IdVerificationVerifyParams.ExpirationDateNotDetectedAction expirationDateNotDetectedAction) { + return set("expiration_date_not_detected_action", Conv.enumeration(IdVerificationVerifyParams.ExpirationDateNotDetectedAction::of), expirationDateNotDetectedAction); + } + + /** + * What to do when the extracted MRZ fails check-digit validation (MRZ_VALIDATION_FAILED). A missing MRZ raises no warning on this endpoint. Only relevant for documents that carry an MRZ. REVIEW is not supported on this endpoint and returns 400. + * + * @param invalidMrzAction the value + * @return this builder + */ + public Builder invalidMrzAction(IdVerificationVerifyParams.InvalidMrzAction invalidMrzAction) { + return set("invalid_mrz_action", Conv.enumeration(IdVerificationVerifyParams.InvalidMrzAction::of), invalidMrzAction); + } + + /** + * What to do when extracted data is internally inconsistent: DATA_INCONSISTENT, MRZ_AND_DATA_EXTRACTED_FROM_OCR_NOT_SAME (visual zone disagrees with the MRZ), or DOCUMENT_NAME_DIFFERENT_FROM_OTHER_APPROVED_DOCUMENTS. + * + * @param inconsistentDataAction the value + * @return this builder + */ + public Builder inconsistentDataAction(IdVerificationVerifyParams.InconsistentDataAction inconsistentDataAction) { + return set("inconsistent_data_action", Conv.enumeration(IdVerificationVerifyParams.InconsistentDataAction::of), inconsistentDataAction); + } + + /** + * What to do when a critical printed field was physically covered on the capture (CRITICAL_FIELD_OCCLUSION_DETECTED) - an identity number, a name, the date of birth, or the expiry date. Declines by default, like this endpoint's other document-integrity risks: covering the numbers a report is reconciled against is what a redacted document looks like. The value read for a covered field is dropped from the extraction either way, so the matching *_NOT_DETECTED warning usually accompanies it. REVIEW is not supported on this endpoint and returns 400. + * + * @param criticalFieldOcclusionAction the value + * @return this builder + */ + public Builder criticalFieldOcclusionAction(IdVerificationVerifyParams.CriticalFieldOcclusionAction criticalFieldOcclusionAction) { + return set("critical_field_occlusion_action", Conv.enumeration(IdVerificationVerifyParams.CriticalFieldOcclusionAction::of), criticalFieldOcclusionAction); + } + + /** + * What to do when a number does not match the format its issuing authority uses for that document type (DOCUMENT_NUMBER_FORMAT_MISMATCH, PERSONAL_NUMBER_FORMAT_MISMATCH). Default NO_ACTION, which reports the warning without changing the status. REVIEW is not supported on this endpoint and returns 400. + * + * @param documentOrPersonalNumberFormatMismatchAction the value + * @return this builder + */ + public Builder documentOrPersonalNumberFormatMismatchAction(IdVerificationVerifyParams.DocumentOrPersonalNumberFormatMismatchAction documentOrPersonalNumberFormatMismatchAction) { + return set("document_or_personal_number_format_mismatch_action", Conv.enumeration(IdVerificationVerifyParams.DocumentOrPersonalNumberFormatMismatchAction::of), documentOrPersonalNumberFormatMismatchAction); + } + + /** + * Preferred script for name/address fields on documents that print both Latin and non-Latin text (Arabic, Cyrillic, CJK, โ€ฆ). latin returns transliterated/Latin values; non_latin prefers the native script. + * + * @param preferredCharacters the value + * @return this builder + */ + public Builder preferredCharacters(IdVerificationVerifyParams.PreferredCharacters preferredCharacters) { + return set("preferred_characters", Conv.enumeration(IdVerificationVerifyParams.PreferredCharacters::of), preferredCharacters); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, announced through a status.updated webhook, and with document images returned as media URLs. When false, nothing is stored, request_id is a transient UUID, and images are returned inline as base64 JPEG strings. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"onboarding"}) โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IdVerificationVerifyParams} + * @throws IllegalStateException when a required field is missing + */ + public IdVerificationVerifyParams build() { + requireFile("front_image"); + return new IdVerificationVerifyParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What to do when no expiration date can be read (EXPIRATION_DATE_NOT_DETECTED). Default NO_ACTION because many identity documents print no expiry date. Note: a *detected and past* expiry date always declines (DOCUMENT_EXPIRED), regardless of this option. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExpirationDateNotDetectedAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final ExpirationDateNotDetectedAction NO_ACTION = new ExpirationDateNotDetectedAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final ExpirationDateNotDetectedAction DECLINE = new ExpirationDateNotDetectedAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private ExpirationDateNotDetectedAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExpirationDateNotDetectedAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExpirationDateNotDetectedAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the extracted MRZ fails check-digit validation (MRZ_VALIDATION_FAILED). A missing MRZ raises no warning on this endpoint. Only relevant for documents that carry an MRZ. REVIEW is not supported on this endpoint and returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class InvalidMrzAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final InvalidMrzAction NO_ACTION = new InvalidMrzAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final InvalidMrzAction DECLINE = new InvalidMrzAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private InvalidMrzAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static InvalidMrzAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, InvalidMrzAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when extracted data is internally inconsistent: DATA_INCONSISTENT, MRZ_AND_DATA_EXTRACTED_FROM_OCR_NOT_SAME (visual zone disagrees with the MRZ), or DOCUMENT_NAME_DIFFERENT_FROM_OTHER_APPROVED_DOCUMENTS. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class InconsistentDataAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final InconsistentDataAction NO_ACTION = new InconsistentDataAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final InconsistentDataAction DECLINE = new InconsistentDataAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private InconsistentDataAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static InconsistentDataAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, InconsistentDataAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when a critical printed field was physically covered on the capture (CRITICAL_FIELD_OCCLUSION_DETECTED) - an identity number, a name, the date of birth, or the expiry date. Declines by default, like this endpoint's other document-integrity risks: covering the numbers a report is reconciled against is what a redacted document looks like. The value read for a covered field is dropped from the extraction either way, so the matching *_NOT_DETECTED warning usually accompanies it. REVIEW is not supported on this endpoint and returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class CriticalFieldOcclusionAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final CriticalFieldOcclusionAction NO_ACTION = new CriticalFieldOcclusionAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final CriticalFieldOcclusionAction DECLINE = new CriticalFieldOcclusionAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private CriticalFieldOcclusionAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CriticalFieldOcclusionAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CriticalFieldOcclusionAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when a number does not match the format its issuing authority uses for that document type (DOCUMENT_NUMBER_FORMAT_MISMATCH, PERSONAL_NUMBER_FORMAT_MISMATCH). Default NO_ACTION, which reports the warning without changing the status. REVIEW is not supported on this endpoint and returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentOrPersonalNumberFormatMismatchAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final DocumentOrPersonalNumberFormatMismatchAction NO_ACTION = new DocumentOrPersonalNumberFormatMismatchAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final DocumentOrPersonalNumberFormatMismatchAction DECLINE = new DocumentOrPersonalNumberFormatMismatchAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private DocumentOrPersonalNumberFormatMismatchAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentOrPersonalNumberFormatMismatchAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentOrPersonalNumberFormatMismatchAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Preferred script for name/address fields on documents that print both Latin and non-Latin text (Arabic, Cyrillic, CJK, โ€ฆ). latin returns transliterated/Latin values; non_latin prefers the native script. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PreferredCharacters extends StringEnum { + /** The value {@code "latin"}. */ + public static final PreferredCharacters LATIN = new PreferredCharacters("latin"); + + /** The value {@code "non_latin"}. */ + public static final PreferredCharacters NON_LATIN = new PreferredCharacters("non_latin"); + + private static final List KNOWN_VALUES = List.of(LATIN, NON_LATIN); + + private PreferredCharacters(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PreferredCharacters of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PreferredCharacters::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/IdVerificationVerifyResponse.java b/src/main/java/me/didit/types/IdVerificationVerifyResponse.java new file mode 100644 index 0000000..8f955fa --- /dev/null +++ b/src/main/java/me/didit/types/IdVerificationVerifyResponse.java @@ -0,0 +1,2704 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class IdVerificationVerifyResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "id_verification", "vendor_data", "metadata", "created_at"); + + private IdVerificationVerifyResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IdVerificationVerifyResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IdVerificationVerifyResponse fromJson(JsonNode json) { + return new IdVerificationVerifyResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The id_verification field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional idVerification() { + return Json.optional(json, "id_verification", Conv.model(IdVerificationVerifyResponse.IdVerification::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IdVerificationVerifyResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IdVerificationVerifyResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The id_verification field. + * + * @param idVerification the value + * @return this builder + */ + public Builder idVerification(IdVerificationVerifyResponse.IdVerification idVerification) { + return set("id_verification", Conv.model(IdVerificationVerifyResponse.IdVerification::fromJson), idVerification); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IdVerificationVerifyResponse} + */ + public IdVerificationVerifyResponse build() { + return new IdVerificationVerifyResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class IdVerification extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "document_type", "document_subtype", "document_number", "personal_number", "portrait_image", "front_image", "back_image", "front_image_camera_front", "back_image_camera_front", "front_image_camera_front_face_match_score", "back_image_camera_front_face_match_score", "front_image_quality_score", "back_image_quality_score", "date_of_birth", "age", "expiration_date", "date_of_issue", "issuing_state", "issuing_state_name", "first_name", "last_name", "full_name", "gender", "address", "formatted_address", "place_of_birth", "marital_status", "nationality", "extra_fields", "mrz", "parsed_address", "warnings", "barcodes"); + + private IdVerification(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IdVerification} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IdVerification fromJson(JsonNode json) { + return new IdVerification(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Approved when no warning resolves to a decline; Declined otherwise โ€” the warnings list explains why. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(IdVerificationVerifyResponse.IdVerification.Status::of)); + } + + /** + * Detected document type display name: Identity Card, Passport, Driver's License, Residence Permit, Health Insurance Card, or Tax Card. null when the document could not be classified. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * Finer-grained subtype when available (e.g. ID_CARD_GENERIC, EPASSPORT). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * Secondary personal/national number printed on some documents. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * Cropped portrait photo from the document. A short-lived media URL (https://<media-host>/ocr/...) when save_api_request=true (default); an inline base64-encoded JPEG string when save_api_request=false. null when no portrait was detected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImage() { + return Json.optional(json, "portrait_image", Conv.STRING); + } + + /** + * Aligned crop of the document front. Media URL when saved, inline base64 JPEG otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImage() { + return Json.optional(json, "front_image", Conv.STRING); + } + + /** + * Aligned crop of the document back. null when no back_image was uploaded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImage() { + return Json.optional(json, "back_image", Conv.STRING); + } + + /** + * Always null on this endpoint (populated only in camera-capture verification sessions). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageCameraFront() { + return Json.optional(json, "front_image_camera_front", Conv.STRING); + } + + /** + * Always null on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImageCameraFront() { + return Json.optional(json, "back_image_camera_front", Conv.STRING); + } + + /** + * Always null on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageCameraFrontFaceMatchScore() { + return Json.optional(json, "front_image_camera_front_face_match_score", Conv.DOUBLE); + } + + /** + * Always null on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImageCameraFrontFaceMatchScore() { + return Json.optional(json, "back_image_camera_front_face_match_score", Conv.DOUBLE); + } + + /** + * Capture-quality diagnostics for the uploaded image (null when the side was not provided or scoring failed). All scores are 0โ€“100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageQualityScore() { + return Json.optional(json, "front_image_quality_score", Conv.model(IdVerificationVerifyResponse.IdVerification.FrontImageQualityScore::fromJson)); + } + + /** + * Capture-quality diagnostics for the uploaded image (null when the side was not provided or scoring failed). All scores are 0โ€“100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImageQualityScore() { + return Json.optional(json, "back_image_quality_score", Conv.model(IdVerificationVerifyResponse.IdVerification.BackImageQualityScore::fromJson)); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Holder age in years, computed from date_of_birth. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional age() { + return Json.optional(json, "age", Conv.LONG); + } + + /** + * The expiration_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * The date_of_issue field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfIssue() { + return Json.optional(json, "date_of_issue", Conv.DATE); + } + + /** + * Issuing country (ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * The issuing_state_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingStateName() { + return Json.optional(json, "issuing_state_name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * M, F, or null when not printed/detected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * Address exactly as printed on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Geocoded, normalized version of address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + /** + * The place_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + /** + * UNKNOWN unless the document prints marital status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maritalStatus() { + return Json.optional(json, "marital_status", Conv.STRING); + } + + /** + * Holder nationality (ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Document-specific extras that have no dedicated column (e.g. first_surname/second_surname on Spanish IDs, license classes on driving licenses). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFields() { + return Json.optional(json, "extra_fields", Conv.OBJECT); + } + + /** + * Parsed machine-readable zone. An empty object ({}) when the document has no MRZ or it could not be read โ€” also check the warnings list in that case. Dates inside the MRZ use the raw YYMMDD format. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrz() { + return Json.optional(json, "mrz", Conv.model(IdVerificationVerifyResponse.IdVerification.Mrz::fromJson)); + } + + /** + * Structured, geocoded breakdown of address. null when the document carries no address or it could not be parsed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional parsedAddress() { + return Json.optional(json, "parsed_address", Conv.model(IdVerificationVerifyResponse.IdVerification.ParsedAddress::fromJson)); + } + + /** + * Empty on a clean approval. Every entry explains one detected risk; entries with log_type: "error" set status to Declined. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(IdVerificationVerifyResponse.IdVerification.Warnings::fromJson))); + } + + /** + * Barcodes decoded from the document (PDF417, QR, โ€ฆ). Empty when the document has none or none could be read. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> barcodes() { + return Json.optional(json, "barcodes", Conv.list(Conv.model(IdVerificationVerifyResponse.IdVerification.Barcodes::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IdVerification}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IdVerification from) { + super(from); + } + + /** + * Approved when no warning resolves to a decline; Declined otherwise โ€” the warnings list explains why. + * + * @param status the value + * @return this builder + */ + public Builder status(IdVerificationVerifyResponse.IdVerification.Status status) { + return set("status", Conv.enumeration(IdVerificationVerifyResponse.IdVerification.Status::of), status); + } + + /** + * Detected document type display name: Identity Card, Passport, Driver's License, Residence Permit, Health Insurance Card, or Tax Card. null when the document could not be classified. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(@Nullable String documentType) { + return setNullable("document_type", Conv.STRING, documentType); + } + + /** + * Finer-grained subtype when available (e.g. ID_CARD_GENERIC, EPASSPORT). + * + * @param documentSubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSubtype(@Nullable String documentSubtype) { + return setNullable("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Secondary personal/national number printed on some documents. + * + * @param personalNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder personalNumber(@Nullable String personalNumber) { + return setNullable("personal_number", Conv.STRING, personalNumber); + } + + /** + * Cropped portrait photo from the document. A short-lived media URL (https://<media-host>/ocr/...) when save_api_request=true (default); an inline base64-encoded JPEG string when save_api_request=false. null when no portrait was detected. + * + * @param portraitImage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder portraitImage(@Nullable String portraitImage) { + return setNullable("portrait_image", Conv.STRING, portraitImage); + } + + /** + * Aligned crop of the document front. Media URL when saved, inline base64 JPEG otherwise. + * + * @param frontImage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImage(@Nullable String frontImage) { + return setNullable("front_image", Conv.STRING, frontImage); + } + + /** + * Aligned crop of the document back. null when no back_image was uploaded. + * + * @param backImage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder backImage(@Nullable String backImage) { + return setNullable("back_image", Conv.STRING, backImage); + } + + /** + * Always null on this endpoint (populated only in camera-capture verification sessions). + * + * @param frontImageCameraFront the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImageCameraFront(@Nullable String frontImageCameraFront) { + return setNullable("front_image_camera_front", Conv.STRING, frontImageCameraFront); + } + + /** + * Always null on this endpoint. + * + * @param backImageCameraFront the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder backImageCameraFront(@Nullable String backImageCameraFront) { + return setNullable("back_image_camera_front", Conv.STRING, backImageCameraFront); + } + + /** + * Always null on this endpoint. + * + * @param frontImageCameraFrontFaceMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImageCameraFrontFaceMatchScore(@Nullable Double frontImageCameraFrontFaceMatchScore) { + return setNullable("front_image_camera_front_face_match_score", Conv.DOUBLE, frontImageCameraFrontFaceMatchScore); + } + + /** + * Always null on this endpoint. + * + * @param backImageCameraFrontFaceMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder backImageCameraFrontFaceMatchScore(@Nullable Double backImageCameraFrontFaceMatchScore) { + return setNullable("back_image_camera_front_face_match_score", Conv.DOUBLE, backImageCameraFrontFaceMatchScore); + } + + /** + * Capture-quality diagnostics for the uploaded image (null when the side was not provided or scoring failed). All scores are 0โ€“100. + * + * @param frontImageQualityScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImageQualityScore(IdVerificationVerifyResponse.IdVerification.@Nullable FrontImageQualityScore frontImageQualityScore) { + return setNullable("front_image_quality_score", Conv.model(IdVerificationVerifyResponse.IdVerification.FrontImageQualityScore::fromJson), frontImageQualityScore); + } + + /** + * Capture-quality diagnostics for the uploaded image (null when the side was not provided or scoring failed). All scores are 0โ€“100. + * + * @param backImageQualityScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder backImageQualityScore(IdVerificationVerifyResponse.IdVerification.@Nullable BackImageQualityScore backImageQualityScore) { + return setNullable("back_image_quality_score", Conv.model(IdVerificationVerifyResponse.IdVerification.BackImageQualityScore::fromJson), backImageQualityScore); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Holder age in years, computed from date_of_birth. + * + * @param age the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder age(@Nullable Long age) { + return setNullable("age", Conv.LONG, age); + } + + /** + * The expiration_date field. + * + * @param expirationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expirationDate(@Nullable LocalDate expirationDate) { + return setNullable("expiration_date", Conv.DATE, expirationDate); + } + + /** + * The date_of_issue field. + * + * @param dateOfIssue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfIssue(@Nullable LocalDate dateOfIssue) { + return setNullable("date_of_issue", Conv.DATE, dateOfIssue); + } + + /** + * Issuing country (ISO 3166-1 alpha-3). + * + * @param issuingState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingState(@Nullable String issuingState) { + return setNullable("issuing_state", Conv.STRING, issuingState); + } + + /** + * The issuing_state_name field. + * + * @param issuingStateName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingStateName(@Nullable String issuingStateName) { + return setNullable("issuing_state_name", Conv.STRING, issuingStateName); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * The full_name field. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * M, F, or null when not printed/detected. + * + * @param gender the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder gender(@Nullable String gender) { + return setNullable("gender", Conv.STRING, gender); + } + + /** + * Address exactly as printed on the document. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Geocoded, normalized version of address. + * + * @param formattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder formattedAddress(@Nullable String formattedAddress) { + return setNullable("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * The place_of_birth field. + * + * @param placeOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder placeOfBirth(@Nullable String placeOfBirth) { + return setNullable("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * UNKNOWN unless the document prints marital status. + * + * @param maritalStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maritalStatus(@Nullable String maritalStatus) { + return setNullable("marital_status", Conv.STRING, maritalStatus); + } + + /** + * Holder nationality (ISO 3166-1 alpha-3). + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * Document-specific extras that have no dedicated column (e.g. first_surname/second_surname on Spanish IDs, license classes on driving licenses). + * + * @param extraFields the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder extraFields(@Nullable Map extraFields) { + return setAny("extra_fields", extraFields); + } + + /** + * Parsed machine-readable zone. An empty object ({}) when the document has no MRZ or it could not be read โ€” also check the warnings list in that case. Dates inside the MRZ use the raw YYMMDD format. + * + * @param mrz the value + * @return this builder + */ + public Builder mrz(IdVerificationVerifyResponse.IdVerification.Mrz mrz) { + return set("mrz", Conv.model(IdVerificationVerifyResponse.IdVerification.Mrz::fromJson), mrz); + } + + /** + * Structured, geocoded breakdown of address. null when the document carries no address or it could not be parsed. + * + * @param parsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder parsedAddress(IdVerificationVerifyResponse.IdVerification.@Nullable ParsedAddress parsedAddress) { + return setNullable("parsed_address", Conv.model(IdVerificationVerifyResponse.IdVerification.ParsedAddress::fromJson), parsedAddress); + } + + /** + * Empty on a clean approval. Every entry explains one detected risk; entries with log_type: "error" set status to Declined. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(IdVerificationVerifyResponse.IdVerification.Warnings::fromJson)), warnings); + } + + /** + * Barcodes decoded from the document (PDF417, QR, โ€ฆ). Empty when the document has none or none could be read. + * + * @param barcodes the value + * @return this builder + */ + public Builder barcodes(List barcodes) { + return set("barcodes", Conv.list(Conv.model(IdVerificationVerifyResponse.IdVerification.Barcodes::fromJson)), barcodes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IdVerification} + */ + public IdVerification build() { + return new IdVerification(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved when no warning resolves to a decline; Declined otherwise โ€” the warnings list explains why. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Capture-quality diagnostics for the uploaded image (null when the side was not provided or scoring failed). All scores are 0โ€“100. + */ + public static final class FrontImageQualityScore extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("focus_score", "brightness_score", "brightness_issue", "is_document_fully_visible", "resolution_score", "overall_score"); + + private FrontImageQualityScore(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FrontImageQualityScore} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FrontImageQualityScore fromJson(JsonNode json) { + return new FrontImageQualityScore(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Sharpness of the document crop (higher is sharper). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional focusScore() { + return Json.optional(json, "focus_score", Conv.DOUBLE); + } + + /** + * Exposure quality (higher is better). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessScore() { + return Json.optional(json, "brightness_score", Conv.DOUBLE); + } + + /** + * ok when exposure is fine, otherwise the detected issue (e.g. too dark / too bright). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessIssue() { + return Json.optional(json, "brightness_issue", Conv.STRING); + } + + /** + * Whether all four corners of the document are inside the frame. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDocumentFullyVisible() { + return Json.optional(json, "is_document_fully_visible", Conv.BOOLEAN); + } + + /** + * Effective resolution of the document area. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolutionScore() { + return Json.optional(json, "resolution_score", Conv.DOUBLE); + } + + /** + * Aggregate quality score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overallScore() { + return Json.optional(json, "overall_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FrontImageQualityScore}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FrontImageQualityScore from) { + super(from); + } + + /** + * Sharpness of the document crop (higher is sharper). + * + * @param focusScore the value + * @return this builder + */ + public Builder focusScore(double focusScore) { + return set("focus_score", Conv.DOUBLE, focusScore); + } + + /** + * Exposure quality (higher is better). + * + * @param brightnessScore the value + * @return this builder + */ + public Builder brightnessScore(double brightnessScore) { + return set("brightness_score", Conv.DOUBLE, brightnessScore); + } + + /** + * ok when exposure is fine, otherwise the detected issue (e.g. too dark / too bright). + * + * @param brightnessIssue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder brightnessIssue(@Nullable String brightnessIssue) { + return setNullable("brightness_issue", Conv.STRING, brightnessIssue); + } + + /** + * Whether all four corners of the document are inside the frame. + * + * @param isDocumentFullyVisible the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDocumentFullyVisible(@Nullable Boolean isDocumentFullyVisible) { + return setNullable("is_document_fully_visible", Conv.BOOLEAN, isDocumentFullyVisible); + } + + /** + * Effective resolution of the document area. + * + * @param resolutionScore the value + * @return this builder + */ + public Builder resolutionScore(double resolutionScore) { + return set("resolution_score", Conv.DOUBLE, resolutionScore); + } + + /** + * Aggregate quality score. + * + * @param overallScore the value + * @return this builder + */ + public Builder overallScore(double overallScore) { + return set("overall_score", Conv.DOUBLE, overallScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FrontImageQualityScore} + */ + public FrontImageQualityScore build() { + return new FrontImageQualityScore(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Capture-quality diagnostics for the uploaded image (null when the side was not provided or scoring failed). All scores are 0โ€“100. + */ + public static final class BackImageQualityScore extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("focus_score", "brightness_score", "brightness_issue", "is_document_fully_visible", "resolution_score", "overall_score"); + + private BackImageQualityScore(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BackImageQualityScore} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BackImageQualityScore fromJson(JsonNode json) { + return new BackImageQualityScore(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Sharpness of the document crop (higher is sharper). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional focusScore() { + return Json.optional(json, "focus_score", Conv.DOUBLE); + } + + /** + * Exposure quality (higher is better). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessScore() { + return Json.optional(json, "brightness_score", Conv.DOUBLE); + } + + /** + * ok when exposure is fine, otherwise the detected issue (e.g. too dark / too bright). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessIssue() { + return Json.optional(json, "brightness_issue", Conv.STRING); + } + + /** + * Whether all four corners of the document are inside the frame. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDocumentFullyVisible() { + return Json.optional(json, "is_document_fully_visible", Conv.BOOLEAN); + } + + /** + * Effective resolution of the document area. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolutionScore() { + return Json.optional(json, "resolution_score", Conv.DOUBLE); + } + + /** + * Aggregate quality score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overallScore() { + return Json.optional(json, "overall_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BackImageQualityScore}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BackImageQualityScore from) { + super(from); + } + + /** + * Sharpness of the document crop (higher is sharper). + * + * @param focusScore the value + * @return this builder + */ + public Builder focusScore(double focusScore) { + return set("focus_score", Conv.DOUBLE, focusScore); + } + + /** + * Exposure quality (higher is better). + * + * @param brightnessScore the value + * @return this builder + */ + public Builder brightnessScore(double brightnessScore) { + return set("brightness_score", Conv.DOUBLE, brightnessScore); + } + + /** + * ok when exposure is fine, otherwise the detected issue (e.g. too dark / too bright). + * + * @param brightnessIssue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder brightnessIssue(@Nullable String brightnessIssue) { + return setNullable("brightness_issue", Conv.STRING, brightnessIssue); + } + + /** + * Whether all four corners of the document are inside the frame. + * + * @param isDocumentFullyVisible the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDocumentFullyVisible(@Nullable Boolean isDocumentFullyVisible) { + return setNullable("is_document_fully_visible", Conv.BOOLEAN, isDocumentFullyVisible); + } + + /** + * Effective resolution of the document area. + * + * @param resolutionScore the value + * @return this builder + */ + public Builder resolutionScore(double resolutionScore) { + return set("resolution_score", Conv.DOUBLE, resolutionScore); + } + + /** + * Aggregate quality score. + * + * @param overallScore the value + * @return this builder + */ + public Builder overallScore(double overallScore) { + return set("overall_score", Conv.DOUBLE, overallScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BackImageQualityScore} + */ + public BackImageQualityScore build() { + return new BackImageQualityScore(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Parsed machine-readable zone. An empty object ({}) when the document has no MRZ or it could not be read โ€” also check the warnings list in that case. Dates inside the MRZ use the raw YYMMDD format. + */ + public static final class Mrz extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("surname", "name", "country", "nationality", "birth_date", "expiry_date", "sex", "document_type", "document_number", "optional_data", "optional_data_2", "birth_date_hash", "expiry_date_hash", "document_number_hash", "final_hash", "personal_number", "warnings", "errors", "mrz_type", "mrz_string", "mrz_key"); + + private Mrz(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Mrz} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Mrz fromJson(JsonNode json) { + return new Mrz(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The surname field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional surname() { + return Json.optional(json, "surname", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Issuing country (ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Holder nationality (ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Raw MRZ date of birth (YYMMDD). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthDate() { + return Json.optional(json, "birth_date", Conv.STRING); + } + + /** + * Raw MRZ expiry date (YYMMDD). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiryDate() { + return Json.optional(json, "expiry_date", Conv.STRING); + } + + /** + * The sex field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sex() { + return Json.optional(json, "sex", Conv.STRING); + } + + /** + * MRZ document-type code (e.g. ID, P). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * The optional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional optionalData() { + return Json.optional(json, "optional_data", Conv.STRING); + } + + /** + * The optional_data_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional optionalData2() { + return Json.optional(json, "optional_data_2", Conv.STRING); + } + + /** + * MRZ check digit for the birth date. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthDateHash() { + return Json.optional(json, "birth_date_hash", Conv.STRING); + } + + /** + * MRZ check digit for the expiry date. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiryDateHash() { + return Json.optional(json, "expiry_date_hash", Conv.STRING); + } + + /** + * MRZ check digit for the document number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumberHash() { + return Json.optional(json, "document_number_hash", Conv.STRING); + } + + /** + * Composite MRZ check digit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional finalHash() { + return Json.optional(json, "final_hash", Conv.STRING); + } + + /** + * The personal_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * Non-fatal MRZ parsing warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.STRING)); + } + + /** + * MRZ check-digit/parsing errors. Non-empty errors surface as an MRZ_VALIDATION_FAILED warning. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> errors() { + return Json.optional(json, "errors", Conv.list(Conv.STRING)); + } + + /** + * MRZ layout: TD1 (ID cards, 3 lines), TD2, or TD3 (passports, 2 lines). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrzType() { + return Json.optional(json, "mrz_type", Conv.STRING); + } + + /** + * Raw MRZ text as read, lines separated by \n. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrzString() { + return Json.optional(json, "mrz_string", Conv.STRING); + } + + /** + * Composite key (document number + check digits) used for cross-checks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrzKey() { + return Json.optional(json, "mrz_key", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Mrz}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Mrz from) { + super(from); + } + + /** + * The surname field. + * + * @param surname the value + * @return this builder + */ + public Builder surname(String surname) { + return set("surname", Conv.STRING, surname); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Issuing country (ISO 3166-1 alpha-3). + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Holder nationality (ISO 3166-1 alpha-3). + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * Raw MRZ date of birth (YYMMDD). + * + * @param birthDate the value + * @return this builder + */ + public Builder birthDate(String birthDate) { + return set("birth_date", Conv.STRING, birthDate); + } + + /** + * Raw MRZ expiry date (YYMMDD). + * + * @param expiryDate the value + * @return this builder + */ + public Builder expiryDate(String expiryDate) { + return set("expiry_date", Conv.STRING, expiryDate); + } + + /** + * The sex field. + * + * @param sex the value + * @return this builder + */ + public Builder sex(String sex) { + return set("sex", Conv.STRING, sex); + } + + /** + * MRZ document-type code (e.g. ID, P). + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * The document_number field. + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * The optional_data field. + * + * @param optionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder optionalData(@Nullable String optionalData) { + return setNullable("optional_data", Conv.STRING, optionalData); + } + + /** + * The optional_data_2 field. + * + * @param optionalData2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder optionalData2(@Nullable String optionalData2) { + return setNullable("optional_data_2", Conv.STRING, optionalData2); + } + + /** + * MRZ check digit for the birth date. + * + * @param birthDateHash the value + * @return this builder + */ + public Builder birthDateHash(String birthDateHash) { + return set("birth_date_hash", Conv.STRING, birthDateHash); + } + + /** + * MRZ check digit for the expiry date. + * + * @param expiryDateHash the value + * @return this builder + */ + public Builder expiryDateHash(String expiryDateHash) { + return set("expiry_date_hash", Conv.STRING, expiryDateHash); + } + + /** + * MRZ check digit for the document number. + * + * @param documentNumberHash the value + * @return this builder + */ + public Builder documentNumberHash(String documentNumberHash) { + return set("document_number_hash", Conv.STRING, documentNumberHash); + } + + /** + * Composite MRZ check digit. + * + * @param finalHash the value + * @return this builder + */ + public Builder finalHash(String finalHash) { + return set("final_hash", Conv.STRING, finalHash); + } + + /** + * The personal_number field. + * + * @param personalNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder personalNumber(@Nullable String personalNumber) { + return setNullable("personal_number", Conv.STRING, personalNumber); + } + + /** + * Non-fatal MRZ parsing warnings. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.STRING), warnings); + } + + /** + * MRZ check-digit/parsing errors. Non-empty errors surface as an MRZ_VALIDATION_FAILED warning. + * + * @param errors the value + * @return this builder + */ + public Builder errors(List errors) { + return set("errors", Conv.list(Conv.STRING), errors); + } + + /** + * MRZ layout: TD1 (ID cards, 3 lines), TD2, or TD3 (passports, 2 lines). + * + * @param mrzType the value + * @return this builder + */ + public Builder mrzType(String mrzType) { + return set("mrz_type", Conv.STRING, mrzType); + } + + /** + * Raw MRZ text as read, lines separated by \n. + * + * @param mrzString the value + * @return this builder + */ + public Builder mrzString(String mrzString) { + return set("mrz_string", Conv.STRING, mrzString); + } + + /** + * Composite key (document number + check digits) used for cross-checks. + * + * @param mrzKey the value + * @return this builder + */ + public Builder mrzKey(String mrzKey) { + return set("mrz_key", Conv.STRING, mrzKey); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Mrz} + */ + public Mrz build() { + return new Mrz(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Structured, geocoded breakdown of address. null when the document carries no address or it could not be parsed. + */ + public static final class ParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("street_1", "street_2", "city", "region", "country", "postal_code", "address_type", "formatted_address", "raw_results", "document_location", "label", "is_verified", "category"); + + private ParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ParsedAddress fromJson(JsonNode json) { + return new ParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * The region field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * The address_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * Canonical geocoded address string. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + /** + * Raw geocoding payload (address_components, geometry.location, place_id, โ€ฆ) for advanced consumers. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> rawResults() { + return Json.optional(json, "raw_results", Conv.OBJECT); + } + + /** + * Geocoded coordinates of the document address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLocation() { + return Json.optional(json, "document_location", Conv.model(IdVerificationVerifyResponse.IdVerification.ParsedAddress.DocumentLocation::fromJson)); + } + + /** + * Which document field the address was read from. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * Whether geocoding confirmed the address exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVerified() { + return Json.optional(json, "is_verified", Conv.BOOLEAN); + } + + /** + * Address category (e.g. Residential, Commercial). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ParsedAddress from) { + super(from); + } + + /** + * The street_1 field. + * + * @param street1 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street1(@Nullable String street1) { + return setNullable("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * The region field. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * The postal_code field. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * The address_type field. + * + * @param addressType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addressType(@Nullable String addressType) { + return setNullable("address_type", Conv.STRING, addressType); + } + + /** + * Canonical geocoded address string. + * + * @param formattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder formattedAddress(@Nullable String formattedAddress) { + return setNullable("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * Raw geocoding payload (address_components, geometry.location, place_id, โ€ฆ) for advanced consumers. + * + * @param rawResults the value + * @return this builder + */ + public Builder rawResults(Map rawResults) { + return setAny("raw_results", rawResults); + } + + /** + * Geocoded coordinates of the document address. + * + * @param documentLocation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentLocation(IdVerificationVerifyResponse.IdVerification.ParsedAddress.@Nullable DocumentLocation documentLocation) { + return setNullable("document_location", Conv.model(IdVerificationVerifyResponse.IdVerification.ParsedAddress.DocumentLocation::fromJson), documentLocation); + } + + /** + * Which document field the address was read from. + * + * @param label the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder label(@Nullable String label) { + return setNullable("label", Conv.STRING, label); + } + + /** + * Whether geocoding confirmed the address exists. + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * Address category (e.g. Residential, Commercial). + * + * @param category the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder category(@Nullable String category) { + return setNullable("category", Conv.STRING, category); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ParsedAddress} + */ + public ParsedAddress build() { + return new ParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Geocoded coordinates of the document address. */ + public static final class DocumentLocation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private DocumentLocation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentLocation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentLocation fromJson(JsonNode json) { + return new DocumentLocation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentLocation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentLocation from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentLocation} + */ + public DocumentLocation build() { + return new DocumentLocation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. Always-decline risks: DOCUMENT_EXPIRED, MINIMUM_AGE_NOT_MET, PORTRAIT_IMAGE_NOT_DETECTED, SCREEN_CAPTURE_DETECTED, PRINTED_COPY_DETECTED, PORTRAIT_MANIPULATION_DETECTED, PUBLIC_DOCUMENT_IMAGE_DETECTED, INVALID_DATE, COULD_NOT_RECOGNIZE_DOCUMENT (400-only, never a warning), DOCUMENT_NUMBER_NOT_DETECTED, COULD_NOT_DETECT_DOCUMENT_TYPE, NAME_NOT_DETECTED, DATE_OF_BIRTH_NOT_DETECTED. Governed by request options: MRZ_NOT_DETECTED / MRZ_VALIDATION_FAILED (invalid_mrz_action), DATA_INCONSISTENT / MRZ_AND_DATA_EXTRACTED_FROM_OCR_NOT_SAME / DOCUMENT_NAME_DIFFERENT_FROM_OTHER_APPROVED_DOCUMENTS (inconsistent_data_action), EXPIRATION_DATE_NOT_DETECTED (expiration_date_not_detected_action). Other risks (e.g. POSSIBLE_DUPLICATED_USER) are informational. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Feature that raised the warning. Always ID_VERIFICATION on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(IdVerificationVerifyResponse.IdVerification.Warnings.Feature::of)); + } + + /** + * Extra context for some risks (e.g. POSSIBLE_DUPLICATED_USER includes duplicated_session_id); null for most. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error warnings drive status to Declined; information entries are advisory and never decline on their own. (warning is not produced by this endpoint โ€” its options only accept DECLINE or NO_ACTION.) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(IdVerificationVerifyResponse.IdVerification.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. Always-decline risks: DOCUMENT_EXPIRED, MINIMUM_AGE_NOT_MET, PORTRAIT_IMAGE_NOT_DETECTED, SCREEN_CAPTURE_DETECTED, PRINTED_COPY_DETECTED, PORTRAIT_MANIPULATION_DETECTED, PUBLIC_DOCUMENT_IMAGE_DETECTED, INVALID_DATE, COULD_NOT_RECOGNIZE_DOCUMENT (400-only, never a warning), DOCUMENT_NUMBER_NOT_DETECTED, COULD_NOT_DETECT_DOCUMENT_TYPE, NAME_NOT_DETECTED, DATE_OF_BIRTH_NOT_DETECTED. Governed by request options: MRZ_NOT_DETECTED / MRZ_VALIDATION_FAILED (invalid_mrz_action), DATA_INCONSISTENT / MRZ_AND_DATA_EXTRACTED_FROM_OCR_NOT_SAME / DOCUMENT_NAME_DIFFERENT_FROM_OTHER_APPROVED_DOCUMENTS (inconsistent_data_action), EXPIRATION_DATE_NOT_DETECTED (expiration_date_not_detected_action). Other risks (e.g. POSSIBLE_DUPLICATED_USER) are informational. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Feature that raised the warning. Always ID_VERIFICATION on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(IdVerificationVerifyResponse.IdVerification.Warnings.Feature feature) { + return set("feature", Conv.enumeration(IdVerificationVerifyResponse.IdVerification.Warnings.Feature::of), feature); + } + + /** + * Extra context for some risks (e.g. POSSIBLE_DUPLICATED_USER includes duplicated_session_id); null for most. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error warnings drive status to Declined; information entries are advisory and never decline on their own. (warning is not produced by this endpoint โ€” its options only accept DECLINE or NO_ACTION.) + * + * @param logType the value + * @return this builder + */ + public Builder logType(IdVerificationVerifyResponse.IdVerification.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(IdVerificationVerifyResponse.IdVerification.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature that raised the warning. Always ID_VERIFICATION on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity. error warnings drive status to Declined; information entries are advisory and never decline on their own. (warning is not produced by this endpoint โ€” its options only accept DECLINE or NO_ACTION.) + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Barcodes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "position", "data", "data_raw", "side"); + + private Barcodes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Barcodes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Barcodes fromJson(JsonNode json) { + return new Barcodes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Barcode type (e.g. PDF417, QR_CODE, UNKNOWN). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * Location of the barcode in the image, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> position() { + return Json.optional(json, "position", Conv.OBJECT); + } + + /** + * Decoded payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional data() { + return Json.optional(json, "data", Conv.STRING); + } + + /** + * Raw (undecoded) payload, when different. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataRaw() { + return Json.optional(json, "data_raw", Conv.STRING); + } + + /** + * front or back. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional side() { + return Json.optional(json, "side", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Barcodes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Barcodes from) { + super(from); + } + + /** + * Barcode type (e.g. PDF417, QR_CODE, UNKNOWN). + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * Location of the barcode in the image, when available. + * + * @param position the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder position(@Nullable Map position) { + return setAny("position", position); + } + + /** + * Decoded payload. + * + * @param data the value + * @return this builder + */ + public Builder data(String data) { + return set("data", Conv.STRING, data); + } + + /** + * Raw (undecoded) payload, when different. + * + * @param dataRaw the value + * @return this builder + */ + public Builder dataRaw(String dataRaw) { + return set("data_raw", Conv.STRING, dataRaw); + } + + /** + * front or back. + * + * @param side the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder side(@Nullable String side) { + return setNullable("side", Conv.STRING, side); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Barcodes} + */ + public Barcodes build() { + return new Barcodes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/KYBRegistryAddress.java b/src/main/java/me/didit/types/KYBRegistryAddress.java new file mode 100644 index 0000000..cd6a0b1 --- /dev/null +++ b/src/main/java/me/didit/types/KYBRegistryAddress.java @@ -0,0 +1,251 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * An address the registry states, in the same shape for every country and registry source. Every key is always present; a part the registry does not publish is null. + */ +public final class KYBRegistryAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "address", "street", "city", "postal_code", "region", "country_code", "description"); + + private KYBRegistryAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KYBRegistryAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KYBRegistryAddress fromJson(JsonNode json) { + return new KYBRegistryAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Address type in lower case: registered for the registered office; other types as the registry names them (for example postal, office). null when the registry does not say what the address is. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * The full address as one line. Always present on every address. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String address() { + return Json.required(json, "address", Conv.STRING); + } + + /** + * Street and number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street() { + return Json.optional(json, "street", Conv.STRING); + } + + /** + * City or locality. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * Postal code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * Region, state or province. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * The registry's own label for the address, when it gives one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KYBRegistryAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KYBRegistryAddress from) { + super(from); + } + + /** + * Address type in lower case: registered for the registered office; other types as the registry names them (for example postal, office). null when the registry does not say what the address is. + * + * @param type the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder type(@Nullable String type) { + return setNullable("type", Conv.STRING, type); + } + + /** + * The full address as one line. Always present on every address. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * Street and number. + * + * @param street the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street(@Nullable String street) { + return setNullable("street", Conv.STRING, street); + } + + /** + * City or locality. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * Postal code. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * Region, state or province. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * The registry's own label for the address, when it gives one. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KYBRegistryAddress} + * @throws IllegalStateException when a required field is missing + */ + public KYBRegistryAddress build() { + require("type", true); + require("address", false); + require("street", true); + require("city", true); + require("postal_code", true); + require("region", true); + require("country_code", true); + require("description", true); + return new KYBRegistryAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/KYBRegistryIndustry.java b/src/main/java/me/didit/types/KYBRegistryIndustry.java new file mode 100644 index 0000000..4895c78 --- /dev/null +++ b/src/main/java/me/didit/types/KYBRegistryIndustry.java @@ -0,0 +1,167 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * An activity the registry classifies the company under, in the same shape for every country and registry source. + */ +public final class KYBRegistryIndustry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("code", "description", "scheme", "is_primary"); + + private KYBRegistryIndustry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KYBRegistryIndustry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KYBRegistryIndustry fromJson(JsonNode json) { + return new KYBRegistryIndustry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Activity code as the registry prints it (for example 73110). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional code() { + return Json.optional(json, "code", Conv.STRING); + } + + /** + * Activity label, when the registry publishes one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Classification system, one name per system whichever source reported it: UK SIC 2007, US SIC, NACE Rev. 2, NACE Rev. 2.1, NAF Rev. 2, CNAE, SBI, NOGA 2008, CAE Rev. 4, Canada SIC 1977; other national systems keep the registry's own name. Null when the registry does not name the system. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scheme() { + return Json.optional(json, "scheme", Conv.STRING); + } + + /** + * True for the company's main activity. Exactly one entry is primary when the list is not empty. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isPrimary() { + return Json.required(json, "is_primary", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KYBRegistryIndustry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KYBRegistryIndustry from) { + super(from); + } + + /** + * Activity code as the registry prints it (for example 73110). + * + * @param code the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder code(@Nullable String code) { + return setNullable("code", Conv.STRING, code); + } + + /** + * Activity label, when the registry publishes one. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Classification system, one name per system whichever source reported it: UK SIC 2007, US SIC, NACE Rev. 2, NACE Rev. 2.1, NAF Rev. 2, CNAE, SBI, NOGA 2008, CAE Rev. 4, Canada SIC 1977; other national systems keep the registry's own name. Null when the registry does not name the system. + * + * @param scheme the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder scheme(@Nullable String scheme) { + return setNullable("scheme", Conv.STRING, scheme); + } + + /** + * True for the company's main activity. Exactly one entry is primary when the list is not empty. + * + * @param isPrimary the value + * @return this builder + */ + public Builder isPrimary(boolean isPrimary) { + return set("is_primary", Conv.BOOLEAN, isPrimary); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KYBRegistryIndustry} + * @throws IllegalStateException when a required field is missing + */ + public KYBRegistryIndustry build() { + require("code", true); + require("description", true); + require("scheme", true); + require("is_primary", false); + return new KYBRegistryIndustry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/KYBRegistryOwnership.java b/src/main/java/me/didit/types/KYBRegistryOwnership.java new file mode 100644 index 0000000..63d9a45 --- /dev/null +++ b/src/main/java/me/didit/types/KYBRegistryOwnership.java @@ -0,0 +1,520 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + */ +public final class KYBRegistryOwnership extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "tier_requested", "tier_delivered", "unavailable_reason", "direct_ownership_complete", "unresolved"); + + private KYBRegistryOwnership(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KYBRegistryOwnership} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KYBRegistryOwnership fromJson(JsonNode json) { + return new KYBRegistryOwnership(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * delivered when the registry published ownership; unavailable when it did not (see unavailable_reason); pending while the registry is still fetching it; not_requested for the Basic tier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(KYBRegistryOwnership.Status::of)); + } + + /** + * The tier the workflow ordered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tierRequested() { + return Json.optional(json, "tier_requested", Conv.enumeration(KYBRegistryOwnership.TierRequested::of)); + } + + /** + * The tier the registry delivered (and that is billed). A UBO request answered with direct shareholders only is shareholders. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tierDelivered() { + return Json.optional(json, "tier_delivered", Conv.enumeration(KYBRegistryOwnership.TierDelivered::of)); + } + + /** + * Why a requested ownership tier was not delivered. Null unless status is unavailable or pending. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional unavailableReason() { + return Json.optional(json, "unavailable_reason", Conv.enumeration(KYBRegistryOwnership.UnavailableReason::of)); + } + + /** + * True when the direct shareholders' stated stakes add up to 100% (within one percentage point of rounding); false when they do not; null when ownership was not delivered or a stake is not stated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional directOwnershipComplete() { + return Json.optional(json, "direct_ownership_complete", Conv.BOOLEAN); + } + + /** + * Parts of the ownership chain the registry could not resolve, for example no group structure on record above the direct owners. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unresolved() { + return Json.required(json, "unresolved", Conv.list(Conv.model(KYBRegistryOwnership.Unresolved::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KYBRegistryOwnership}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KYBRegistryOwnership from) { + super(from); + } + + /** + * delivered when the registry published ownership; unavailable when it did not (see unavailable_reason); pending while the registry is still fetching it; not_requested for the Basic tier. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(KYBRegistryOwnership.@Nullable Status status) { + return setNullable("status", Conv.enumeration(KYBRegistryOwnership.Status::of), status); + } + + /** + * The tier the workflow ordered. + * + * @param tierRequested the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder tierRequested(KYBRegistryOwnership.@Nullable TierRequested tierRequested) { + return setNullable("tier_requested", Conv.enumeration(KYBRegistryOwnership.TierRequested::of), tierRequested); + } + + /** + * The tier the registry delivered (and that is billed). A UBO request answered with direct shareholders only is shareholders. + * + * @param tierDelivered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder tierDelivered(KYBRegistryOwnership.@Nullable TierDelivered tierDelivered) { + return setNullable("tier_delivered", Conv.enumeration(KYBRegistryOwnership.TierDelivered::of), tierDelivered); + } + + /** + * Why a requested ownership tier was not delivered. Null unless status is unavailable or pending. + * + * @param unavailableReason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder unavailableReason(KYBRegistryOwnership.@Nullable UnavailableReason unavailableReason) { + return setNullable("unavailable_reason", Conv.enumeration(KYBRegistryOwnership.UnavailableReason::of), unavailableReason); + } + + /** + * True when the direct shareholders' stated stakes add up to 100% (within one percentage point of rounding); false when they do not; null when ownership was not delivered or a stake is not stated. + * + * @param directOwnershipComplete the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder directOwnershipComplete(@Nullable Boolean directOwnershipComplete) { + return setNullable("direct_ownership_complete", Conv.BOOLEAN, directOwnershipComplete); + } + + /** + * Parts of the ownership chain the registry could not resolve, for example no group structure on record above the direct owners. + * + * @param unresolved the value + * @return this builder + */ + public Builder unresolved(List unresolved) { + return set("unresolved", Conv.list(Conv.model(KYBRegistryOwnership.Unresolved::fromJson)), unresolved); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KYBRegistryOwnership} + * @throws IllegalStateException when a required field is missing + */ + public KYBRegistryOwnership build() { + require("status", true); + require("tier_requested", true); + require("tier_delivered", true); + require("unavailable_reason", true); + require("direct_ownership_complete", true); + require("unresolved", false); + return new KYBRegistryOwnership(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * delivered when the registry published ownership; unavailable when it did not (see unavailable_reason); pending while the registry is still fetching it; not_requested for the Basic tier. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "not_requested"}. */ + public static final Status NOT_REQUESTED = new Status("not_requested"); + + /** The value {@code "pending"}. */ + public static final Status PENDING = new Status("pending"); + + /** The value {@code "delivered"}. */ + public static final Status DELIVERED = new Status("delivered"); + + /** The value {@code "unavailable"}. */ + public static final Status UNAVAILABLE = new Status("unavailable"); + + private static final List KNOWN_VALUES = List.of(NOT_REQUESTED, PENDING, DELIVERED, UNAVAILABLE); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The tier the workflow ordered. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TierRequested extends StringEnum { + /** The value {@code "basic"}. */ + public static final TierRequested BASIC = new TierRequested("basic"); + + /** The value {@code "shareholders"}. */ + public static final TierRequested SHAREHOLDERS = new TierRequested("shareholders"); + + /** The value {@code "ubo"}. */ + public static final TierRequested UBO = new TierRequested("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private TierRequested(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TierRequested of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TierRequested::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The tier the registry delivered (and that is billed). A UBO request answered with direct shareholders only is shareholders. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final TierDelivered BASIC = new TierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final TierDelivered SHAREHOLDERS = new TierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final TierDelivered UBO = new TierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private TierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Why a requested ownership tier was not delivered. Null unless status is unavailable or pending. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class UnavailableReason extends StringEnum { + /** The value {@code "no_owners_on_record"}. */ + public static final UnavailableReason NO_OWNERS_ON_RECORD = new UnavailableReason("no_owners_on_record"); + + /** The value {@code "no_natural_person_owner"}. */ + public static final UnavailableReason NO_NATURAL_PERSON_OWNER = new UnavailableReason("no_natural_person_owner"); + + /** The value {@code "ownership_section_unavailable"}. */ + public static final UnavailableReason OWNERSHIP_SECTION_UNAVAILABLE = new UnavailableReason("ownership_section_unavailable"); + + /** The value {@code "company_not_found"}. */ + public static final UnavailableReason COMPANY_NOT_FOUND = new UnavailableReason("company_not_found"); + + /** The value {@code "ambiguous_company_match"}. */ + public static final UnavailableReason AMBIGUOUS_COMPANY_MATCH = new UnavailableReason("ambiguous_company_match"); + + /** The value {@code "missing_registration_number"}. */ + public static final UnavailableReason MISSING_REGISTRATION_NUMBER = new UnavailableReason("missing_registration_number"); + + /** The value {@code "entity_type_not_covered"}. */ + public static final UnavailableReason ENTITY_TYPE_NOT_COVERED = new UnavailableReason("entity_type_not_covered"); + + /** The value {@code "provider_unavailable"}. */ + public static final UnavailableReason PROVIDER_UNAVAILABLE = new UnavailableReason("provider_unavailable"); + + /** The value {@code "other"}. */ + public static final UnavailableReason OTHER = new UnavailableReason("other"); + + private static final List KNOWN_VALUES = List.of(NO_OWNERS_ON_RECORD, NO_NATURAL_PERSON_OWNER, OWNERSHIP_SECTION_UNAVAILABLE, COMPANY_NOT_FOUND, AMBIGUOUS_COMPANY_MATCH, MISSING_REGISTRATION_NUMBER, ENTITY_TYPE_NOT_COVERED, PROVIDER_UNAVAILABLE, OTHER); + + private UnavailableReason(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static UnavailableReason of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, UnavailableReason::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Unresolved extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("reason", "section"); + + private Unresolved(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Unresolved} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Unresolved fromJson(JsonNode json) { + return new Unresolved(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The section field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional section() { + return Json.optional(json, "section", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Unresolved}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Unresolved from) { + super(from); + } + + /** + * The reason field. + * + * @param reason the value + * @return this builder + */ + public Builder reason(String reason) { + return set("reason", Conv.STRING, reason); + } + + /** + * The section field. + * + * @param section the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder section(@Nullable String section) { + return setNullable("section", Conv.STRING, section); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Unresolved} + */ + public Unresolved build() { + return new Unresolved(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/KYBRegistryShareholding.java b/src/main/java/me/didit/types/KYBRegistryShareholding.java new file mode 100644 index 0000000..00a86f7 --- /dev/null +++ b/src/main/java/me/didit/types/KYBRegistryShareholding.java @@ -0,0 +1,209 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + */ +public final class KYBRegistryShareholding extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("share_class", "number_of_shares", "currency", "nominal_value", "total_value", "percentage"); + + private KYBRegistryShareholding(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KYBRegistryShareholding} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KYBRegistryShareholding fromJson(JsonNode json) { + return new KYBRegistryShareholding(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Share class or type as the registry names it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shareClass() { + return Json.optional(json, "share_class", Conv.STRING); + } + + /** + * Number of shares held. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional numberOfShares() { + return Json.optional(json, "number_of_shares", Conv.DOUBLE); + } + + /** + * ISO 4217 currency of the values below. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currency() { + return Json.optional(json, "currency", Conv.STRING); + } + + /** + * Nominal value per share. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nominalValue() { + return Json.optional(json, "nominal_value", Conv.DOUBLE); + } + + /** + * Total value of the holding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalValue() { + return Json.optional(json, "total_value", Conv.DOUBLE); + } + + /** + * Exact stake in percent, to four decimal places. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional percentage() { + return Json.optional(json, "percentage", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KYBRegistryShareholding}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KYBRegistryShareholding from) { + super(from); + } + + /** + * Share class or type as the registry names it. + * + * @param shareClass the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder shareClass(@Nullable String shareClass) { + return setNullable("share_class", Conv.STRING, shareClass); + } + + /** + * Number of shares held. + * + * @param numberOfShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder numberOfShares(@Nullable Double numberOfShares) { + return setNullable("number_of_shares", Conv.DOUBLE, numberOfShares); + } + + /** + * ISO 4217 currency of the values below. + * + * @param currency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currency(@Nullable String currency) { + return setNullable("currency", Conv.STRING, currency); + } + + /** + * Nominal value per share. + * + * @param nominalValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nominalValue(@Nullable Double nominalValue) { + return setNullable("nominal_value", Conv.DOUBLE, nominalValue); + } + + /** + * Total value of the holding. + * + * @param totalValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder totalValue(@Nullable Double totalValue) { + return setNullable("total_value", Conv.DOUBLE, totalValue); + } + + /** + * Exact stake in percent, to four decimal places. + * + * @param percentage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder percentage(@Nullable Double percentage) { + return setNullable("percentage", Conv.DOUBLE, percentage); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KYBRegistryShareholding} + * @throws IllegalStateException when a required field is missing + */ + public KYBRegistryShareholding build() { + require("share_class", true); + require("number_of_shares", true); + require("currency", true); + require("nominal_value", true); + require("total_value", true); + require("percentage", true); + return new KYBRegistryShareholding(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/KybListShareholdersParams.java b/src/main/java/me/didit/types/KybListShareholdersParams.java new file mode 100644 index 0000000..070f33e --- /dev/null +++ b/src/main/java/me/didit/types/KybListShareholdersParams.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code kyb.list_shareholders}. */ +public final class KybListShareholdersParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("kyb_response_id", "vendor_data", "metadata", "save_api_request"); + + private KybListShareholdersParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybListShareholdersParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybListShareholdersParams fromJson(JsonNode json) { + return new KybListShareholdersParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Candidate handle from POST /v3/kyb/search/ (kyb_registry.companies[].kyb_response_id). Ephemeral โ€” use it shortly after the search that produced it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String kybResponseId() { + return Json.required(json, "kyb_response_id", Conv.STRING); + } + + /** + * Your identifier for this company; echoed back and stored with the business session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Free-form JSON stored with the business session and echoed back. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Must be true (the default). KYB registry selects are always persisted so billing and retrieval can be tracked; false returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybListShareholdersParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybListShareholdersParams from) { + super(from); + } + + /** + * Candidate handle from POST /v3/kyb/search/ (kyb_registry.companies[].kyb_response_id). Ephemeral โ€” use it shortly after the search that produced it. + * + * @param kybResponseId the value + * @return this builder + */ + public Builder kybResponseId(String kybResponseId) { + return set("kyb_response_id", Conv.STRING, kybResponseId); + } + + /** + * Your identifier for this company; echoed back and stored with the business session. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Free-form JSON stored with the business session and echoed back. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Must be true (the default). KYB registry selects are always persisted so billing and retrieval can be tracked; false returns 400. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybListShareholdersParams} + * @throws IllegalStateException when a required field is missing + */ + public KybListShareholdersParams build() { + require("kyb_response_id", false); + return new KybListShareholdersParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/KybListShareholdersResponse.java b/src/main/java/me/didit/types/KybListShareholdersResponse.java new file mode 100644 index 0000000..a0494f0 --- /dev/null +++ b/src/main/java/me/didit/types/KybListShareholdersResponse.java @@ -0,0 +1,2871 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class KybListShareholdersResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "registry_tier_requested", "registry_tier_delivered", "kyb_registry", "vendor_data", "metadata", "created_at"); + + private KybListShareholdersResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybListShareholdersResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybListShareholdersResponse fromJson(JsonNode json) { + return new KybListShareholdersResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the business session created for this retrieval. The stored record (visible in the console) keeps updating if the registry resolves after the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierRequested() { + return Json.optional(json, "registry_tier_requested", Conv.enumeration(KybListShareholdersResponse.RegistryTierRequested::of)); + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, or the registry has no ownership record for this company. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.enumeration(KybListShareholdersResponse.RegistryTierDelivered::of)); + } + + /** + * Full registry company profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybRegistry() { + return Json.optional(json, "kyb_registry", Conv.model(KybListShareholdersResponse.KybRegistry::fromJson)); + } + + /** + * Echo of the vendor_data you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybListShareholdersResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybListShareholdersResponse from) { + super(from); + } + + /** + * Id of the business session created for this retrieval. The stored record (visible in the console) keeps updating if the registry resolves after the response. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + * @param registryTierRequested the value + * @return this builder + */ + public Builder registryTierRequested(KybListShareholdersResponse.RegistryTierRequested registryTierRequested) { + return set("registry_tier_requested", Conv.enumeration(KybListShareholdersResponse.RegistryTierRequested::of), registryTierRequested); + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, or the registry has no ownership record for this company. + * + * @param registryTierDelivered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTierDelivered(KybListShareholdersResponse.@Nullable RegistryTierDelivered registryTierDelivered) { + return setNullable("registry_tier_delivered", Conv.enumeration(KybListShareholdersResponse.RegistryTierDelivered::of), registryTierDelivered); + } + + /** + * Full registry company profile. + * + * @param kybRegistry the value + * @return this builder + */ + public Builder kybRegistry(KybListShareholdersResponse.KybRegistry kybRegistry) { + return set("kyb_registry", Conv.model(KybListShareholdersResponse.KybRegistry::fromJson), kybRegistry); + } + + /** + * Echo of the vendor_data you sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybListShareholdersResponse} + */ + public KybListShareholdersResponse build() { + return new KybListShareholdersResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierRequested extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierRequested BASIC = new RegistryTierRequested("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierRequested SHAREHOLDERS = new RegistryTierRequested("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierRequested UBO = new RegistryTierRequested("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierRequested(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierRequested of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierRequested::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, or the registry has no ownership record for this company. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierDelivered BASIC = new RegistryTierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierDelivered SHAREHOLDERS = new RegistryTierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierDelivered UBO = new RegistryTierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Full registry company profile. */ + public static final class KybRegistry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "node_id", "status", "registry_status", "data_resolved", "company_name", "registration_number", "country_code", "region", "company_type", "incorporation_date", "registered_address", "tax_number", "risk_level", "verification_status", "is_from_registry", "fetch_status", "alternative_names", "nature_of_business", "registered_capital", "registered_capital_amount", "registered_capital_currency", "website", "email", "phone", "legal_entity_identifier", "location_of_registration", "vat_number", "vat_validation_status", "vat_validated_number", "vat_validation_source", "vat_validated_name", "vat_validated_address", "vat_checked_at", "financial_summary", "officers", "beneficial_owners", "addresses", "industries", "accounts", "registry_data", "user_provided_data", "confirmed_by_user_at", "last_console_edit_at", "is_editable", "registry_tier_delivered", "registry_ownership_status", "ownership", "registry_tier"); + + private KybRegistry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybRegistry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybRegistry fromJson(JsonNode json) { + return new KybRegistry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's id for this company record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.Status::of)); + } + + /** + * Normalized company status as reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryStatus() { + return Json.optional(json, "registry_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.RegistryStatus::of)); + } + + /** + * true once the registry returned the full profile. false when the registry was still processing after polling โ€” the stored record completes automatically once the registry resolves. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataResolved() { + return Json.optional(json, "data_resolved", Conv.BOOLEAN); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Subdivision code when the registry is regional (e.g. CA for US-CA); empty otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The company_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyType() { + return Json.optional(json, "company_type", Conv.STRING); + } + + /** + * The incorporation_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional incorporationDate() { + return Json.optional(json, "incorporation_date", Conv.DATE); + } + + /** + * The registered_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredAddress() { + return Json.optional(json, "registered_address", Conv.STRING); + } + + /** + * The tax_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * Registry-reported risk level, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * Registry verification status, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationStatus() { + return Json.optional(json, "verification_status", Conv.STRING); + } + + /** + * Always true for this endpoint โ€” the profile was retrieved from an official registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFromRegistry() { + return Json.optional(json, "is_from_registry", Conv.BOOLEAN); + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fetchStatus() { + return Json.optional(json, "fetch_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.FetchStatus::of)); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alternativeNames() { + return Json.optional(json, "alternative_names", Conv.STRING); + } + + /** + * Activity description or classification code, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional natureOfBusiness() { + return Json.optional(json, "nature_of_business", Conv.STRING); + } + + /** + * The registered_capital field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapital() { + return Json.optional(json, "registered_capital", Conv.STRING); + } + + /** + * Decimal amount as a string, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalAmount() { + return Json.optional(json, "registered_capital_amount", Conv.STRING); + } + + /** + * ISO 4217 code, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalCurrency() { + return Json.optional(json, "registered_capital_currency", Conv.STRING); + } + + /** + * The website field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The phone field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * LEI, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalEntityIdentifier() { + return Json.optional(json, "legal_entity_identifier", Conv.STRING); + } + + /** + * Registry/jurisdiction the company is registered with, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationOfRegistration() { + return Json.optional(json, "location_of_registration", Conv.STRING); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. At select time this is typically not yet set โ€” VAT and tax ID validation runs when the end user submits the registry step in the hosted flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatNumber() { + return Json.optional(json, "vat_number", Conv.STRING); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationStatus() { + return Json.optional(json, "vat_validation_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.VatValidationStatus::of)); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedNumber() { + return Json.optional(json, "vat_validated_number", Conv.STRING); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationSource() { + return Json.optional(json, "vat_validation_source", Conv.enumeration(KybListShareholdersResponse.KybRegistry.VatValidationSource::of)); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedName() { + return Json.optional(json, "vat_validated_name", Conv.STRING); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedAddress() { + return Json.optional(json, "vat_validated_address", Conv.STRING); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatCheckedAt() { + return Json.optional(json, "vat_checked_at", Conv.DATE_TIME); + } + + /** + * Registry-reported share/capital details (currency, total shares, share classes), when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> financialSummary() { + return Json.optional(json, "financial_summary", Conv.OBJECT); + } + + /** + * Directors, secretaries, and other officers extracted from the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> officers() { + return Json.optional(json, "officers", Conv.list(Conv.model(KybListShareholdersResponse.KybRegistry.Officers::fromJson))); + } + + /** + * Beneficial owners / persons with significant control extracted from the registry. Can be empty when the registry does not expose ownership. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficialOwners() { + return Json.optional(json, "beneficial_owners", Conv.list(Conv.model(KybListShareholdersResponse.KybRegistry.BeneficialOwners::fromJson))); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> addresses() { + return Json.optional(json, "addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson))); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> industries() { + return Json.optional(json, "industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson))); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> accounts() { + return Json.optional(json, "accounts", Conv.OBJECT); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registryData() { + return Json.optional(json, "registry_data", Conv.OBJECT); + } + + /** + * Always null on this endpoint (used by the hosted KYB flow when end users edit registry data). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> userProvidedData() { + return Json.optional(json, "user_provided_data", Conv.OBJECT); + } + + /** + * Always null on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmedByUserAt() { + return Json.optional(json, "confirmed_by_user_at", Conv.DATE_TIME); + } + + /** + * Set when a console reviewer edits the record later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastConsoleEditAt() { + return Json.optional(json, "last_console_edit_at", Conv.DATE_TIME); + } + + /** + * Whether the registry-sourced data can still be edited in the hosted flow/console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + /** + * Same as the top-level registry_tier_delivered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.enumeration(KybListShareholdersResponse.KybRegistry.RegistryTierDelivered::of)); + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), pending when the ownership section has not been retrieved from the registry yet and Didit is still completing it, not_requested on the Lite tier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryOwnershipStatus() { + return Json.optional(json, "registry_ownership_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.RegistryOwnershipStatus::of)); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownership() { + return Json.optional(json, "ownership", Conv.model(KYBRegistryOwnership::fromJson)); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTier() { + return Json.optional(json, "registry_tier", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybRegistry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybRegistry from) { + super(from); + } + + /** + * Didit's id for this company record. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The node_id field. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + * @param status the value + * @return this builder + */ + public Builder status(KybListShareholdersResponse.KybRegistry.Status status) { + return set("status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.Status::of), status); + } + + /** + * Normalized company status as reported by the registry. + * + * @param registryStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryStatus(KybListShareholdersResponse.KybRegistry.@Nullable RegistryStatus registryStatus) { + return setNullable("registry_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.RegistryStatus::of), registryStatus); + } + + /** + * true once the registry returned the full profile. false when the registry was still processing after polling โ€” the stored record completes automatically once the registry resolves. + * + * @param dataResolved the value + * @return this builder + */ + public Builder dataResolved(boolean dataResolved) { + return set("data_resolved", Conv.BOOLEAN, dataResolved); + } + + /** + * The company_name field. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * ISO 3166-1 alpha-2. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Subdivision code when the registry is regional (e.g. CA for US-CA); empty otherwise. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The company_type field. + * + * @param companyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyType(@Nullable String companyType) { + return setNullable("company_type", Conv.STRING, companyType); + } + + /** + * The incorporation_date field. + * + * @param incorporationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder incorporationDate(@Nullable LocalDate incorporationDate) { + return setNullable("incorporation_date", Conv.DATE, incorporationDate); + } + + /** + * The registered_address field. + * + * @param registeredAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredAddress(@Nullable String registeredAddress) { + return setNullable("registered_address", Conv.STRING, registeredAddress); + } + + /** + * The tax_number field. + * + * @param taxNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder taxNumber(@Nullable String taxNumber) { + return setNullable("tax_number", Conv.STRING, taxNumber); + } + + /** + * Registry-reported risk level, when available. + * + * @param riskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskLevel(@Nullable String riskLevel) { + return setNullable("risk_level", Conv.STRING, riskLevel); + } + + /** + * Registry verification status, when available. + * + * @param verificationStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationStatus(@Nullable String verificationStatus) { + return setNullable("verification_status", Conv.STRING, verificationStatus); + } + + /** + * Always true for this endpoint โ€” the profile was retrieved from an official registry. + * + * @param isFromRegistry the value + * @return this builder + */ + public Builder isFromRegistry(boolean isFromRegistry) { + return set("is_from_registry", Conv.BOOLEAN, isFromRegistry); + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + * @param fetchStatus the value + * @return this builder + */ + public Builder fetchStatus(KybListShareholdersResponse.KybRegistry.FetchStatus fetchStatus) { + return set("fetch_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.FetchStatus::of), fetchStatus); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @param alternativeNames the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder alternativeNames(@Nullable String alternativeNames) { + return setNullable("alternative_names", Conv.STRING, alternativeNames); + } + + /** + * Activity description or classification code, when reported. + * + * @param natureOfBusiness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder natureOfBusiness(@Nullable String natureOfBusiness) { + return setNullable("nature_of_business", Conv.STRING, natureOfBusiness); + } + + /** + * The registered_capital field. + * + * @param registeredCapital the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapital(@Nullable String registeredCapital) { + return setNullable("registered_capital", Conv.STRING, registeredCapital); + } + + /** + * Decimal amount as a string, when reported. + * + * @param registeredCapitalAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalAmount(@Nullable String registeredCapitalAmount) { + return setNullable("registered_capital_amount", Conv.STRING, registeredCapitalAmount); + } + + /** + * ISO 4217 code, when reported. + * + * @param registeredCapitalCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalCurrency(@Nullable String registeredCapitalCurrency) { + return setNullable("registered_capital_currency", Conv.STRING, registeredCapitalCurrency); + } + + /** + * The website field. + * + * @param website the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder website(@Nullable String website) { + return setNullable("website", Conv.STRING, website); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The phone field. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(@Nullable String phone) { + return setNullable("phone", Conv.STRING, phone); + } + + /** + * LEI, when reported. + * + * @param legalEntityIdentifier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalEntityIdentifier(@Nullable String legalEntityIdentifier) { + return setNullable("legal_entity_identifier", Conv.STRING, legalEntityIdentifier); + } + + /** + * Registry/jurisdiction the company is registered with, when reported. + * + * @param locationOfRegistration the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder locationOfRegistration(@Nullable String locationOfRegistration) { + return setNullable("location_of_registration", Conv.STRING, locationOfRegistration); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. At select time this is typically not yet set โ€” VAT and tax ID validation runs when the end user submits the registry step in the hosted flow. + * + * @param vatNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatNumber(@Nullable String vatNumber) { + return setNullable("vat_number", Conv.STRING, vatNumber); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @param vatValidationStatus the value + * @return this builder + */ + public Builder vatValidationStatus(KybListShareholdersResponse.KybRegistry.VatValidationStatus vatValidationStatus) { + return set("vat_validation_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.VatValidationStatus::of), vatValidationStatus); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @param vatValidatedNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedNumber(@Nullable String vatValidatedNumber) { + return setNullable("vat_validated_number", Conv.STRING, vatValidatedNumber); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @param vatValidationSource the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidationSource(KybListShareholdersResponse.KybRegistry.@Nullable VatValidationSource vatValidationSource) { + return setNullable("vat_validation_source", Conv.enumeration(KybListShareholdersResponse.KybRegistry.VatValidationSource::of), vatValidationSource); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedName(@Nullable String vatValidatedName) { + return setNullable("vat_validated_name", Conv.STRING, vatValidatedName); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedAddress(@Nullable String vatValidatedAddress) { + return setNullable("vat_validated_address", Conv.STRING, vatValidatedAddress); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @param vatCheckedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatCheckedAt(@Nullable OffsetDateTime vatCheckedAt) { + return setNullable("vat_checked_at", Conv.DATE_TIME, vatCheckedAt); + } + + /** + * Registry-reported share/capital details (currency, total shares, share classes), when available. + * + * @param financialSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder financialSummary(@Nullable Map financialSummary) { + return setAny("financial_summary", financialSummary); + } + + /** + * Directors, secretaries, and other officers extracted from the registry. + * + * @param officers the value + * @return this builder + */ + public Builder officers(List officers) { + return set("officers", Conv.list(Conv.model(KybListShareholdersResponse.KybRegistry.Officers::fromJson)), officers); + } + + /** + * Beneficial owners / persons with significant control extracted from the registry. Can be empty when the registry does not expose ownership. + * + * @param beneficialOwners the value + * @return this builder + */ + public Builder beneficialOwners(List beneficialOwners) { + return set("beneficial_owners", Conv.list(Conv.model(KybListShareholdersResponse.KybRegistry.BeneficialOwners::fromJson)), beneficialOwners); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @param addresses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addresses(@Nullable List addresses) { + return setNullable("addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson)), addresses); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @param industries the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder industries(@Nullable List industries) { + return setNullable("industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson)), industries); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @param accounts the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder accounts(@Nullable Map accounts) { + return setAny("accounts", accounts); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @param registryData the value + * @return this builder + */ + public Builder registryData(Map registryData) { + return setAny("registry_data", registryData); + } + + /** + * Always null on this endpoint (used by the hosted KYB flow when end users edit registry data). + * + * @param userProvidedData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userProvidedData(@Nullable Map userProvidedData) { + return setAny("user_provided_data", userProvidedData); + } + + /** + * Always null on this endpoint. + * + * @param confirmedByUserAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder confirmedByUserAt(@Nullable OffsetDateTime confirmedByUserAt) { + return setNullable("confirmed_by_user_at", Conv.DATE_TIME, confirmedByUserAt); + } + + /** + * Set when a console reviewer edits the record later. + * + * @param lastConsoleEditAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastConsoleEditAt(@Nullable OffsetDateTime lastConsoleEditAt) { + return setNullable("last_console_edit_at", Conv.DATE_TIME, lastConsoleEditAt); + } + + /** + * Whether the registry-sourced data can still be edited in the hosted flow/console. + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Same as the top-level registry_tier_delivered. + * + * @param registryTierDelivered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTierDelivered(KybListShareholdersResponse.KybRegistry.@Nullable RegistryTierDelivered registryTierDelivered) { + return setNullable("registry_tier_delivered", Conv.enumeration(KybListShareholdersResponse.KybRegistry.RegistryTierDelivered::of), registryTierDelivered); + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), pending when the ownership section has not been retrieved from the registry yet and Didit is still completing it, not_requested on the Lite tier. + * + * @param registryOwnershipStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryOwnershipStatus(KybListShareholdersResponse.KybRegistry.@Nullable RegistryOwnershipStatus registryOwnershipStatus) { + return setNullable("registry_ownership_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.RegistryOwnershipStatus::of), registryOwnershipStatus); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @param ownership the value + * @return this builder + */ + public Builder ownership(KYBRegistryOwnership ownership) { + return set("ownership", Conv.model(KYBRegistryOwnership::fromJson), ownership); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @param registryTier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTier(@Nullable String registryTier) { + return setNullable("registry_tier", Conv.STRING, registryTier); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybRegistry} + */ + public KybRegistry build() { + return new KybRegistry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Normalized company status as reported by the registry. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryStatus extends StringEnum { + /** The value {@code "active"}. */ + public static final RegistryStatus ACTIVE = new RegistryStatus("active"); + + /** The value {@code "dissolved"}. */ + public static final RegistryStatus DISSOLVED = new RegistryStatus("dissolved"); + + /** The value {@code "deregistered"}. */ + public static final RegistryStatus DEREGISTERED = new RegistryStatus("deregistered"); + + /** The value {@code "see full details"}. */ + public static final RegistryStatus SEE_FULL_DETAILS = new RegistryStatus("see full details"); + + /** The value {@code "authorised"}. */ + public static final RegistryStatus AUTHORISED = new RegistryStatus("authorised"); + + /** The value {@code "appointed representative"}. */ + public static final RegistryStatus APPOINTED_REPRESENTATIVE = new RegistryStatus("appointed representative"); + + /** The value {@code "unauthorised"}. */ + public static final RegistryStatus UNAUTHORISED = new RegistryStatus("unauthorised"); + + /** The value {@code "inactive"}. */ + public static final RegistryStatus INACTIVE = new RegistryStatus("inactive"); + + /** The value {@code "no longer authorised"}. */ + public static final RegistryStatus NO_LONGER_AUTHORISED = new RegistryStatus("no longer authorised"); + + /** The value {@code "closed"}. */ + public static final RegistryStatus CLOSED = new RegistryStatus("closed"); + + /** The value {@code "struck off"}. */ + public static final RegistryStatus STRUCK_OFF = new RegistryStatus("struck off"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISSOLVED, DEREGISTERED, SEE_FULL_DETAILS, AUTHORISED, APPOINTED_REPRESENTATIVE, UNAUTHORISED, INACTIVE, NO_LONGER_AUTHORISED, CLOSED, STRUCK_OFF); + + private RegistryStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class FetchStatus extends StringEnum { + /** The value {@code "pending"}. */ + public static final FetchStatus PENDING = new FetchStatus("pending"); + + /** The value {@code "resolved"}. */ + public static final FetchStatus RESOLVED = new FetchStatus("resolved"); + + private static final List KNOWN_VALUES = List.of(PENDING, RESOLVED); + + private FetchStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FetchStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FetchStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationStatus extends StringEnum { + /** The value {@code "valid"}. */ + public static final VatValidationStatus VALID = new VatValidationStatus("valid"); + + /** The value {@code "invalid"}. */ + public static final VatValidationStatus INVALID = new VatValidationStatus("invalid"); + + /** The value {@code "format_valid"}. */ + public static final VatValidationStatus FORMAT_VALID = new VatValidationStatus("format_valid"); + + /** The value {@code "invalid_format"}. */ + public static final VatValidationStatus INVALID_FORMAT = new VatValidationStatus("invalid_format"); + + /** The value {@code "could_not_validate"}. */ + public static final VatValidationStatus COULD_NOT_VALIDATE = new VatValidationStatus("could_not_validate"); + + /** The value {@code "not_applicable"}. */ + public static final VatValidationStatus NOT_APPLICABLE = new VatValidationStatus("not_applicable"); + + private static final List KNOWN_VALUES = List.of(VALID, INVALID, FORMAT_VALID, INVALID_FORMAT, COULD_NOT_VALIDATE, NOT_APPLICABLE); + + private VatValidationStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationSource extends StringEnum { + /** The value {@code "eu_vies"}. */ + public static final VatValidationSource EU_VIES = new VatValidationSource("eu_vies"); + + /** The value {@code "pl_vat_white_list"}. */ + public static final VatValidationSource PL_VAT_WHITE_LIST = new VatValidationSource("pl_vat_white_list"); + + /** The value {@code "no_brreg"}. */ + public static final VatValidationSource NO_BRREG = new VatValidationSource("no_brreg"); + + /** The value {@code "ch_uid_register"}. */ + public static final VatValidationSource CH_UID_REGISTER = new VatValidationSource("ch_uid_register"); + + /** The value {@code "br_receita_federal"}. */ + public static final VatValidationSource BR_RECEITA_FEDERAL = new VatValidationSource("br_receita_federal"); + + /** The value {@code "co_rues"}. */ + public static final VatValidationSource CO_RUES = new VatValidationSource("co_rues"); + + /** The value {@code "cr_hacienda"}. */ + public static final VatValidationSource CR_HACIENDA = new VatValidationSource("cr_hacienda"); + + /** The value {@code "ec_sri"}. */ + public static final VatValidationSource EC_SRI = new VatValidationSource("ec_sri"); + + /** The value {@code "py_dnit"}. */ + public static final VatValidationSource PY_DNIT = new VatValidationSource("py_dnit"); + + /** The value {@code "format_rules"}. */ + public static final VatValidationSource FORMAT_RULES = new VatValidationSource("format_rules"); + + private static final List KNOWN_VALUES = List.of(EU_VIES, PL_VAT_WHITE_LIST, NO_BRREG, CH_UID_REGISTER, BR_RECEITA_FEDERAL, CO_RUES, CR_HACIENDA, EC_SRI, PY_DNIT, FORMAT_RULES); + + private VatValidationSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Officers extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "designation", "role", "nationality", "is_active", "kyc_status", "kyc_session_url", "first_name", "last_name", "address", "appointment_date", "termination_date", "date_of_birth", "date_of_birth_year", "date_of_birth_month"); + + private Officers(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Officers} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Officers fromJson(JsonNode json) { + return new Officers(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Raw registry designation (e.g. Director, Secretary). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(KybListShareholdersResponse.KybRegistry.Officers.Role::of)); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * false when the registry marks the appointment as resigned. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.Officers.KycStatus::of)); + } + + /** + * Verification URL of the associated KYC session, when one exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name when explicitly reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Officer address reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Date the officer was appointed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * Date the appointment ended, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional terminationDate() { + return Json.optional(json, "termination_date", Conv.DATE); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthYear() { + return Json.optional(json, "date_of_birth_year", Conv.LONG); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthMonth() { + return Json.optional(json, "date_of_birth_month", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Officers}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Officers from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Raw registry designation (e.g. Director, Secretary). + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + * @param role the value + * @return this builder + */ + public Builder role(KybListShareholdersResponse.KybRegistry.Officers.Role role) { + return set("role", Conv.enumeration(KybListShareholdersResponse.KybRegistry.Officers.Role::of), role); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * false when the registry marks the appointment as resigned. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(KybListShareholdersResponse.KybRegistry.Officers.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.Officers.KycStatus::of), kycStatus); + } + + /** + * Verification URL of the associated KYC session, when one exists. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name when explicitly reported by the registry. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Officer address reported by the registry. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Date the officer was appointed. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * Date the appointment ended, when reported. + * + * @param terminationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder terminationDate(@Nullable LocalDate terminationDate) { + return setNullable("termination_date", Conv.DATE, terminationDate); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @param dateOfBirthYear the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthYear(@Nullable Long dateOfBirthYear) { + return setNullable("date_of_birth_year", Conv.LONG, dateOfBirthYear); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @param dateOfBirthMonth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthMonth(@Nullable Long dateOfBirthMonth) { + return setNullable("date_of_birth_month", Conv.LONG, dateOfBirthMonth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Officers} + */ + public Officers build() { + return new Officers(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "director"}. */ + public static final Role DIRECTOR = new Role("director"); + + /** The value {@code "non_executive_director"}. */ + public static final Role NON_EXECUTIVE_DIRECTOR = new Role("non_executive_director"); + + /** The value {@code "secretary"}. */ + public static final Role SECRETARY = new Role("secretary"); + + /** The value {@code "chairman"}. */ + public static final Role CHAIRMAN = new Role("chairman"); + + /** The value {@code "ubo"}. */ + public static final Role UBO = new Role("ubo"); + + /** The value {@code "shareholder"}. */ + public static final Role SHAREHOLDER = new Role("shareholder"); + + /** The value {@code "representative"}. */ + public static final Role REPRESENTATIVE = new Role("representative"); + + /** The value {@code "founder"}. */ + public static final Role FOUNDER = new Role("founder"); + + /** The value {@code "legal_advisor"}. */ + public static final Role LEGAL_ADVISOR = new Role("legal_advisor"); + + /** The value {@code "authorized_signatory"}. */ + public static final Role AUTHORIZED_SIGNATORY = new Role("authorized_signatory"); + + /** The value {@code "trustee"}. */ + public static final Role TRUSTEE = new Role("trustee"); + + /** The value {@code "beneficiary"}. */ + public static final Role BENEFICIARY = new Role("beneficiary"); + + /** The value {@code "company_officer"}. */ + public static final Role COMPANY_OFFICER = new Role("company_officer"); + + /** The value {@code "settlor"}. */ + public static final Role SETTLOR = new Role("settlor"); + + /** The value {@code "protector"}. */ + public static final Role PROTECTOR = new Role("protector"); + + /** The value {@code "investor"}. */ + public static final Role INVESTOR = new Role("investor"); + + /** The value {@code "other"}. */ + public static final Role OTHER = new Role("other"); + + private static final List KNOWN_VALUES = List.of(DIRECTOR, NON_EXECUTIVE_DIRECTOR, SECRETARY, CHAIRMAN, UBO, SHAREHOLDER, REPRESENTATIVE, FOUNDER, LEGAL_ADVISOR, AUTHORIZED_SIGNATORY, TRUSTEE, BENEFICIARY, COMPANY_OFFICER, SETTLOR, PROTECTOR, INVESTOR, OTHER); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class BeneficialOwners extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "first_name", "last_name", "entity_type", "roles", "ownership_min_shares", "ownership_max_shares", "is_active", "kyc_status", "kyc_session_url", "effective_ownership_percent", "company_name", "registration_number", "country_of_birth", "email", "nationality", "designation", "voting_min_shares", "voting_max_shares", "date_of_birth", "appointment_date", "shareholding"); + + private BeneficialOwners(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BeneficialOwners} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BeneficialOwners fromJson(JsonNode json) { + return new BeneficialOwners(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(KybListShareholdersResponse.KybRegistry.BeneficialOwners.EntityType::of)); + } + + /** + * Normalized roles (e.g. ubo, shareholder). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> roles() { + return Json.optional(json, "roles", Conv.list(Conv.STRING)); + } + + /** + * Lower bound of the ownership band reported by the registry (e.g. 25%). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMinShares() { + return Json.optional(json, "ownership_min_shares", Conv.STRING); + } + + /** + * Upper bound of the ownership band reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMaxShares() { + return Json.optional(json, "ownership_max_shares", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The kyc_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.BeneficialOwners.KycStatus::of)); + } + + /** + * The kyc_session_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Parsed ownership percentage (max bound, falling back to min bound). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveOwnershipPercent() { + return Json.optional(json, "effective_ownership_percent", Conv.DOUBLE); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * The country_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryOfBirth() { + return Json.optional(json, "country_of_birth", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The designation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * The voting_min_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMinShares() { + return Json.optional(json, "voting_min_shares", Conv.STRING); + } + + /** + * The voting_max_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMaxShares() { + return Json.optional(json, "voting_max_shares", Conv.STRING); + } + + /** + * Complete birth date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Appointment date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shareholding() { + return Json.optional(json, "shareholding", Conv.model(KYBRegistryShareholding::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BeneficialOwners}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BeneficialOwners from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(KybListShareholdersResponse.KybRegistry.BeneficialOwners.EntityType entityType) { + return set("entity_type", Conv.enumeration(KybListShareholdersResponse.KybRegistry.BeneficialOwners.EntityType::of), entityType); + } + + /** + * Normalized roles (e.g. ubo, shareholder). + * + * @param roles the value + * @return this builder + */ + public Builder roles(List roles) { + return set("roles", Conv.list(Conv.STRING), roles); + } + + /** + * Lower bound of the ownership band reported by the registry (e.g. 25%). + * + * @param ownershipMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMinShares(@Nullable String ownershipMinShares) { + return setNullable("ownership_min_shares", Conv.STRING, ownershipMinShares); + } + + /** + * Upper bound of the ownership band reported by the registry. + * + * @param ownershipMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMaxShares(@Nullable String ownershipMaxShares) { + return setNullable("ownership_max_shares", Conv.STRING, ownershipMaxShares); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The kyc_status field. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(KybListShareholdersResponse.KybRegistry.BeneficialOwners.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(KybListShareholdersResponse.KybRegistry.BeneficialOwners.KycStatus::of), kycStatus); + } + + /** + * The kyc_session_url field. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Parsed ownership percentage (max bound, falling back to min bound). + * + * @param effectiveOwnershipPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveOwnershipPercent(@Nullable Double effectiveOwnershipPercent) { + return setNullable("effective_ownership_percent", Conv.DOUBLE, effectiveOwnershipPercent); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * The country_of_birth field. + * + * @param countryOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryOfBirth(@Nullable String countryOfBirth) { + return setNullable("country_of_birth", Conv.STRING, countryOfBirth); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The designation field. + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * The voting_min_shares field. + * + * @param votingMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMinShares(@Nullable String votingMinShares) { + return setNullable("voting_min_shares", Conv.STRING, votingMinShares); + } + + /** + * The voting_max_shares field. + * + * @param votingMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMaxShares(@Nullable String votingMaxShares) { + return setNullable("voting_max_shares", Conv.STRING, votingMaxShares); + } + + /** + * Complete birth date when reported. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Appointment date when reported. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @param shareholding the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder shareholding(@Nullable KYBRegistryShareholding shareholding) { + return setNullable("shareholding", Conv.model(KYBRegistryShareholding::fromJson), shareholding); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BeneficialOwners} + */ + public BeneficialOwners build() { + return new BeneficialOwners(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Same as the top-level registry_tier_delivered. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierDelivered BASIC = new RegistryTierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierDelivered SHAREHOLDERS = new RegistryTierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierDelivered UBO = new RegistryTierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), pending when the ownership section has not been retrieved from the registry yet and Didit is still completing it, not_requested on the Lite tier. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryOwnershipStatus extends StringEnum { + /** The value {@code "not_requested"}. */ + public static final RegistryOwnershipStatus NOT_REQUESTED = new RegistryOwnershipStatus("not_requested"); + + /** The value {@code "delivered"}. */ + public static final RegistryOwnershipStatus DELIVERED = new RegistryOwnershipStatus("delivered"); + + /** The value {@code "unavailable"}. */ + public static final RegistryOwnershipStatus UNAVAILABLE = new RegistryOwnershipStatus("unavailable"); + + /** The value {@code "pending"}. */ + public static final RegistryOwnershipStatus PENDING = new RegistryOwnershipStatus("pending"); + + private static final List KNOWN_VALUES = List.of(NOT_REQUESTED, DELIVERED, UNAVAILABLE, PENDING); + + private RegistryOwnershipStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryOwnershipStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryOwnershipStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/KybListUbosParams.java b/src/main/java/me/didit/types/KybListUbosParams.java new file mode 100644 index 0000000..2bcd42a --- /dev/null +++ b/src/main/java/me/didit/types/KybListUbosParams.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code kyb.list_ubos}. */ +public final class KybListUbosParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("kyb_response_id", "vendor_data", "metadata", "save_api_request"); + + private KybListUbosParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybListUbosParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybListUbosParams fromJson(JsonNode json) { + return new KybListUbosParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Candidate handle from POST /v3/kyb/search/ (kyb_registry.companies[].kyb_response_id). Ephemeral โ€” use it shortly after the search that produced it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String kybResponseId() { + return Json.required(json, "kyb_response_id", Conv.STRING); + } + + /** + * Your identifier for this company; echoed back and stored with the business session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Free-form JSON stored with the business session and echoed back. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Must be true (the default). KYB registry selects are always persisted so billing and retrieval can be tracked; false returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybListUbosParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybListUbosParams from) { + super(from); + } + + /** + * Candidate handle from POST /v3/kyb/search/ (kyb_registry.companies[].kyb_response_id). Ephemeral โ€” use it shortly after the search that produced it. + * + * @param kybResponseId the value + * @return this builder + */ + public Builder kybResponseId(String kybResponseId) { + return set("kyb_response_id", Conv.STRING, kybResponseId); + } + + /** + * Your identifier for this company; echoed back and stored with the business session. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Free-form JSON stored with the business session and echoed back. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Must be true (the default). KYB registry selects are always persisted so billing and retrieval can be tracked; false returns 400. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybListUbosParams} + * @throws IllegalStateException when a required field is missing + */ + public KybListUbosParams build() { + require("kyb_response_id", false); + return new KybListUbosParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/KybListUbosResponse.java b/src/main/java/me/didit/types/KybListUbosResponse.java new file mode 100644 index 0000000..6b743ab --- /dev/null +++ b/src/main/java/me/didit/types/KybListUbosResponse.java @@ -0,0 +1,2871 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class KybListUbosResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "registry_tier_requested", "registry_tier_delivered", "kyb_registry", "vendor_data", "metadata", "created_at"); + + private KybListUbosResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybListUbosResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybListUbosResponse fromJson(JsonNode json) { + return new KybListUbosResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the business session created for this retrieval. The stored record (visible in the console) keeps updating if the registry resolves after the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierRequested() { + return Json.optional(json, "registry_tier_requested", Conv.enumeration(KybListUbosResponse.RegistryTierRequested::of)); + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, when the registry has no ownership record for this company, or when the resolved report of a ubo request names no natural person as a beneficial owner. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.enumeration(KybListUbosResponse.RegistryTierDelivered::of)); + } + + /** + * Full registry company profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybRegistry() { + return Json.optional(json, "kyb_registry", Conv.model(KybListUbosResponse.KybRegistry::fromJson)); + } + + /** + * Echo of the vendor_data you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybListUbosResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybListUbosResponse from) { + super(from); + } + + /** + * Id of the business session created for this retrieval. The stored record (visible in the console) keeps updating if the registry resolves after the response. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + * @param registryTierRequested the value + * @return this builder + */ + public Builder registryTierRequested(KybListUbosResponse.RegistryTierRequested registryTierRequested) { + return set("registry_tier_requested", Conv.enumeration(KybListUbosResponse.RegistryTierRequested::of), registryTierRequested); + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, when the registry has no ownership record for this company, or when the resolved report of a ubo request names no natural person as a beneficial owner. + * + * @param registryTierDelivered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTierDelivered(KybListUbosResponse.@Nullable RegistryTierDelivered registryTierDelivered) { + return setNullable("registry_tier_delivered", Conv.enumeration(KybListUbosResponse.RegistryTierDelivered::of), registryTierDelivered); + } + + /** + * Full registry company profile. + * + * @param kybRegistry the value + * @return this builder + */ + public Builder kybRegistry(KybListUbosResponse.KybRegistry kybRegistry) { + return set("kyb_registry", Conv.model(KybListUbosResponse.KybRegistry::fromJson), kybRegistry); + } + + /** + * Echo of the vendor_data you sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybListUbosResponse} + */ + public KybListUbosResponse build() { + return new KybListUbosResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierRequested extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierRequested BASIC = new RegistryTierRequested("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierRequested SHAREHOLDERS = new RegistryTierRequested("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierRequested UBO = new RegistryTierRequested("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierRequested(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierRequested of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierRequested::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, when the registry has no ownership record for this company, or when the resolved report of a ubo request names no natural person as a beneficial owner. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierDelivered BASIC = new RegistryTierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierDelivered SHAREHOLDERS = new RegistryTierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierDelivered UBO = new RegistryTierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Full registry company profile. */ + public static final class KybRegistry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "node_id", "status", "registry_status", "data_resolved", "company_name", "registration_number", "country_code", "region", "company_type", "incorporation_date", "registered_address", "tax_number", "risk_level", "verification_status", "is_from_registry", "fetch_status", "alternative_names", "nature_of_business", "registered_capital", "registered_capital_amount", "registered_capital_currency", "website", "email", "phone", "legal_entity_identifier", "location_of_registration", "vat_number", "vat_validation_status", "vat_validated_number", "vat_validation_source", "vat_validated_name", "vat_validated_address", "vat_checked_at", "financial_summary", "officers", "beneficial_owners", "addresses", "industries", "accounts", "registry_data", "user_provided_data", "confirmed_by_user_at", "last_console_edit_at", "is_editable", "registry_tier_delivered", "registry_ownership_status", "ownership", "registry_tier"); + + private KybRegistry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybRegistry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybRegistry fromJson(JsonNode json) { + return new KybRegistry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's id for this company record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(KybListUbosResponse.KybRegistry.Status::of)); + } + + /** + * Normalized company status as reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryStatus() { + return Json.optional(json, "registry_status", Conv.enumeration(KybListUbosResponse.KybRegistry.RegistryStatus::of)); + } + + /** + * true once the registry returned the full profile. false when the registry was still processing after polling โ€” the stored record completes automatically once the registry resolves. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataResolved() { + return Json.optional(json, "data_resolved", Conv.BOOLEAN); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Subdivision code when the registry is regional (e.g. CA for US-CA); empty otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The company_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyType() { + return Json.optional(json, "company_type", Conv.STRING); + } + + /** + * The incorporation_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional incorporationDate() { + return Json.optional(json, "incorporation_date", Conv.DATE); + } + + /** + * The registered_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredAddress() { + return Json.optional(json, "registered_address", Conv.STRING); + } + + /** + * The tax_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * Registry-reported risk level, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * Registry verification status, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationStatus() { + return Json.optional(json, "verification_status", Conv.STRING); + } + + /** + * Always true for this endpoint โ€” the profile was retrieved from an official registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFromRegistry() { + return Json.optional(json, "is_from_registry", Conv.BOOLEAN); + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fetchStatus() { + return Json.optional(json, "fetch_status", Conv.enumeration(KybListUbosResponse.KybRegistry.FetchStatus::of)); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alternativeNames() { + return Json.optional(json, "alternative_names", Conv.STRING); + } + + /** + * Activity description or classification code, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional natureOfBusiness() { + return Json.optional(json, "nature_of_business", Conv.STRING); + } + + /** + * The registered_capital field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapital() { + return Json.optional(json, "registered_capital", Conv.STRING); + } + + /** + * Decimal amount as a string, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalAmount() { + return Json.optional(json, "registered_capital_amount", Conv.STRING); + } + + /** + * ISO 4217 code, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalCurrency() { + return Json.optional(json, "registered_capital_currency", Conv.STRING); + } + + /** + * The website field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The phone field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * LEI, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalEntityIdentifier() { + return Json.optional(json, "legal_entity_identifier", Conv.STRING); + } + + /** + * Registry/jurisdiction the company is registered with, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationOfRegistration() { + return Json.optional(json, "location_of_registration", Conv.STRING); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. At select time this is typically not yet set โ€” VAT and tax ID validation runs when the end user submits the registry step in the hosted flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatNumber() { + return Json.optional(json, "vat_number", Conv.STRING); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationStatus() { + return Json.optional(json, "vat_validation_status", Conv.enumeration(KybListUbosResponse.KybRegistry.VatValidationStatus::of)); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedNumber() { + return Json.optional(json, "vat_validated_number", Conv.STRING); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationSource() { + return Json.optional(json, "vat_validation_source", Conv.enumeration(KybListUbosResponse.KybRegistry.VatValidationSource::of)); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedName() { + return Json.optional(json, "vat_validated_name", Conv.STRING); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedAddress() { + return Json.optional(json, "vat_validated_address", Conv.STRING); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatCheckedAt() { + return Json.optional(json, "vat_checked_at", Conv.DATE_TIME); + } + + /** + * Registry-reported share/capital details (currency, total shares, share classes), when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> financialSummary() { + return Json.optional(json, "financial_summary", Conv.OBJECT); + } + + /** + * Directors, secretaries, and other officers extracted from the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> officers() { + return Json.optional(json, "officers", Conv.list(Conv.model(KybListUbosResponse.KybRegistry.Officers::fromJson))); + } + + /** + * Beneficial owners / persons with significant control extracted from the registry. Can be empty when the registry does not expose ownership. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficialOwners() { + return Json.optional(json, "beneficial_owners", Conv.list(Conv.model(KybListUbosResponse.KybRegistry.BeneficialOwners::fromJson))); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> addresses() { + return Json.optional(json, "addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson))); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> industries() { + return Json.optional(json, "industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson))); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> accounts() { + return Json.optional(json, "accounts", Conv.OBJECT); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registryData() { + return Json.optional(json, "registry_data", Conv.OBJECT); + } + + /** + * Always null on this endpoint (used by the hosted KYB flow when end users edit registry data). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> userProvidedData() { + return Json.optional(json, "user_provided_data", Conv.OBJECT); + } + + /** + * Always null on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmedByUserAt() { + return Json.optional(json, "confirmed_by_user_at", Conv.DATE_TIME); + } + + /** + * Set when a console reviewer edits the record later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastConsoleEditAt() { + return Json.optional(json, "last_console_edit_at", Conv.DATE_TIME); + } + + /** + * Whether the registry-sourced data can still be edited in the hosted flow/console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + /** + * Same as the top-level registry_tier_delivered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.enumeration(KybListUbosResponse.KybRegistry.RegistryTierDelivered::of)); + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), pending when the ownership section has not been retrieved from the registry yet and Didit is still completing it, not_requested on the Lite tier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryOwnershipStatus() { + return Json.optional(json, "registry_ownership_status", Conv.enumeration(KybListUbosResponse.KybRegistry.RegistryOwnershipStatus::of)); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownership() { + return Json.optional(json, "ownership", Conv.model(KYBRegistryOwnership::fromJson)); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTier() { + return Json.optional(json, "registry_tier", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybRegistry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybRegistry from) { + super(from); + } + + /** + * Didit's id for this company record. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The node_id field. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + * @param status the value + * @return this builder + */ + public Builder status(KybListUbosResponse.KybRegistry.Status status) { + return set("status", Conv.enumeration(KybListUbosResponse.KybRegistry.Status::of), status); + } + + /** + * Normalized company status as reported by the registry. + * + * @param registryStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryStatus(KybListUbosResponse.KybRegistry.@Nullable RegistryStatus registryStatus) { + return setNullable("registry_status", Conv.enumeration(KybListUbosResponse.KybRegistry.RegistryStatus::of), registryStatus); + } + + /** + * true once the registry returned the full profile. false when the registry was still processing after polling โ€” the stored record completes automatically once the registry resolves. + * + * @param dataResolved the value + * @return this builder + */ + public Builder dataResolved(boolean dataResolved) { + return set("data_resolved", Conv.BOOLEAN, dataResolved); + } + + /** + * The company_name field. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * ISO 3166-1 alpha-2. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Subdivision code when the registry is regional (e.g. CA for US-CA); empty otherwise. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The company_type field. + * + * @param companyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyType(@Nullable String companyType) { + return setNullable("company_type", Conv.STRING, companyType); + } + + /** + * The incorporation_date field. + * + * @param incorporationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder incorporationDate(@Nullable LocalDate incorporationDate) { + return setNullable("incorporation_date", Conv.DATE, incorporationDate); + } + + /** + * The registered_address field. + * + * @param registeredAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredAddress(@Nullable String registeredAddress) { + return setNullable("registered_address", Conv.STRING, registeredAddress); + } + + /** + * The tax_number field. + * + * @param taxNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder taxNumber(@Nullable String taxNumber) { + return setNullable("tax_number", Conv.STRING, taxNumber); + } + + /** + * Registry-reported risk level, when available. + * + * @param riskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskLevel(@Nullable String riskLevel) { + return setNullable("risk_level", Conv.STRING, riskLevel); + } + + /** + * Registry verification status, when available. + * + * @param verificationStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationStatus(@Nullable String verificationStatus) { + return setNullable("verification_status", Conv.STRING, verificationStatus); + } + + /** + * Always true for this endpoint โ€” the profile was retrieved from an official registry. + * + * @param isFromRegistry the value + * @return this builder + */ + public Builder isFromRegistry(boolean isFromRegistry) { + return set("is_from_registry", Conv.BOOLEAN, isFromRegistry); + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + * @param fetchStatus the value + * @return this builder + */ + public Builder fetchStatus(KybListUbosResponse.KybRegistry.FetchStatus fetchStatus) { + return set("fetch_status", Conv.enumeration(KybListUbosResponse.KybRegistry.FetchStatus::of), fetchStatus); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @param alternativeNames the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder alternativeNames(@Nullable String alternativeNames) { + return setNullable("alternative_names", Conv.STRING, alternativeNames); + } + + /** + * Activity description or classification code, when reported. + * + * @param natureOfBusiness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder natureOfBusiness(@Nullable String natureOfBusiness) { + return setNullable("nature_of_business", Conv.STRING, natureOfBusiness); + } + + /** + * The registered_capital field. + * + * @param registeredCapital the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapital(@Nullable String registeredCapital) { + return setNullable("registered_capital", Conv.STRING, registeredCapital); + } + + /** + * Decimal amount as a string, when reported. + * + * @param registeredCapitalAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalAmount(@Nullable String registeredCapitalAmount) { + return setNullable("registered_capital_amount", Conv.STRING, registeredCapitalAmount); + } + + /** + * ISO 4217 code, when reported. + * + * @param registeredCapitalCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalCurrency(@Nullable String registeredCapitalCurrency) { + return setNullable("registered_capital_currency", Conv.STRING, registeredCapitalCurrency); + } + + /** + * The website field. + * + * @param website the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder website(@Nullable String website) { + return setNullable("website", Conv.STRING, website); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The phone field. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(@Nullable String phone) { + return setNullable("phone", Conv.STRING, phone); + } + + /** + * LEI, when reported. + * + * @param legalEntityIdentifier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalEntityIdentifier(@Nullable String legalEntityIdentifier) { + return setNullable("legal_entity_identifier", Conv.STRING, legalEntityIdentifier); + } + + /** + * Registry/jurisdiction the company is registered with, when reported. + * + * @param locationOfRegistration the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder locationOfRegistration(@Nullable String locationOfRegistration) { + return setNullable("location_of_registration", Conv.STRING, locationOfRegistration); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. At select time this is typically not yet set โ€” VAT and tax ID validation runs when the end user submits the registry step in the hosted flow. + * + * @param vatNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatNumber(@Nullable String vatNumber) { + return setNullable("vat_number", Conv.STRING, vatNumber); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @param vatValidationStatus the value + * @return this builder + */ + public Builder vatValidationStatus(KybListUbosResponse.KybRegistry.VatValidationStatus vatValidationStatus) { + return set("vat_validation_status", Conv.enumeration(KybListUbosResponse.KybRegistry.VatValidationStatus::of), vatValidationStatus); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @param vatValidatedNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedNumber(@Nullable String vatValidatedNumber) { + return setNullable("vat_validated_number", Conv.STRING, vatValidatedNumber); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @param vatValidationSource the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidationSource(KybListUbosResponse.KybRegistry.@Nullable VatValidationSource vatValidationSource) { + return setNullable("vat_validation_source", Conv.enumeration(KybListUbosResponse.KybRegistry.VatValidationSource::of), vatValidationSource); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedName(@Nullable String vatValidatedName) { + return setNullable("vat_validated_name", Conv.STRING, vatValidatedName); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedAddress(@Nullable String vatValidatedAddress) { + return setNullable("vat_validated_address", Conv.STRING, vatValidatedAddress); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @param vatCheckedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatCheckedAt(@Nullable OffsetDateTime vatCheckedAt) { + return setNullable("vat_checked_at", Conv.DATE_TIME, vatCheckedAt); + } + + /** + * Registry-reported share/capital details (currency, total shares, share classes), when available. + * + * @param financialSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder financialSummary(@Nullable Map financialSummary) { + return setAny("financial_summary", financialSummary); + } + + /** + * Directors, secretaries, and other officers extracted from the registry. + * + * @param officers the value + * @return this builder + */ + public Builder officers(List officers) { + return set("officers", Conv.list(Conv.model(KybListUbosResponse.KybRegistry.Officers::fromJson)), officers); + } + + /** + * Beneficial owners / persons with significant control extracted from the registry. Can be empty when the registry does not expose ownership. + * + * @param beneficialOwners the value + * @return this builder + */ + public Builder beneficialOwners(List beneficialOwners) { + return set("beneficial_owners", Conv.list(Conv.model(KybListUbosResponse.KybRegistry.BeneficialOwners::fromJson)), beneficialOwners); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @param addresses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addresses(@Nullable List addresses) { + return setNullable("addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson)), addresses); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @param industries the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder industries(@Nullable List industries) { + return setNullable("industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson)), industries); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @param accounts the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder accounts(@Nullable Map accounts) { + return setAny("accounts", accounts); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @param registryData the value + * @return this builder + */ + public Builder registryData(Map registryData) { + return setAny("registry_data", registryData); + } + + /** + * Always null on this endpoint (used by the hosted KYB flow when end users edit registry data). + * + * @param userProvidedData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userProvidedData(@Nullable Map userProvidedData) { + return setAny("user_provided_data", userProvidedData); + } + + /** + * Always null on this endpoint. + * + * @param confirmedByUserAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder confirmedByUserAt(@Nullable OffsetDateTime confirmedByUserAt) { + return setNullable("confirmed_by_user_at", Conv.DATE_TIME, confirmedByUserAt); + } + + /** + * Set when a console reviewer edits the record later. + * + * @param lastConsoleEditAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastConsoleEditAt(@Nullable OffsetDateTime lastConsoleEditAt) { + return setNullable("last_console_edit_at", Conv.DATE_TIME, lastConsoleEditAt); + } + + /** + * Whether the registry-sourced data can still be edited in the hosted flow/console. + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Same as the top-level registry_tier_delivered. + * + * @param registryTierDelivered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTierDelivered(KybListUbosResponse.KybRegistry.@Nullable RegistryTierDelivered registryTierDelivered) { + return setNullable("registry_tier_delivered", Conv.enumeration(KybListUbosResponse.KybRegistry.RegistryTierDelivered::of), registryTierDelivered); + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), pending when the ownership section has not been retrieved from the registry yet and Didit is still completing it, not_requested on the Lite tier. + * + * @param registryOwnershipStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryOwnershipStatus(KybListUbosResponse.KybRegistry.@Nullable RegistryOwnershipStatus registryOwnershipStatus) { + return setNullable("registry_ownership_status", Conv.enumeration(KybListUbosResponse.KybRegistry.RegistryOwnershipStatus::of), registryOwnershipStatus); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @param ownership the value + * @return this builder + */ + public Builder ownership(KYBRegistryOwnership ownership) { + return set("ownership", Conv.model(KYBRegistryOwnership::fromJson), ownership); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @param registryTier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTier(@Nullable String registryTier) { + return setNullable("registry_tier", Conv.STRING, registryTier); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybRegistry} + */ + public KybRegistry build() { + return new KybRegistry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Normalized company status as reported by the registry. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryStatus extends StringEnum { + /** The value {@code "active"}. */ + public static final RegistryStatus ACTIVE = new RegistryStatus("active"); + + /** The value {@code "dissolved"}. */ + public static final RegistryStatus DISSOLVED = new RegistryStatus("dissolved"); + + /** The value {@code "deregistered"}. */ + public static final RegistryStatus DEREGISTERED = new RegistryStatus("deregistered"); + + /** The value {@code "see full details"}. */ + public static final RegistryStatus SEE_FULL_DETAILS = new RegistryStatus("see full details"); + + /** The value {@code "authorised"}. */ + public static final RegistryStatus AUTHORISED = new RegistryStatus("authorised"); + + /** The value {@code "appointed representative"}. */ + public static final RegistryStatus APPOINTED_REPRESENTATIVE = new RegistryStatus("appointed representative"); + + /** The value {@code "unauthorised"}. */ + public static final RegistryStatus UNAUTHORISED = new RegistryStatus("unauthorised"); + + /** The value {@code "inactive"}. */ + public static final RegistryStatus INACTIVE = new RegistryStatus("inactive"); + + /** The value {@code "no longer authorised"}. */ + public static final RegistryStatus NO_LONGER_AUTHORISED = new RegistryStatus("no longer authorised"); + + /** The value {@code "closed"}. */ + public static final RegistryStatus CLOSED = new RegistryStatus("closed"); + + /** The value {@code "struck off"}. */ + public static final RegistryStatus STRUCK_OFF = new RegistryStatus("struck off"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISSOLVED, DEREGISTERED, SEE_FULL_DETAILS, AUTHORISED, APPOINTED_REPRESENTATIVE, UNAUTHORISED, INACTIVE, NO_LONGER_AUTHORISED, CLOSED, STRUCK_OFF); + + private RegistryStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class FetchStatus extends StringEnum { + /** The value {@code "pending"}. */ + public static final FetchStatus PENDING = new FetchStatus("pending"); + + /** The value {@code "resolved"}. */ + public static final FetchStatus RESOLVED = new FetchStatus("resolved"); + + private static final List KNOWN_VALUES = List.of(PENDING, RESOLVED); + + private FetchStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FetchStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FetchStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationStatus extends StringEnum { + /** The value {@code "valid"}. */ + public static final VatValidationStatus VALID = new VatValidationStatus("valid"); + + /** The value {@code "invalid"}. */ + public static final VatValidationStatus INVALID = new VatValidationStatus("invalid"); + + /** The value {@code "format_valid"}. */ + public static final VatValidationStatus FORMAT_VALID = new VatValidationStatus("format_valid"); + + /** The value {@code "invalid_format"}. */ + public static final VatValidationStatus INVALID_FORMAT = new VatValidationStatus("invalid_format"); + + /** The value {@code "could_not_validate"}. */ + public static final VatValidationStatus COULD_NOT_VALIDATE = new VatValidationStatus("could_not_validate"); + + /** The value {@code "not_applicable"}. */ + public static final VatValidationStatus NOT_APPLICABLE = new VatValidationStatus("not_applicable"); + + private static final List KNOWN_VALUES = List.of(VALID, INVALID, FORMAT_VALID, INVALID_FORMAT, COULD_NOT_VALIDATE, NOT_APPLICABLE); + + private VatValidationStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationSource extends StringEnum { + /** The value {@code "eu_vies"}. */ + public static final VatValidationSource EU_VIES = new VatValidationSource("eu_vies"); + + /** The value {@code "pl_vat_white_list"}. */ + public static final VatValidationSource PL_VAT_WHITE_LIST = new VatValidationSource("pl_vat_white_list"); + + /** The value {@code "no_brreg"}. */ + public static final VatValidationSource NO_BRREG = new VatValidationSource("no_brreg"); + + /** The value {@code "ch_uid_register"}. */ + public static final VatValidationSource CH_UID_REGISTER = new VatValidationSource("ch_uid_register"); + + /** The value {@code "br_receita_federal"}. */ + public static final VatValidationSource BR_RECEITA_FEDERAL = new VatValidationSource("br_receita_federal"); + + /** The value {@code "co_rues"}. */ + public static final VatValidationSource CO_RUES = new VatValidationSource("co_rues"); + + /** The value {@code "cr_hacienda"}. */ + public static final VatValidationSource CR_HACIENDA = new VatValidationSource("cr_hacienda"); + + /** The value {@code "ec_sri"}. */ + public static final VatValidationSource EC_SRI = new VatValidationSource("ec_sri"); + + /** The value {@code "py_dnit"}. */ + public static final VatValidationSource PY_DNIT = new VatValidationSource("py_dnit"); + + /** The value {@code "format_rules"}. */ + public static final VatValidationSource FORMAT_RULES = new VatValidationSource("format_rules"); + + private static final List KNOWN_VALUES = List.of(EU_VIES, PL_VAT_WHITE_LIST, NO_BRREG, CH_UID_REGISTER, BR_RECEITA_FEDERAL, CO_RUES, CR_HACIENDA, EC_SRI, PY_DNIT, FORMAT_RULES); + + private VatValidationSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Officers extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "designation", "role", "nationality", "is_active", "kyc_status", "kyc_session_url", "first_name", "last_name", "address", "appointment_date", "termination_date", "date_of_birth", "date_of_birth_year", "date_of_birth_month"); + + private Officers(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Officers} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Officers fromJson(JsonNode json) { + return new Officers(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Raw registry designation (e.g. Director, Secretary). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(KybListUbosResponse.KybRegistry.Officers.Role::of)); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * false when the registry marks the appointment as resigned. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(KybListUbosResponse.KybRegistry.Officers.KycStatus::of)); + } + + /** + * Verification URL of the associated KYC session, when one exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name when explicitly reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Officer address reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Date the officer was appointed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * Date the appointment ended, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional terminationDate() { + return Json.optional(json, "termination_date", Conv.DATE); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthYear() { + return Json.optional(json, "date_of_birth_year", Conv.LONG); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthMonth() { + return Json.optional(json, "date_of_birth_month", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Officers}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Officers from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Raw registry designation (e.g. Director, Secretary). + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + * @param role the value + * @return this builder + */ + public Builder role(KybListUbosResponse.KybRegistry.Officers.Role role) { + return set("role", Conv.enumeration(KybListUbosResponse.KybRegistry.Officers.Role::of), role); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * false when the registry marks the appointment as resigned. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(KybListUbosResponse.KybRegistry.Officers.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(KybListUbosResponse.KybRegistry.Officers.KycStatus::of), kycStatus); + } + + /** + * Verification URL of the associated KYC session, when one exists. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name when explicitly reported by the registry. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Officer address reported by the registry. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Date the officer was appointed. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * Date the appointment ended, when reported. + * + * @param terminationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder terminationDate(@Nullable LocalDate terminationDate) { + return setNullable("termination_date", Conv.DATE, terminationDate); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @param dateOfBirthYear the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthYear(@Nullable Long dateOfBirthYear) { + return setNullable("date_of_birth_year", Conv.LONG, dateOfBirthYear); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @param dateOfBirthMonth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthMonth(@Nullable Long dateOfBirthMonth) { + return setNullable("date_of_birth_month", Conv.LONG, dateOfBirthMonth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Officers} + */ + public Officers build() { + return new Officers(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "director"}. */ + public static final Role DIRECTOR = new Role("director"); + + /** The value {@code "non_executive_director"}. */ + public static final Role NON_EXECUTIVE_DIRECTOR = new Role("non_executive_director"); + + /** The value {@code "secretary"}. */ + public static final Role SECRETARY = new Role("secretary"); + + /** The value {@code "chairman"}. */ + public static final Role CHAIRMAN = new Role("chairman"); + + /** The value {@code "ubo"}. */ + public static final Role UBO = new Role("ubo"); + + /** The value {@code "shareholder"}. */ + public static final Role SHAREHOLDER = new Role("shareholder"); + + /** The value {@code "representative"}. */ + public static final Role REPRESENTATIVE = new Role("representative"); + + /** The value {@code "founder"}. */ + public static final Role FOUNDER = new Role("founder"); + + /** The value {@code "legal_advisor"}. */ + public static final Role LEGAL_ADVISOR = new Role("legal_advisor"); + + /** The value {@code "authorized_signatory"}. */ + public static final Role AUTHORIZED_SIGNATORY = new Role("authorized_signatory"); + + /** The value {@code "trustee"}. */ + public static final Role TRUSTEE = new Role("trustee"); + + /** The value {@code "beneficiary"}. */ + public static final Role BENEFICIARY = new Role("beneficiary"); + + /** The value {@code "company_officer"}. */ + public static final Role COMPANY_OFFICER = new Role("company_officer"); + + /** The value {@code "settlor"}. */ + public static final Role SETTLOR = new Role("settlor"); + + /** The value {@code "protector"}. */ + public static final Role PROTECTOR = new Role("protector"); + + /** The value {@code "investor"}. */ + public static final Role INVESTOR = new Role("investor"); + + /** The value {@code "other"}. */ + public static final Role OTHER = new Role("other"); + + private static final List KNOWN_VALUES = List.of(DIRECTOR, NON_EXECUTIVE_DIRECTOR, SECRETARY, CHAIRMAN, UBO, SHAREHOLDER, REPRESENTATIVE, FOUNDER, LEGAL_ADVISOR, AUTHORIZED_SIGNATORY, TRUSTEE, BENEFICIARY, COMPANY_OFFICER, SETTLOR, PROTECTOR, INVESTOR, OTHER); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class BeneficialOwners extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "first_name", "last_name", "entity_type", "roles", "ownership_min_shares", "ownership_max_shares", "is_active", "kyc_status", "kyc_session_url", "effective_ownership_percent", "company_name", "registration_number", "country_of_birth", "email", "nationality", "designation", "voting_min_shares", "voting_max_shares", "date_of_birth", "appointment_date", "shareholding"); + + private BeneficialOwners(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BeneficialOwners} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BeneficialOwners fromJson(JsonNode json) { + return new BeneficialOwners(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(KybListUbosResponse.KybRegistry.BeneficialOwners.EntityType::of)); + } + + /** + * Normalized roles (e.g. ubo, shareholder). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> roles() { + return Json.optional(json, "roles", Conv.list(Conv.STRING)); + } + + /** + * Lower bound of the ownership band reported by the registry (e.g. 25%). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMinShares() { + return Json.optional(json, "ownership_min_shares", Conv.STRING); + } + + /** + * Upper bound of the ownership band reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMaxShares() { + return Json.optional(json, "ownership_max_shares", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The kyc_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(KybListUbosResponse.KybRegistry.BeneficialOwners.KycStatus::of)); + } + + /** + * The kyc_session_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Parsed ownership percentage (max bound, falling back to min bound). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveOwnershipPercent() { + return Json.optional(json, "effective_ownership_percent", Conv.DOUBLE); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * The country_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryOfBirth() { + return Json.optional(json, "country_of_birth", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The designation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * The voting_min_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMinShares() { + return Json.optional(json, "voting_min_shares", Conv.STRING); + } + + /** + * The voting_max_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMaxShares() { + return Json.optional(json, "voting_max_shares", Conv.STRING); + } + + /** + * Complete birth date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Appointment date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shareholding() { + return Json.optional(json, "shareholding", Conv.model(KYBRegistryShareholding::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BeneficialOwners}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BeneficialOwners from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(KybListUbosResponse.KybRegistry.BeneficialOwners.EntityType entityType) { + return set("entity_type", Conv.enumeration(KybListUbosResponse.KybRegistry.BeneficialOwners.EntityType::of), entityType); + } + + /** + * Normalized roles (e.g. ubo, shareholder). + * + * @param roles the value + * @return this builder + */ + public Builder roles(List roles) { + return set("roles", Conv.list(Conv.STRING), roles); + } + + /** + * Lower bound of the ownership band reported by the registry (e.g. 25%). + * + * @param ownershipMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMinShares(@Nullable String ownershipMinShares) { + return setNullable("ownership_min_shares", Conv.STRING, ownershipMinShares); + } + + /** + * Upper bound of the ownership band reported by the registry. + * + * @param ownershipMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMaxShares(@Nullable String ownershipMaxShares) { + return setNullable("ownership_max_shares", Conv.STRING, ownershipMaxShares); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The kyc_status field. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(KybListUbosResponse.KybRegistry.BeneficialOwners.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(KybListUbosResponse.KybRegistry.BeneficialOwners.KycStatus::of), kycStatus); + } + + /** + * The kyc_session_url field. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Parsed ownership percentage (max bound, falling back to min bound). + * + * @param effectiveOwnershipPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveOwnershipPercent(@Nullable Double effectiveOwnershipPercent) { + return setNullable("effective_ownership_percent", Conv.DOUBLE, effectiveOwnershipPercent); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * The country_of_birth field. + * + * @param countryOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryOfBirth(@Nullable String countryOfBirth) { + return setNullable("country_of_birth", Conv.STRING, countryOfBirth); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The designation field. + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * The voting_min_shares field. + * + * @param votingMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMinShares(@Nullable String votingMinShares) { + return setNullable("voting_min_shares", Conv.STRING, votingMinShares); + } + + /** + * The voting_max_shares field. + * + * @param votingMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMaxShares(@Nullable String votingMaxShares) { + return setNullable("voting_max_shares", Conv.STRING, votingMaxShares); + } + + /** + * Complete birth date when reported. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Appointment date when reported. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @param shareholding the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder shareholding(@Nullable KYBRegistryShareholding shareholding) { + return setNullable("shareholding", Conv.model(KYBRegistryShareholding::fromJson), shareholding); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BeneficialOwners} + */ + public BeneficialOwners build() { + return new BeneficialOwners(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Same as the top-level registry_tier_delivered. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierDelivered BASIC = new RegistryTierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierDelivered SHAREHOLDERS = new RegistryTierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierDelivered UBO = new RegistryTierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), pending when the ownership section has not been retrieved from the registry yet and Didit is still completing it, not_requested on the Lite tier. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryOwnershipStatus extends StringEnum { + /** The value {@code "not_requested"}. */ + public static final RegistryOwnershipStatus NOT_REQUESTED = new RegistryOwnershipStatus("not_requested"); + + /** The value {@code "delivered"}. */ + public static final RegistryOwnershipStatus DELIVERED = new RegistryOwnershipStatus("delivered"); + + /** The value {@code "unavailable"}. */ + public static final RegistryOwnershipStatus UNAVAILABLE = new RegistryOwnershipStatus("unavailable"); + + /** The value {@code "pending"}. */ + public static final RegistryOwnershipStatus PENDING = new RegistryOwnershipStatus("pending"); + + private static final List KNOWN_VALUES = List.of(NOT_REQUESTED, DELIVERED, UNAVAILABLE, PENDING); + + private RegistryOwnershipStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryOwnershipStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryOwnershipStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/KybSearchParams.java b/src/main/java/me/didit/types/KybSearchParams.java new file mode 100644 index 0000000..1fc7cf8 --- /dev/null +++ b/src/main/java/me/didit/types/KybSearchParams.java @@ -0,0 +1,269 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code kyb.search}. */ +public final class KybSearchParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("country_code", "name", "registration_number", "search_type", "vendor_data", "metadata", "webhook_url"); + + private KybSearchParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybSearchParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybSearchParams fromJson(JsonNode json) { + return new KybSearchParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * ISO 3166-1 alpha-2 code of the country whose company registry to search. For example, GB. Where company registries operate at state or province level, append the ISO 3166-2 subdivision code as XX-YY: US-CA searches the California registry. United States searches always require the subdivision โ€” a bare US is rejected. Case-insensitive; normalized to upper case. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String countryCode() { + return Json.required(json, "country_code", Conv.STRING); + } + + /** + * Company name to search for. Either name or registration_number is required. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Registry registration number to search for. Either name or registration_number is required. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Name-matching strategy applied by the registry search. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional searchType() { + return Json.optional(json, "search_type", Conv.enumeration(KybSearchParams.SearchType::of)); + } + + /** + * Your identifier for this lookup; echoed back and included in the webhook callback. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Free-form JSON; echoed back and included in the webhook callback. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Switches the search to asynchronous mode: the API returns immediately and POSTs an unsigned kyb.registry_search.resolved callback to this URL when the candidate list is ready. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookUrl() { + return Json.optional(json, "webhook_url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybSearchParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybSearchParams from) { + super(from); + } + + /** + * ISO 3166-1 alpha-2 code of the country whose company registry to search. For example, GB. Where company registries operate at state or province level, append the ISO 3166-2 subdivision code as XX-YY: US-CA searches the California registry. United States searches always require the subdivision โ€” a bare US is rejected. Case-insensitive; normalized to upper case. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Company name to search for. Either name or registration_number is required. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Registry registration number to search for. Either name or registration_number is required. + * + * @param registrationNumber the value + * @return this builder + */ + public Builder registrationNumber(String registrationNumber) { + return set("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Name-matching strategy applied by the registry search. + * + * @param searchType the value + * @return this builder + */ + public Builder searchType(KybSearchParams.SearchType searchType) { + return set("search_type", Conv.enumeration(KybSearchParams.SearchType::of), searchType); + } + + /** + * Your identifier for this lookup; echoed back and included in the webhook callback. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Free-form JSON; echoed back and included in the webhook callback. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Switches the search to asynchronous mode: the API returns immediately and POSTs an unsigned kyb.registry_search.resolved callback to this URL when the candidate list is ready. + * + * @param webhookUrl the value + * @return this builder + */ + public Builder webhookUrl(String webhookUrl) { + return set("webhook_url", Conv.STRING, webhookUrl); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybSearchParams} + * @throws IllegalStateException when a required field is missing + */ + public KybSearchParams build() { + require("country_code", false); + return new KybSearchParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Name-matching strategy applied by the registry search. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SearchType extends StringEnum { + /** The value {@code "contains"}. */ + public static final SearchType CONTAINS = new SearchType("contains"); + + /** The value {@code "start_with"}. */ + public static final SearchType START_WITH = new SearchType("start_with"); + + /** The value {@code "fuzzy"}. */ + public static final SearchType FUZZY = new SearchType("fuzzy"); + + private static final List KNOWN_VALUES = List.of(CONTAINS, START_WITH, FUZZY); + + private SearchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SearchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SearchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/KybSearchResponse.java b/src/main/java/me/didit/types/KybSearchResponse.java new file mode 100644 index 0000000..1eea28c --- /dev/null +++ b/src/main/java/me/didit/types/KybSearchResponse.java @@ -0,0 +1,699 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class KybSearchResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "kyb_registry", "vendor_data", "metadata", "created_at"); + + private KybSearchResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybSearchResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybSearchResponse fromJson(JsonNode json) { + return new KybSearchResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * With webhook_url: the persisted search-request id, echoed as request_id in the kyb.registry_search.resolved callback. Without webhook_url: a transient correlation UUID (the search is not stored). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The kyb_registry field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybRegistry() { + return Json.optional(json, "kyb_registry", Conv.model(KybSearchResponse.KybRegistry::fromJson)); + } + + /** + * Echo of the vendor_data you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybSearchResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybSearchResponse from) { + super(from); + } + + /** + * With webhook_url: the persisted search-request id, echoed as request_id in the kyb.registry_search.resolved callback. Without webhook_url: a transient correlation UUID (the search is not stored). + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The kyb_registry field. + * + * @param kybRegistry the value + * @return this builder + */ + public Builder kybRegistry(KybSearchResponse.KybRegistry kybRegistry) { + return set("kyb_registry", Conv.model(KybSearchResponse.KybRegistry::fromJson), kybRegistry); + } + + /** + * Echo of the vendor_data you sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybSearchResponse} + */ + public KybSearchResponse build() { + return new KybSearchResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class KybRegistry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("companies", "pagination", "search_status", "search_resolved"); + + private KybRegistry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybRegistry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybRegistry fromJson(JsonNode json) { + return new KybRegistry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Deduplicated candidate list. Empty while search_resolved=false (webhook mode) or when nothing matched. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> companies() { + return Json.optional(json, "companies", Conv.list(Conv.model(KybSearchResponse.KybRegistry.Companies::fromJson))); + } + + /** + * The pagination field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pagination() { + return Json.optional(json, "pagination", Conv.model(KybSearchResponse.KybRegistry.Pagination::fromJson)); + } + + /** + * Registry search lifecycle status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional searchStatus() { + return Json.optional(json, "search_status", Conv.enumeration(KybSearchResponse.KybRegistry.SearchStatus::of)); + } + + /** + * true once the candidate list is final. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional searchResolved() { + return Json.optional(json, "search_resolved", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybRegistry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybRegistry from) { + super(from); + } + + /** + * Deduplicated candidate list. Empty while search_resolved=false (webhook mode) or when nothing matched. + * + * @param companies the value + * @return this builder + */ + public Builder companies(List companies) { + return set("companies", Conv.list(Conv.model(KybSearchResponse.KybRegistry.Companies::fromJson)), companies); + } + + /** + * The pagination field. + * + * @param pagination the value + * @return this builder + */ + public Builder pagination(KybSearchResponse.KybRegistry.Pagination pagination) { + return set("pagination", Conv.model(KybSearchResponse.KybRegistry.Pagination::fromJson), pagination); + } + + /** + * Registry search lifecycle status. + * + * @param searchStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder searchStatus(KybSearchResponse.KybRegistry.@Nullable SearchStatus searchStatus) { + return setNullable("search_status", Conv.enumeration(KybSearchResponse.KybRegistry.SearchStatus::of), searchStatus); + } + + /** + * true once the candidate list is final. + * + * @param searchResolved the value + * @return this builder + */ + public Builder searchResolved(boolean searchResolved) { + return set("search_resolved", Conv.BOOLEAN, searchResolved); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybRegistry} + */ + public KybRegistry build() { + return new KybRegistry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Companies extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("kyb_response_id", "name", "registration_number", "status", "type", "risk_level", "fetch_status"); + + private Companies(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Companies} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Companies fromJson(JsonNode json) { + return new Companies(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Handle for this candidate โ€” pass it to POST /v3/kyb/select/ to retrieve the full profile. Ephemeral and scoped to this search: do not store it long-term; re-search to get a fresh one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybResponseId() { + return Json.optional(json, "kyb_response_id", Conv.STRING); + } + + /** + * Registered company name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Registry registration number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Normalized registry status of the company (e.g. active, dissolved, inactive, struck off). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Legal form as reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * Registry-reported risk level, when available. Usually null at search time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * Always pending for search candidates โ€” the full company profile is only fetched (and billed) when you select the candidate. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fetchStatus() { + return Json.optional(json, "fetch_status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Companies}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Companies from) { + super(from); + } + + /** + * Handle for this candidate โ€” pass it to POST /v3/kyb/select/ to retrieve the full profile. Ephemeral and scoped to this search: do not store it long-term; re-search to get a fresh one. + * + * @param kybResponseId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kybResponseId(@Nullable String kybResponseId) { + return setNullable("kyb_response_id", Conv.STRING, kybResponseId); + } + + /** + * Registered company name. + * + * @param name the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder name(@Nullable String name) { + return setNullable("name", Conv.STRING, name); + } + + /** + * Registry registration number. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Normalized registry status of the company (e.g. active, dissolved, inactive, struck off). + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * Legal form as reported by the registry. + * + * @param type the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder type(@Nullable String type) { + return setNullable("type", Conv.STRING, type); + } + + /** + * Registry-reported risk level, when available. Usually null at search time. + * + * @param riskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskLevel(@Nullable String riskLevel) { + return setNullable("risk_level", Conv.STRING, riskLevel); + } + + /** + * Always pending for search candidates โ€” the full company profile is only fetched (and billed) when you select the candidate. + * + * @param fetchStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fetchStatus(@Nullable String fetchStatus) { + return setNullable("fetch_status", Conv.STRING, fetchStatus); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Companies} + */ + public Companies build() { + return new Companies(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Pagination extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total", "page", "per_page"); + + private Pagination(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Pagination} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Pagination fromJson(JsonNode json) { + return new Pagination(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of candidates returned. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The page field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional page() { + return Json.optional(json, "page", Conv.LONG); + } + + /** + * The per_page field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional perPage() { + return Json.optional(json, "per_page", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Pagination}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Pagination from) { + super(from); + } + + /** + * Number of candidates returned. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The page field. + * + * @param page the value + * @return this builder + */ + public Builder page(long page) { + return set("page", Conv.LONG, page); + } + + /** + * The per_page field. + * + * @param perPage the value + * @return this builder + */ + public Builder perPage(long perPage) { + return set("per_page", Conv.LONG, perPage); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Pagination} + */ + public Pagination build() { + return new Pagination(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Registry search lifecycle status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SearchStatus extends StringEnum { + /** The value {@code "pending"}. */ + public static final SearchStatus PENDING = new SearchStatus("pending"); + + /** The value {@code "resolved"}. */ + public static final SearchStatus RESOLVED = new SearchStatus("resolved"); + + private static final List KNOWN_VALUES = List.of(PENDING, RESOLVED); + + private SearchStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SearchStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SearchStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/KybSelectParams.java b/src/main/java/me/didit/types/KybSelectParams.java new file mode 100644 index 0000000..2c11159 --- /dev/null +++ b/src/main/java/me/didit/types/KybSelectParams.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code kyb.select}. */ +public final class KybSelectParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("kyb_response_id", "vendor_data", "metadata", "save_api_request"); + + private KybSelectParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybSelectParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybSelectParams fromJson(JsonNode json) { + return new KybSelectParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Candidate handle from POST /v3/kyb/search/ (kyb_registry.companies[].kyb_response_id). Ephemeral โ€” use it shortly after the search that produced it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String kybResponseId() { + return Json.required(json, "kyb_response_id", Conv.STRING); + } + + /** + * Your identifier for this company; echoed back and stored with the business session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Free-form JSON stored with the business session and echoed back. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Must be true (the default). KYB registry selects are always persisted so billing and retrieval can be tracked; false returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybSelectParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybSelectParams from) { + super(from); + } + + /** + * Candidate handle from POST /v3/kyb/search/ (kyb_registry.companies[].kyb_response_id). Ephemeral โ€” use it shortly after the search that produced it. + * + * @param kybResponseId the value + * @return this builder + */ + public Builder kybResponseId(String kybResponseId) { + return set("kyb_response_id", Conv.STRING, kybResponseId); + } + + /** + * Your identifier for this company; echoed back and stored with the business session. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Free-form JSON stored with the business session and echoed back. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Must be true (the default). KYB registry selects are always persisted so billing and retrieval can be tracked; false returns 400. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybSelectParams} + * @throws IllegalStateException when a required field is missing + */ + public KybSelectParams build() { + require("kyb_response_id", false); + return new KybSelectParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/KybSelectResponse.java b/src/main/java/me/didit/types/KybSelectResponse.java new file mode 100644 index 0000000..9abae2e --- /dev/null +++ b/src/main/java/me/didit/types/KybSelectResponse.java @@ -0,0 +1,2868 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class KybSelectResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "registry_tier_requested", "registry_tier_delivered", "kyb_registry", "vendor_data", "metadata", "created_at"); + + private KybSelectResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybSelectResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybSelectResponse fromJson(JsonNode json) { + return new KybSelectResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the business session created for this retrieval. The stored record (visible in the console) keeps updating if the registry resolves after the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierRequested() { + return Json.optional(json, "registry_tier_requested", Conv.enumeration(KybSelectResponse.RegistryTierRequested::of)); + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, or the registry has no ownership record for this company. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.enumeration(KybSelectResponse.RegistryTierDelivered::of)); + } + + /** + * Full registry company profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybRegistry() { + return Json.optional(json, "kyb_registry", Conv.model(KybSelectResponse.KybRegistry::fromJson)); + } + + /** + * Echo of the vendor_data you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybSelectResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybSelectResponse from) { + super(from); + } + + /** + * Id of the business session created for this retrieval. The stored record (visible in the console) keeps updating if the registry resolves after the response. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + * @param registryTierRequested the value + * @return this builder + */ + public Builder registryTierRequested(KybSelectResponse.RegistryTierRequested registryTierRequested) { + return set("registry_tier_requested", Conv.enumeration(KybSelectResponse.RegistryTierRequested::of), registryTierRequested); + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, or the registry has no ownership record for this company. + * + * @param registryTierDelivered the value + * @return this builder + */ + public Builder registryTierDelivered(KybSelectResponse.RegistryTierDelivered registryTierDelivered) { + return set("registry_tier_delivered", Conv.enumeration(KybSelectResponse.RegistryTierDelivered::of), registryTierDelivered); + } + + /** + * Full registry company profile. + * + * @param kybRegistry the value + * @return this builder + */ + public Builder kybRegistry(KybSelectResponse.KybRegistry kybRegistry) { + return set("kyb_registry", Conv.model(KybSelectResponse.KybRegistry::fromJson), kybRegistry); + } + + /** + * Echo of the vendor_data you sent. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybSelectResponse} + */ + public KybSelectResponse build() { + return new KybSelectResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The tier this endpoint sells: basic (Lite) for select, shareholders, ubo. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierRequested extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierRequested BASIC = new RegistryTierRequested("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierRequested SHAREHOLDERS = new RegistryTierRequested("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierRequested UBO = new RegistryTierRequested("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierRequested(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierRequested of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierRequested::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The tier actually delivered and billed. Lower than requested when the country's registries hold no ownership data, or the registry has no ownership record for this company. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierDelivered BASIC = new RegistryTierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierDelivered SHAREHOLDERS = new RegistryTierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierDelivered UBO = new RegistryTierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Full registry company profile. */ + public static final class KybRegistry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "node_id", "status", "registry_status", "data_resolved", "company_name", "registration_number", "country_code", "region", "company_type", "incorporation_date", "registered_address", "tax_number", "risk_level", "verification_status", "is_from_registry", "fetch_status", "alternative_names", "nature_of_business", "registered_capital", "registered_capital_amount", "registered_capital_currency", "website", "email", "phone", "legal_entity_identifier", "location_of_registration", "vat_number", "vat_validation_status", "vat_validated_number", "vat_validation_source", "vat_validated_name", "vat_validated_address", "vat_checked_at", "financial_summary", "officers", "beneficial_owners", "addresses", "industries", "accounts", "registry_data", "user_provided_data", "confirmed_by_user_at", "last_console_edit_at", "is_editable", "registry_tier_delivered", "registry_ownership_status", "ownership", "registry_tier"); + + private KybRegistry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KybRegistry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KybRegistry fromJson(JsonNode json) { + return new KybRegistry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's id for this company record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(KybSelectResponse.KybRegistry.Status::of)); + } + + /** + * Normalized company status as reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryStatus() { + return Json.optional(json, "registry_status", Conv.enumeration(KybSelectResponse.KybRegistry.RegistryStatus::of)); + } + + /** + * true once the registry returned the full profile. false when the registry was still processing after polling โ€” the stored record completes automatically once the registry resolves. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataResolved() { + return Json.optional(json, "data_resolved", Conv.BOOLEAN); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Subdivision code when the registry is regional (e.g. CA for US-CA); empty otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The company_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyType() { + return Json.optional(json, "company_type", Conv.STRING); + } + + /** + * The incorporation_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional incorporationDate() { + return Json.optional(json, "incorporation_date", Conv.DATE); + } + + /** + * The registered_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredAddress() { + return Json.optional(json, "registered_address", Conv.STRING); + } + + /** + * The tax_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * Registry-reported risk level, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * Registry verification status, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationStatus() { + return Json.optional(json, "verification_status", Conv.STRING); + } + + /** + * Always true for this endpoint โ€” the profile was retrieved from an official registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFromRegistry() { + return Json.optional(json, "is_from_registry", Conv.BOOLEAN); + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fetchStatus() { + return Json.optional(json, "fetch_status", Conv.enumeration(KybSelectResponse.KybRegistry.FetchStatus::of)); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alternativeNames() { + return Json.optional(json, "alternative_names", Conv.STRING); + } + + /** + * Activity description or classification code, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional natureOfBusiness() { + return Json.optional(json, "nature_of_business", Conv.STRING); + } + + /** + * The registered_capital field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapital() { + return Json.optional(json, "registered_capital", Conv.STRING); + } + + /** + * Decimal amount as a string, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalAmount() { + return Json.optional(json, "registered_capital_amount", Conv.STRING); + } + + /** + * ISO 4217 code, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalCurrency() { + return Json.optional(json, "registered_capital_currency", Conv.STRING); + } + + /** + * The website field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The phone field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * LEI, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalEntityIdentifier() { + return Json.optional(json, "legal_entity_identifier", Conv.STRING); + } + + /** + * Registry/jurisdiction the company is registered with, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationOfRegistration() { + return Json.optional(json, "location_of_registration", Conv.STRING); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. At select time this is typically not yet set โ€” VAT and tax ID validation runs when the end user submits the registry step in the hosted flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatNumber() { + return Json.optional(json, "vat_number", Conv.STRING); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationStatus() { + return Json.optional(json, "vat_validation_status", Conv.enumeration(KybSelectResponse.KybRegistry.VatValidationStatus::of)); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedNumber() { + return Json.optional(json, "vat_validated_number", Conv.STRING); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationSource() { + return Json.optional(json, "vat_validation_source", Conv.enumeration(KybSelectResponse.KybRegistry.VatValidationSource::of)); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedName() { + return Json.optional(json, "vat_validated_name", Conv.STRING); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedAddress() { + return Json.optional(json, "vat_validated_address", Conv.STRING); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatCheckedAt() { + return Json.optional(json, "vat_checked_at", Conv.DATE_TIME); + } + + /** + * Registry-reported share/capital details (currency, total shares, share classes), when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> financialSummary() { + return Json.optional(json, "financial_summary", Conv.OBJECT); + } + + /** + * Directors, secretaries, and other officers extracted from the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> officers() { + return Json.optional(json, "officers", Conv.list(Conv.model(KybSelectResponse.KybRegistry.Officers::fromJson))); + } + + /** + * Beneficial owners / persons with significant control extracted from the registry. Can be empty when the registry does not expose ownership. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficialOwners() { + return Json.optional(json, "beneficial_owners", Conv.list(Conv.model(KybSelectResponse.KybRegistry.BeneficialOwners::fromJson))); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> addresses() { + return Json.optional(json, "addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson))); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> industries() { + return Json.optional(json, "industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson))); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> accounts() { + return Json.optional(json, "accounts", Conv.OBJECT); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registryData() { + return Json.optional(json, "registry_data", Conv.OBJECT); + } + + /** + * Always null on this endpoint (used by the hosted KYB flow when end users edit registry data). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> userProvidedData() { + return Json.optional(json, "user_provided_data", Conv.OBJECT); + } + + /** + * Always null on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmedByUserAt() { + return Json.optional(json, "confirmed_by_user_at", Conv.DATE_TIME); + } + + /** + * Set when a console reviewer edits the record later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastConsoleEditAt() { + return Json.optional(json, "last_console_edit_at", Conv.DATE_TIME); + } + + /** + * Whether the registry-sourced data can still be edited in the hosted flow/console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + /** + * Same as the top-level registry_tier_delivered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.enumeration(KybSelectResponse.KybRegistry.RegistryTierDelivered::of)); + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), not_requested on the Lite tier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryOwnershipStatus() { + return Json.optional(json, "registry_ownership_status", Conv.enumeration(KybSelectResponse.KybRegistry.RegistryOwnershipStatus::of)); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownership() { + return Json.optional(json, "ownership", Conv.model(KYBRegistryOwnership::fromJson)); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTier() { + return Json.optional(json, "registry_tier", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KybRegistry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KybRegistry from) { + super(from); + } + + /** + * Didit's id for this company record. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The node_id field. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + * @param status the value + * @return this builder + */ + public Builder status(KybSelectResponse.KybRegistry.Status status) { + return set("status", Conv.enumeration(KybSelectResponse.KybRegistry.Status::of), status); + } + + /** + * Normalized company status as reported by the registry. + * + * @param registryStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryStatus(KybSelectResponse.KybRegistry.@Nullable RegistryStatus registryStatus) { + return setNullable("registry_status", Conv.enumeration(KybSelectResponse.KybRegistry.RegistryStatus::of), registryStatus); + } + + /** + * true once the registry returned the full profile. false when the registry was still processing after polling โ€” the stored record completes automatically once the registry resolves. + * + * @param dataResolved the value + * @return this builder + */ + public Builder dataResolved(boolean dataResolved) { + return set("data_resolved", Conv.BOOLEAN, dataResolved); + } + + /** + * The company_name field. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * ISO 3166-1 alpha-2. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Subdivision code when the registry is regional (e.g. CA for US-CA); empty otherwise. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The company_type field. + * + * @param companyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyType(@Nullable String companyType) { + return setNullable("company_type", Conv.STRING, companyType); + } + + /** + * The incorporation_date field. + * + * @param incorporationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder incorporationDate(@Nullable LocalDate incorporationDate) { + return setNullable("incorporation_date", Conv.DATE, incorporationDate); + } + + /** + * The registered_address field. + * + * @param registeredAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredAddress(@Nullable String registeredAddress) { + return setNullable("registered_address", Conv.STRING, registeredAddress); + } + + /** + * The tax_number field. + * + * @param taxNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder taxNumber(@Nullable String taxNumber) { + return setNullable("tax_number", Conv.STRING, taxNumber); + } + + /** + * Registry-reported risk level, when available. + * + * @param riskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskLevel(@Nullable String riskLevel) { + return setNullable("risk_level", Conv.STRING, riskLevel); + } + + /** + * Registry verification status, when available. + * + * @param verificationStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationStatus(@Nullable String verificationStatus) { + return setNullable("verification_status", Conv.STRING, verificationStatus); + } + + /** + * Always true for this endpoint โ€” the profile was retrieved from an official registry. + * + * @param isFromRegistry the value + * @return this builder + */ + public Builder isFromRegistry(boolean isFromRegistry) { + return set("is_from_registry", Conv.BOOLEAN, isFromRegistry); + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + * @param fetchStatus the value + * @return this builder + */ + public Builder fetchStatus(KybSelectResponse.KybRegistry.FetchStatus fetchStatus) { + return set("fetch_status", Conv.enumeration(KybSelectResponse.KybRegistry.FetchStatus::of), fetchStatus); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @param alternativeNames the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder alternativeNames(@Nullable String alternativeNames) { + return setNullable("alternative_names", Conv.STRING, alternativeNames); + } + + /** + * Activity description or classification code, when reported. + * + * @param natureOfBusiness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder natureOfBusiness(@Nullable String natureOfBusiness) { + return setNullable("nature_of_business", Conv.STRING, natureOfBusiness); + } + + /** + * The registered_capital field. + * + * @param registeredCapital the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapital(@Nullable String registeredCapital) { + return setNullable("registered_capital", Conv.STRING, registeredCapital); + } + + /** + * Decimal amount as a string, when reported. + * + * @param registeredCapitalAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalAmount(@Nullable String registeredCapitalAmount) { + return setNullable("registered_capital_amount", Conv.STRING, registeredCapitalAmount); + } + + /** + * ISO 4217 code, when reported. + * + * @param registeredCapitalCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalCurrency(@Nullable String registeredCapitalCurrency) { + return setNullable("registered_capital_currency", Conv.STRING, registeredCapitalCurrency); + } + + /** + * The website field. + * + * @param website the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder website(@Nullable String website) { + return setNullable("website", Conv.STRING, website); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The phone field. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(@Nullable String phone) { + return setNullable("phone", Conv.STRING, phone); + } + + /** + * LEI, when reported. + * + * @param legalEntityIdentifier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalEntityIdentifier(@Nullable String legalEntityIdentifier) { + return setNullable("legal_entity_identifier", Conv.STRING, legalEntityIdentifier); + } + + /** + * Registry/jurisdiction the company is registered with, when reported. + * + * @param locationOfRegistration the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder locationOfRegistration(@Nullable String locationOfRegistration) { + return setNullable("location_of_registration", Conv.STRING, locationOfRegistration); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. At select time this is typically not yet set โ€” VAT and tax ID validation runs when the end user submits the registry step in the hosted flow. + * + * @param vatNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatNumber(@Nullable String vatNumber) { + return setNullable("vat_number", Conv.STRING, vatNumber); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @param vatValidationStatus the value + * @return this builder + */ + public Builder vatValidationStatus(KybSelectResponse.KybRegistry.VatValidationStatus vatValidationStatus) { + return set("vat_validation_status", Conv.enumeration(KybSelectResponse.KybRegistry.VatValidationStatus::of), vatValidationStatus); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @param vatValidatedNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedNumber(@Nullable String vatValidatedNumber) { + return setNullable("vat_validated_number", Conv.STRING, vatValidatedNumber); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @param vatValidationSource the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidationSource(KybSelectResponse.KybRegistry.@Nullable VatValidationSource vatValidationSource) { + return setNullable("vat_validation_source", Conv.enumeration(KybSelectResponse.KybRegistry.VatValidationSource::of), vatValidationSource); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedName(@Nullable String vatValidatedName) { + return setNullable("vat_validated_name", Conv.STRING, vatValidatedName); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedAddress(@Nullable String vatValidatedAddress) { + return setNullable("vat_validated_address", Conv.STRING, vatValidatedAddress); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @param vatCheckedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatCheckedAt(@Nullable OffsetDateTime vatCheckedAt) { + return setNullable("vat_checked_at", Conv.DATE_TIME, vatCheckedAt); + } + + /** + * Registry-reported share/capital details (currency, total shares, share classes), when available. + * + * @param financialSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder financialSummary(@Nullable Map financialSummary) { + return setAny("financial_summary", financialSummary); + } + + /** + * Directors, secretaries, and other officers extracted from the registry. + * + * @param officers the value + * @return this builder + */ + public Builder officers(List officers) { + return set("officers", Conv.list(Conv.model(KybSelectResponse.KybRegistry.Officers::fromJson)), officers); + } + + /** + * Beneficial owners / persons with significant control extracted from the registry. Can be empty when the registry does not expose ownership. + * + * @param beneficialOwners the value + * @return this builder + */ + public Builder beneficialOwners(List beneficialOwners) { + return set("beneficial_owners", Conv.list(Conv.model(KybSelectResponse.KybRegistry.BeneficialOwners::fromJson)), beneficialOwners); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @param addresses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addresses(@Nullable List addresses) { + return setNullable("addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson)), addresses); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @param industries the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder industries(@Nullable List industries) { + return setNullable("industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson)), industries); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @param accounts the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder accounts(@Nullable Map accounts) { + return setAny("accounts", accounts); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @param registryData the value + * @return this builder + */ + public Builder registryData(Map registryData) { + return setAny("registry_data", registryData); + } + + /** + * Always null on this endpoint (used by the hosted KYB flow when end users edit registry data). + * + * @param userProvidedData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userProvidedData(@Nullable Map userProvidedData) { + return setAny("user_provided_data", userProvidedData); + } + + /** + * Always null on this endpoint. + * + * @param confirmedByUserAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder confirmedByUserAt(@Nullable OffsetDateTime confirmedByUserAt) { + return setNullable("confirmed_by_user_at", Conv.DATE_TIME, confirmedByUserAt); + } + + /** + * Set when a console reviewer edits the record later. + * + * @param lastConsoleEditAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastConsoleEditAt(@Nullable OffsetDateTime lastConsoleEditAt) { + return setNullable("last_console_edit_at", Conv.DATE_TIME, lastConsoleEditAt); + } + + /** + * Whether the registry-sourced data can still be edited in the hosted flow/console. + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Same as the top-level registry_tier_delivered. + * + * @param registryTierDelivered the value + * @return this builder + */ + public Builder registryTierDelivered(KybSelectResponse.KybRegistry.RegistryTierDelivered registryTierDelivered) { + return set("registry_tier_delivered", Conv.enumeration(KybSelectResponse.KybRegistry.RegistryTierDelivered::of), registryTierDelivered); + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), not_requested on the Lite tier. + * + * @param registryOwnershipStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryOwnershipStatus(KybSelectResponse.KybRegistry.@Nullable RegistryOwnershipStatus registryOwnershipStatus) { + return setNullable("registry_ownership_status", Conv.enumeration(KybSelectResponse.KybRegistry.RegistryOwnershipStatus::of), registryOwnershipStatus); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @param ownership the value + * @return this builder + */ + public Builder ownership(KYBRegistryOwnership ownership) { + return set("ownership", Conv.model(KYBRegistryOwnership::fromJson), ownership); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @param registryTier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTier(@Nullable String registryTier) { + return setNullable("registry_tier", Conv.STRING, registryTier); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KybRegistry} + */ + public KybRegistry build() { + return new KybRegistry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Didit's assessment of the registry check (e.g. In Review when the company is not active in the registry or ownership data could not be derived). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Normalized company status as reported by the registry. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryStatus extends StringEnum { + /** The value {@code "active"}. */ + public static final RegistryStatus ACTIVE = new RegistryStatus("active"); + + /** The value {@code "dissolved"}. */ + public static final RegistryStatus DISSOLVED = new RegistryStatus("dissolved"); + + /** The value {@code "deregistered"}. */ + public static final RegistryStatus DEREGISTERED = new RegistryStatus("deregistered"); + + /** The value {@code "see full details"}. */ + public static final RegistryStatus SEE_FULL_DETAILS = new RegistryStatus("see full details"); + + /** The value {@code "authorised"}. */ + public static final RegistryStatus AUTHORISED = new RegistryStatus("authorised"); + + /** The value {@code "appointed representative"}. */ + public static final RegistryStatus APPOINTED_REPRESENTATIVE = new RegistryStatus("appointed representative"); + + /** The value {@code "unauthorised"}. */ + public static final RegistryStatus UNAUTHORISED = new RegistryStatus("unauthorised"); + + /** The value {@code "inactive"}. */ + public static final RegistryStatus INACTIVE = new RegistryStatus("inactive"); + + /** The value {@code "no longer authorised"}. */ + public static final RegistryStatus NO_LONGER_AUTHORISED = new RegistryStatus("no longer authorised"); + + /** The value {@code "closed"}. */ + public static final RegistryStatus CLOSED = new RegistryStatus("closed"); + + /** The value {@code "struck off"}. */ + public static final RegistryStatus STRUCK_OFF = new RegistryStatus("struck off"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISSOLVED, DEREGISTERED, SEE_FULL_DETAILS, AUTHORISED, APPOINTED_REPRESENTATIVE, UNAUTHORISED, INACTIVE, NO_LONGER_AUTHORISED, CLOSED, STRUCK_OFF); + + private RegistryStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Registry fetch lifecycle. Mirrored by data_resolved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class FetchStatus extends StringEnum { + /** The value {@code "pending"}. */ + public static final FetchStatus PENDING = new FetchStatus("pending"); + + /** The value {@code "resolved"}. */ + public static final FetchStatus RESOLVED = new FetchStatus("resolved"); + + private static final List KNOWN_VALUES = List.of(PENDING, RESOLVED); + + private FetchStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FetchStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FetchStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationStatus extends StringEnum { + /** The value {@code "valid"}. */ + public static final VatValidationStatus VALID = new VatValidationStatus("valid"); + + /** The value {@code "invalid"}. */ + public static final VatValidationStatus INVALID = new VatValidationStatus("invalid"); + + /** The value {@code "format_valid"}. */ + public static final VatValidationStatus FORMAT_VALID = new VatValidationStatus("format_valid"); + + /** The value {@code "invalid_format"}. */ + public static final VatValidationStatus INVALID_FORMAT = new VatValidationStatus("invalid_format"); + + /** The value {@code "could_not_validate"}. */ + public static final VatValidationStatus COULD_NOT_VALIDATE = new VatValidationStatus("could_not_validate"); + + /** The value {@code "not_applicable"}. */ + public static final VatValidationStatus NOT_APPLICABLE = new VatValidationStatus("not_applicable"); + + private static final List KNOWN_VALUES = List.of(VALID, INVALID, FORMAT_VALID, INVALID_FORMAT, COULD_NOT_VALIDATE, NOT_APPLICABLE); + + private VatValidationStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationSource extends StringEnum { + /** The value {@code "eu_vies"}. */ + public static final VatValidationSource EU_VIES = new VatValidationSource("eu_vies"); + + /** The value {@code "pl_vat_white_list"}. */ + public static final VatValidationSource PL_VAT_WHITE_LIST = new VatValidationSource("pl_vat_white_list"); + + /** The value {@code "no_brreg"}. */ + public static final VatValidationSource NO_BRREG = new VatValidationSource("no_brreg"); + + /** The value {@code "ch_uid_register"}. */ + public static final VatValidationSource CH_UID_REGISTER = new VatValidationSource("ch_uid_register"); + + /** The value {@code "br_receita_federal"}. */ + public static final VatValidationSource BR_RECEITA_FEDERAL = new VatValidationSource("br_receita_federal"); + + /** The value {@code "co_rues"}. */ + public static final VatValidationSource CO_RUES = new VatValidationSource("co_rues"); + + /** The value {@code "cr_hacienda"}. */ + public static final VatValidationSource CR_HACIENDA = new VatValidationSource("cr_hacienda"); + + /** The value {@code "ec_sri"}. */ + public static final VatValidationSource EC_SRI = new VatValidationSource("ec_sri"); + + /** The value {@code "py_dnit"}. */ + public static final VatValidationSource PY_DNIT = new VatValidationSource("py_dnit"); + + /** The value {@code "format_rules"}. */ + public static final VatValidationSource FORMAT_RULES = new VatValidationSource("format_rules"); + + private static final List KNOWN_VALUES = List.of(EU_VIES, PL_VAT_WHITE_LIST, NO_BRREG, CH_UID_REGISTER, BR_RECEITA_FEDERAL, CO_RUES, CR_HACIENDA, EC_SRI, PY_DNIT, FORMAT_RULES); + + private VatValidationSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Officers extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "designation", "role", "nationality", "is_active", "kyc_status", "kyc_session_url", "first_name", "last_name", "address", "appointment_date", "termination_date", "date_of_birth", "date_of_birth_year", "date_of_birth_month"); + + private Officers(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Officers} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Officers fromJson(JsonNode json) { + return new Officers(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Raw registry designation (e.g. Director, Secretary). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(KybSelectResponse.KybRegistry.Officers.Role::of)); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * false when the registry marks the appointment as resigned. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(KybSelectResponse.KybRegistry.Officers.KycStatus::of)); + } + + /** + * Verification URL of the associated KYC session, when one exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name when explicitly reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Officer address reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Date the officer was appointed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * Date the appointment ended, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional terminationDate() { + return Json.optional(json, "termination_date", Conv.DATE); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthYear() { + return Json.optional(json, "date_of_birth_year", Conv.LONG); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthMonth() { + return Json.optional(json, "date_of_birth_month", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Officers}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Officers from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Raw registry designation (e.g. Director, Secretary). + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + * @param role the value + * @return this builder + */ + public Builder role(KybSelectResponse.KybRegistry.Officers.Role role) { + return set("role", Conv.enumeration(KybSelectResponse.KybRegistry.Officers.Role::of), role); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * false when the registry marks the appointment as resigned. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(KybSelectResponse.KybRegistry.Officers.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(KybSelectResponse.KybRegistry.Officers.KycStatus::of), kycStatus); + } + + /** + * Verification URL of the associated KYC session, when one exists. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name when explicitly reported by the registry. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Officer address reported by the registry. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Date the officer was appointed. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * Date the appointment ended, when reported. + * + * @param terminationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder terminationDate(@Nullable LocalDate terminationDate) { + return setNullable("termination_date", Conv.DATE, terminationDate); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @param dateOfBirthYear the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthYear(@Nullable Long dateOfBirthYear) { + return setNullable("date_of_birth_year", Conv.LONG, dateOfBirthYear); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @param dateOfBirthMonth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthMonth(@Nullable Long dateOfBirthMonth) { + return setNullable("date_of_birth_month", Conv.LONG, dateOfBirthMonth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Officers} + */ + public Officers build() { + return new Officers(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Normalized role derived from the designation. Full 17-value model set; registry parsing on this endpoint typically emits director, non_executive_director, secretary, chairman, or company_officer. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "director"}. */ + public static final Role DIRECTOR = new Role("director"); + + /** The value {@code "non_executive_director"}. */ + public static final Role NON_EXECUTIVE_DIRECTOR = new Role("non_executive_director"); + + /** The value {@code "secretary"}. */ + public static final Role SECRETARY = new Role("secretary"); + + /** The value {@code "chairman"}. */ + public static final Role CHAIRMAN = new Role("chairman"); + + /** The value {@code "ubo"}. */ + public static final Role UBO = new Role("ubo"); + + /** The value {@code "shareholder"}. */ + public static final Role SHAREHOLDER = new Role("shareholder"); + + /** The value {@code "representative"}. */ + public static final Role REPRESENTATIVE = new Role("representative"); + + /** The value {@code "founder"}. */ + public static final Role FOUNDER = new Role("founder"); + + /** The value {@code "legal_advisor"}. */ + public static final Role LEGAL_ADVISOR = new Role("legal_advisor"); + + /** The value {@code "authorized_signatory"}. */ + public static final Role AUTHORIZED_SIGNATORY = new Role("authorized_signatory"); + + /** The value {@code "trustee"}. */ + public static final Role TRUSTEE = new Role("trustee"); + + /** The value {@code "beneficiary"}. */ + public static final Role BENEFICIARY = new Role("beneficiary"); + + /** The value {@code "company_officer"}. */ + public static final Role COMPANY_OFFICER = new Role("company_officer"); + + /** The value {@code "settlor"}. */ + public static final Role SETTLOR = new Role("settlor"); + + /** The value {@code "protector"}. */ + public static final Role PROTECTOR = new Role("protector"); + + /** The value {@code "investor"}. */ + public static final Role INVESTOR = new Role("investor"); + + /** The value {@code "other"}. */ + public static final Role OTHER = new Role("other"); + + private static final List KNOWN_VALUES = List.of(DIRECTOR, NON_EXECUTIVE_DIRECTOR, SECRETARY, CHAIRMAN, UBO, SHAREHOLDER, REPRESENTATIVE, FOUNDER, LEGAL_ADVISOR, AUTHORIZED_SIGNATORY, TRUSTEE, BENEFICIARY, COMPANY_OFFICER, SETTLOR, PROTECTOR, INVESTOR, OTHER); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status of an associated KYC session, when one was started for this officer. null otherwise. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class BeneficialOwners extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "first_name", "last_name", "entity_type", "roles", "ownership_min_shares", "ownership_max_shares", "is_active", "kyc_status", "kyc_session_url", "effective_ownership_percent", "company_name", "registration_number", "country_of_birth", "email", "nationality", "designation", "voting_min_shares", "voting_max_shares", "date_of_birth", "appointment_date", "shareholding"); + + private BeneficialOwners(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BeneficialOwners} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BeneficialOwners fromJson(JsonNode json) { + return new BeneficialOwners(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(KybSelectResponse.KybRegistry.BeneficialOwners.EntityType::of)); + } + + /** + * Normalized roles (e.g. ubo, shareholder). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> roles() { + return Json.optional(json, "roles", Conv.list(Conv.STRING)); + } + + /** + * Lower bound of the ownership band reported by the registry (e.g. 25%). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMinShares() { + return Json.optional(json, "ownership_min_shares", Conv.STRING); + } + + /** + * Upper bound of the ownership band reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMaxShares() { + return Json.optional(json, "ownership_max_shares", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The kyc_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(KybSelectResponse.KybRegistry.BeneficialOwners.KycStatus::of)); + } + + /** + * The kyc_session_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Parsed ownership percentage (max bound, falling back to min bound). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveOwnershipPercent() { + return Json.optional(json, "effective_ownership_percent", Conv.DOUBLE); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * The country_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryOfBirth() { + return Json.optional(json, "country_of_birth", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The designation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * The voting_min_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMinShares() { + return Json.optional(json, "voting_min_shares", Conv.STRING); + } + + /** + * The voting_max_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMaxShares() { + return Json.optional(json, "voting_max_shares", Conv.STRING); + } + + /** + * Complete birth date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Appointment date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shareholding() { + return Json.optional(json, "shareholding", Conv.model(KYBRegistryShareholding::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BeneficialOwners}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BeneficialOwners from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(KybSelectResponse.KybRegistry.BeneficialOwners.EntityType entityType) { + return set("entity_type", Conv.enumeration(KybSelectResponse.KybRegistry.BeneficialOwners.EntityType::of), entityType); + } + + /** + * Normalized roles (e.g. ubo, shareholder). + * + * @param roles the value + * @return this builder + */ + public Builder roles(List roles) { + return set("roles", Conv.list(Conv.STRING), roles); + } + + /** + * Lower bound of the ownership band reported by the registry (e.g. 25%). + * + * @param ownershipMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMinShares(@Nullable String ownershipMinShares) { + return setNullable("ownership_min_shares", Conv.STRING, ownershipMinShares); + } + + /** + * Upper bound of the ownership band reported by the registry. + * + * @param ownershipMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMaxShares(@Nullable String ownershipMaxShares) { + return setNullable("ownership_max_shares", Conv.STRING, ownershipMaxShares); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The kyc_status field. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(KybSelectResponse.KybRegistry.BeneficialOwners.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(KybSelectResponse.KybRegistry.BeneficialOwners.KycStatus::of), kycStatus); + } + + /** + * The kyc_session_url field. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Parsed ownership percentage (max bound, falling back to min bound). + * + * @param effectiveOwnershipPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveOwnershipPercent(@Nullable Double effectiveOwnershipPercent) { + return setNullable("effective_ownership_percent", Conv.DOUBLE, effectiveOwnershipPercent); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * The country_of_birth field. + * + * @param countryOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryOfBirth(@Nullable String countryOfBirth) { + return setNullable("country_of_birth", Conv.STRING, countryOfBirth); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The designation field. + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * The voting_min_shares field. + * + * @param votingMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMinShares(@Nullable String votingMinShares) { + return setNullable("voting_min_shares", Conv.STRING, votingMinShares); + } + + /** + * The voting_max_shares field. + * + * @param votingMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMaxShares(@Nullable String votingMaxShares) { + return setNullable("voting_max_shares", Conv.STRING, votingMaxShares); + } + + /** + * Complete birth date when reported. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Appointment date when reported. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @param shareholding the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder shareholding(@Nullable KYBRegistryShareholding shareholding) { + return setNullable("shareholding", Conv.model(KYBRegistryShareholding::fromJson), shareholding); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BeneficialOwners} + */ + public BeneficialOwners build() { + return new BeneficialOwners(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the owner is a natural person or a corporate entity. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Same as the top-level registry_tier_delivered. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryTierDelivered extends StringEnum { + /** The value {@code "basic"}. */ + public static final RegistryTierDelivered BASIC = new RegistryTierDelivered("basic"); + + /** The value {@code "shareholders"}. */ + public static final RegistryTierDelivered SHAREHOLDERS = new RegistryTierDelivered("shareholders"); + + /** The value {@code "ubo"}. */ + public static final RegistryTierDelivered UBO = new RegistryTierDelivered("ubo"); + + private static final List KNOWN_VALUES = List.of(BASIC, SHAREHOLDERS, UBO); + + private RegistryTierDelivered(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryTierDelivered of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryTierDelivered::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * delivered when the ownership data came back, unavailable when an ownership tier was requested but the registry had none for this company (see registry_data.ownership_error), not_requested on the Lite tier. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryOwnershipStatus extends StringEnum { + /** The value {@code "not_requested"}. */ + public static final RegistryOwnershipStatus NOT_REQUESTED = new RegistryOwnershipStatus("not_requested"); + + /** The value {@code "delivered"}. */ + public static final RegistryOwnershipStatus DELIVERED = new RegistryOwnershipStatus("delivered"); + + /** The value {@code "unavailable"}. */ + public static final RegistryOwnershipStatus UNAVAILABLE = new RegistryOwnershipStatus("unavailable"); + + private static final List KNOWN_VALUES = List.of(NOT_REQUESTED, DELIVERED, UNAVAILABLE); + + private RegistryOwnershipStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryOwnershipStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryOwnershipStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/LoginRequest.java b/src/main/java/me/didit/types/LoginRequest.java new file mode 100644 index 0000000..1344b51 --- /dev/null +++ b/src/main/java/me/didit/types/LoginRequest.java @@ -0,0 +1,120 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class LoginRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "password"); + + private LoginRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code LoginRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static LoginRequest fromJson(JsonNode json) { + return new LoginRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The email field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * The password field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String password() { + return Json.required(json, "password", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link LoginRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(LoginRequest from) { + super(from); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * The password field. + * + * @param password the value + * @return this builder + */ + public Builder password(String password) { + return set("password", Conv.STRING, password); + } + + /** + * Builds the value. + * + * @return a new immutable {@code LoginRequest} + * @throws IllegalStateException when a required field is missing + */ + public LoginRequest build() { + require("email", false); + require("password", false); + return new LoginRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/LoginResponse.java b/src/main/java/me/didit/types/LoginResponse.java new file mode 100644 index 0000000..7b8de2a --- /dev/null +++ b/src/main/java/me/didit/types/LoginResponse.java @@ -0,0 +1,158 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class LoginResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("access_token", "refresh_token", "expires_in", "message"); + + private LoginResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code LoginResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static LoginResponse fromJson(JsonNode json) { + return new LoginResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * RS256-signed JWT. Use as Authorization: Bearer <token> for Account Management endpoints. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional accessToken() { + return Json.optional(json, "access_token", Conv.STRING); + } + + /** + * The refresh_token field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional refreshToken() { + return Json.optional(json, "refresh_token", Conv.STRING); + } + + /** + * Lifetime of the access token in seconds (default 86400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresIn() { + return Json.optional(json, "expires_in", Conv.LONG); + } + + /** + * The message field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link LoginResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(LoginResponse from) { + super(from); + } + + /** + * RS256-signed JWT. Use as Authorization: Bearer <token> for Account Management endpoints. + * + * @param accessToken the value + * @return this builder + */ + public Builder accessToken(String accessToken) { + return set("access_token", Conv.STRING, accessToken); + } + + /** + * The refresh_token field. + * + * @param refreshToken the value + * @return this builder + */ + public Builder refreshToken(String refreshToken) { + return set("refresh_token", Conv.STRING, refreshToken); + } + + /** + * Lifetime of the access token in seconds (default 86400). + * + * @param expiresIn the value + * @return this builder + */ + public Builder expiresIn(long expiresIn) { + return set("expires_in", Conv.LONG, expiresIn); + } + + /** + * The message field. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * Builds the value. + * + * @return a new immutable {@code LoginResponse} + */ + public LoginResponse build() { + return new LoginResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworkDetail.java b/src/main/java/me/didit/types/NetworkDetail.java new file mode 100644 index 0000000..9062ef1 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkDetail.java @@ -0,0 +1,460 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class NetworkDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "network_id", "name", "status", "risk", "pattern_types", "signal_types", "member_counts", "member_status", "signal_coverage", "first_activity_at", "last_activity_at", "stats", "fraud_tags", "risk_signals", "reviewed_at", "reviewed_by", "review_reason", "notes_count"); + + private NetworkDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkDetail fromJson(JsonNode json) { + return new NetworkDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Human-readable per-organization sequential id, e.g. N-0001. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkId() { + return Json.optional(json, "network_id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Network lifecycle status. Distinct from the per-applicant outcome_status inside a network (approved/in_review/declined/not_completed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(NetworkListItem.Status::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.model(NetworkRiskDisplay::fromJson)); + } + + /** + * The clustering patterns detected in this network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> patternTypes() { + return Json.optional(json, "pattern_types", Conv.list(Conv.enumeration(NetworkListItem.PatternTypes::of))); + } + + /** + * The distinct signal types present in this network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signalTypes() { + return Json.optional(json, "signal_types", Conv.list(Conv.enumeration(NetworkListItem.SignalTypes::of))); + } + + /** + * Counts of members by category (e.g. total, per outcome_status). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> memberCounts() { + return Json.optional(json, "member_counts", Conv.OBJECT); + } + + /** + * Breakdown of members by outcome_status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> memberStatus() { + return Json.optional(json, "member_status", Conv.OBJECT); + } + + /** + * Per signal_type coverage of this network's members. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signalCoverage() { + return Json.optional(json, "signal_coverage", Conv.OBJECT); + } + + /** + * The first_activity_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstActivityAt() { + return Json.optional(json, "first_activity_at", Conv.DATE_TIME); + } + + /** + * The last_activity_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastActivityAt() { + return Json.optional(json, "last_activity_at", Conv.DATE_TIME); + } + + /** + * Aggregate stats for the network (e.g. member totals). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> stats() { + return Json.optional(json, "stats", Conv.OBJECT); + } + + /** + * Fraud-pattern tags surfaced on the network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> fraudTags() { + return Json.optional(json, "fraud_tags", Conv.list(Conv.OBJECT)); + } + + /** + * Risk-signal summaries: residential_proxy_reuse, email_intelligence, phone_intelligence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskSignals() { + return Json.optional(json, "risk_signals", Conv.OBJECT); + } + + /** + * The reviewed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewedAt() { + return Json.optional(json, "reviewed_at", Conv.DATE_TIME); + } + + /** + * The reviewed_by field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewedBy() { + return Json.optional(json, "reviewed_by", Conv.STRING); + } + + /** + * The review_reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewReason() { + return Json.optional(json, "review_reason", Conv.STRING); + } + + /** + * Number of private analyst notes in this investigation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional notesCount() { + return Json.optional(json, "notes_count", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Human-readable per-organization sequential id, e.g. N-0001. + * + * @param networkId the value + * @return this builder + */ + public Builder networkId(String networkId) { + return set("network_id", Conv.STRING, networkId); + } + + /** + * The name field. + * + * @param name the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder name(@Nullable String name) { + return setNullable("name", Conv.STRING, name); + } + + /** + * Network lifecycle status. Distinct from the per-applicant outcome_status inside a network (approved/in_review/declined/not_completed). + * + * @param status the value + * @return this builder + */ + public Builder status(NetworkListItem.Status status) { + return set("status", Conv.enumeration(NetworkListItem.Status::of), status); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(NetworkRiskDisplay risk) { + return set("risk", Conv.model(NetworkRiskDisplay::fromJson), risk); + } + + /** + * The clustering patterns detected in this network. + * + * @param patternTypes the value + * @return this builder + */ + public Builder patternTypes(List patternTypes) { + return set("pattern_types", Conv.list(Conv.enumeration(NetworkListItem.PatternTypes::of)), patternTypes); + } + + /** + * The distinct signal types present in this network. + * + * @param signalTypes the value + * @return this builder + */ + public Builder signalTypes(List signalTypes) { + return set("signal_types", Conv.list(Conv.enumeration(NetworkListItem.SignalTypes::of)), signalTypes); + } + + /** + * Counts of members by category (e.g. total, per outcome_status). + * + * @param memberCounts the value + * @return this builder + */ + public Builder memberCounts(Map memberCounts) { + return setAny("member_counts", memberCounts); + } + + /** + * Breakdown of members by outcome_status. + * + * @param memberStatus the value + * @return this builder + */ + public Builder memberStatus(Map memberStatus) { + return setAny("member_status", memberStatus); + } + + /** + * Per signal_type coverage of this network's members. + * + * @param signalCoverage the value + * @return this builder + */ + public Builder signalCoverage(Map signalCoverage) { + return setAny("signal_coverage", signalCoverage); + } + + /** + * The first_activity_at field. + * + * @param firstActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstActivityAt(@Nullable OffsetDateTime firstActivityAt) { + return setNullable("first_activity_at", Conv.DATE_TIME, firstActivityAt); + } + + /** + * The last_activity_at field. + * + * @param lastActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastActivityAt(@Nullable OffsetDateTime lastActivityAt) { + return setNullable("last_activity_at", Conv.DATE_TIME, lastActivityAt); + } + + /** + * Aggregate stats for the network (e.g. member totals). + * + * @param stats the value + * @return this builder + */ + public Builder stats(Map stats) { + return setAny("stats", stats); + } + + /** + * Fraud-pattern tags surfaced on the network. + * + * @param fraudTags the value + * @return this builder + */ + public Builder fraudTags(List> fraudTags) { + return setAny("fraud_tags", fraudTags); + } + + /** + * Risk-signal summaries: residential_proxy_reuse, email_intelligence, phone_intelligence. + * + * @param riskSignals the value + * @return this builder + */ + public Builder riskSignals(Map riskSignals) { + return setAny("risk_signals", riskSignals); + } + + /** + * The reviewed_at field. + * + * @param reviewedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewedAt(@Nullable OffsetDateTime reviewedAt) { + return setNullable("reviewed_at", Conv.DATE_TIME, reviewedAt); + } + + /** + * The reviewed_by field. + * + * @param reviewedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewedBy(@Nullable String reviewedBy) { + return setNullable("reviewed_by", Conv.STRING, reviewedBy); + } + + /** + * The review_reason field. + * + * @param reviewReason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewReason(@Nullable String reviewReason) { + return setNullable("review_reason", Conv.STRING, reviewReason); + } + + /** + * Number of private analyst notes in this investigation. + * + * @param notesCount the value + * @return this builder + */ + public Builder notesCount(long notesCount) { + return set("notes_count", Conv.LONG, notesCount); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkDetail} + */ + public NetworkDetail build() { + return new NetworkDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworkGraph.java b/src/main/java/me/didit/types/NetworkGraph.java new file mode 100644 index 0000000..5f29a78 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkGraph.java @@ -0,0 +1,324 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class NetworkGraph extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("network", "depth", "truncated", "nodes", "edges", "metrics"); + + private NetworkGraph(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkGraph} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkGraph fromJson(JsonNode json) { + return new NetworkGraph(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The network field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional network() { + return Json.optional(json, "network", Conv.model(NetworkDetail::fromJson)); + } + + /** + * Effective depth applied, or null when unbounded (depth=all). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional depth() { + return Json.optional(json, "depth", Conv.LONG); + } + + /** + * True if the neighborhood was cut off by depth. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional truncated() { + return Json.optional(json, "truncated", Conv.BOOLEAN); + } + + /** + * The nodes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> nodes() { + return Json.optional(json, "nodes", Conv.list(Conv.model(NetworkGraphNode::fromJson))); + } + + /** + * The edges field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> edges() { + return Json.optional(json, "edges", Conv.list(Conv.model(NetworkGraphEdge::fromJson))); + } + + /** + * The metrics field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional metrics() { + return Json.optional(json, "metrics", Conv.model(NetworkGraph.Metrics::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkGraph}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkGraph from) { + super(from); + } + + /** + * The network field. + * + * @param network the value + * @return this builder + */ + public Builder network(NetworkDetail network) { + return set("network", Conv.model(NetworkDetail::fromJson), network); + } + + /** + * Effective depth applied, or null when unbounded (depth=all). + * + * @param depth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder depth(@Nullable Long depth) { + return setNullable("depth", Conv.LONG, depth); + } + + /** + * True if the neighborhood was cut off by depth. + * + * @param truncated the value + * @return this builder + */ + public Builder truncated(boolean truncated) { + return set("truncated", Conv.BOOLEAN, truncated); + } + + /** + * The nodes field. + * + * @param nodes the value + * @return this builder + */ + public Builder nodes(List nodes) { + return set("nodes", Conv.list(Conv.model(NetworkGraphNode::fromJson)), nodes); + } + + /** + * The edges field. + * + * @param edges the value + * @return this builder + */ + public Builder edges(List edges) { + return set("edges", Conv.list(Conv.model(NetworkGraphEdge::fromJson)), edges); + } + + /** + * The metrics field. + * + * @param metrics the value + * @return this builder + */ + public Builder metrics(NetworkGraph.Metrics metrics) { + return set("metrics", Conv.model(NetworkGraph.Metrics::fromJson), metrics); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkGraph} + */ + public NetworkGraph build() { + return new NetworkGraph(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Metrics extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_count", "edge_count", "hub_signal_count"); + + private Metrics(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Metrics} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Metrics fromJson(JsonNode json) { + return new Metrics(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The node_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeCount() { + return Json.optional(json, "node_count", Conv.LONG); + } + + /** + * The edge_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional edgeCount() { + return Json.optional(json, "edge_count", Conv.LONG); + } + + /** + * The hub_signal_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hubSignalCount() { + return Json.optional(json, "hub_signal_count", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Metrics}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Metrics from) { + super(from); + } + + /** + * The node_count field. + * + * @param nodeCount the value + * @return this builder + */ + public Builder nodeCount(long nodeCount) { + return set("node_count", Conv.LONG, nodeCount); + } + + /** + * The edge_count field. + * + * @param edgeCount the value + * @return this builder + */ + public Builder edgeCount(long edgeCount) { + return set("edge_count", Conv.LONG, edgeCount); + } + + /** + * The hub_signal_count field. + * + * @param hubSignalCount the value + * @return this builder + */ + public Builder hubSignalCount(long hubSignalCount) { + return set("hub_signal_count", Conv.LONG, hubSignalCount); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Metrics} + */ + public Metrics build() { + return new Metrics(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/NetworkGraphEdge.java b/src/main/java/me/didit/types/NetworkGraphEdge.java new file mode 100644 index 0000000..3e05600 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkGraphEdge.java @@ -0,0 +1,363 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class NetworkGraphEdge extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "source", "target", "subject_kind", "signal_type", "confidence", "observation_count", "first_seen_at", "last_seen_at"); + + private NetworkGraphEdge(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkGraphEdge} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkGraphEdge fromJson(JsonNode json) { + return new NetworkGraphEdge(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * Subject node id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + /** + * Signal node id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional target() { + return Json.optional(json, "target", Conv.STRING); + } + + /** + * The subject_kind field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subjectKind() { + return Json.optional(json, "subject_kind", Conv.enumeration(NetworkGraphEdge.SubjectKind::of)); + } + + /** + * The signal_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signalType() { + return Json.optional(json, "signal_type", Conv.enumeration(NetworkGraphEdge.SignalType::of)); + } + + /** + * 1.0 for an exact match. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + /** + * The observation_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional observationCount() { + return Json.optional(json, "observation_count", Conv.LONG); + } + + /** + * The first_seen_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSeenAt() { + return Json.optional(json, "first_seen_at", Conv.DATE_TIME); + } + + /** + * The last_seen_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSeenAt() { + return Json.optional(json, "last_seen_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkGraphEdge}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkGraphEdge from) { + super(from); + } + + /** + * The id field. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * Subject node id. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * Signal node id. + * + * @param target the value + * @return this builder + */ + public Builder target(String target) { + return set("target", Conv.STRING, target); + } + + /** + * The subject_kind field. + * + * @param subjectKind the value + * @return this builder + */ + public Builder subjectKind(NetworkGraphEdge.SubjectKind subjectKind) { + return set("subject_kind", Conv.enumeration(NetworkGraphEdge.SubjectKind::of), subjectKind); + } + + /** + * The signal_type field. + * + * @param signalType the value + * @return this builder + */ + public Builder signalType(NetworkGraphEdge.SignalType signalType) { + return set("signal_type", Conv.enumeration(NetworkGraphEdge.SignalType::of), signalType); + } + + /** + * 1.0 for an exact match. + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * The observation_count field. + * + * @param observationCount the value + * @return this builder + */ + public Builder observationCount(long observationCount) { + return set("observation_count", Conv.LONG, observationCount); + } + + /** + * The first_seen_at field. + * + * @param firstSeenAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSeenAt(@Nullable OffsetDateTime firstSeenAt) { + return setNullable("first_seen_at", Conv.DATE_TIME, firstSeenAt); + } + + /** + * The last_seen_at field. + * + * @param lastSeenAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSeenAt(@Nullable OffsetDateTime lastSeenAt) { + return setNullable("last_seen_at", Conv.DATE_TIME, lastSeenAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkGraphEdge} + */ + public NetworkGraphEdge build() { + return new NetworkGraphEdge(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SubjectKind extends StringEnum { + /** The value {@code "vendor_user"}. */ + public static final SubjectKind VENDOR_USER = new SubjectKind("vendor_user"); + + /** The value {@code "vendor_business"}. */ + public static final SubjectKind VENDOR_BUSINESS = new SubjectKind("vendor_business"); + + /** The value {@code "transaction_party"}. */ + public static final SubjectKind TRANSACTION_PARTY = new SubjectKind("transaction_party"); + + private static final List KNOWN_VALUES = List.of(VENDOR_USER, VENDOR_BUSINESS, TRANSACTION_PARTY); + + private SubjectKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SubjectKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SubjectKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SignalType extends StringEnum { + /** The value {@code "ip_address"}. */ + public static final SignalType IP_ADDRESS = new SignalType("ip_address"); + + /** The value {@code "device"}. */ + public static final SignalType DEVICE = new SignalType("device"); + + /** The value {@code "face"}. */ + public static final SignalType FACE = new SignalType("face"); + + /** The value {@code "document_number"}. */ + public static final SignalType DOCUMENT_NUMBER = new SignalType("document_number"); + + /** The value {@code "phone"}. */ + public static final SignalType PHONE = new SignalType("phone"); + + /** The value {@code "email"}. */ + public static final SignalType EMAIL = new SignalType("email"); + + /** The value {@code "address"}. */ + public static final SignalType ADDRESS = new SignalType("address"); + + private static final List KNOWN_VALUES = List.of(IP_ADDRESS, DEVICE, FACE, DOCUMENT_NUMBER, PHONE, EMAIL, ADDRESS); + + private SignalType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SignalType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SignalType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworkGraphNode.java b/src/main/java/me/didit/types/NetworkGraphNode.java new file mode 100644 index 0000000..fcac688 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkGraphNode.java @@ -0,0 +1,170 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** + * A subject node or a signal node, distinguished by kind. Subject nodes (kind: vendor_user | vendor_business | transaction_party) carry id, kind, subject, node_status (approved | in_review | declined | not_completed), and tags. Signal nodes (kind: signal) carry id, kind, uuid, signal_type, subject_count, coverage, is_hub, is_datacenter_ip, is_high_collision_device, node_status (signal_active | signal_guarded), tags, risk_evidence, first_seen_at, and last_seen_at. + */ +public final class NetworkGraphNode extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "kind"); + + private NetworkGraphNode(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkGraphNode} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkGraphNode fromJson(JsonNode json) { + return new NetworkGraphNode(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * The kind field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kind() { + return Json.optional(json, "kind", Conv.enumeration(NetworkGraphNode.Kind::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkGraphNode}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkGraphNode from) { + super(from); + } + + /** + * The id field. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * The kind field. + * + * @param kind the value + * @return this builder + */ + public Builder kind(NetworkGraphNode.Kind kind) { + return set("kind", Conv.enumeration(NetworkGraphNode.Kind::of), kind); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkGraphNode} + */ + public NetworkGraphNode build() { + return new NetworkGraphNode(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Kind extends StringEnum { + /** The value {@code "vendor_user"}. */ + public static final Kind VENDOR_USER = new Kind("vendor_user"); + + /** The value {@code "vendor_business"}. */ + public static final Kind VENDOR_BUSINESS = new Kind("vendor_business"); + + /** The value {@code "transaction_party"}. */ + public static final Kind TRANSACTION_PARTY = new Kind("transaction_party"); + + /** The value {@code "signal"}. */ + public static final Kind SIGNAL = new Kind("signal"); + + private static final List KNOWN_VALUES = List.of(VENDOR_USER, VENDOR_BUSINESS, TRANSACTION_PARTY, SIGNAL); + + private Kind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Kind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Kind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworkListItem.java b/src/main/java/me/didit/types/NetworkListItem.java new file mode 100644 index 0000000..9708e30 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkListItem.java @@ -0,0 +1,490 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class NetworkListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "network_id", "name", "status", "risk", "pattern_types", "signal_types", "member_counts", "member_status", "signal_coverage", "first_activity_at", "last_activity_at"); + + private NetworkListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkListItem fromJson(JsonNode json) { + return new NetworkListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Human-readable per-organization sequential id, e.g. N-0001. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkId() { + return Json.optional(json, "network_id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Network lifecycle status. Distinct from the per-applicant outcome_status inside a network (approved/in_review/declined/not_completed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(NetworkListItem.Status::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.model(NetworkRiskDisplay::fromJson)); + } + + /** + * The clustering patterns detected in this network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> patternTypes() { + return Json.optional(json, "pattern_types", Conv.list(Conv.enumeration(NetworkListItem.PatternTypes::of))); + } + + /** + * The distinct signal types present in this network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signalTypes() { + return Json.optional(json, "signal_types", Conv.list(Conv.enumeration(NetworkListItem.SignalTypes::of))); + } + + /** + * Counts of members by category (e.g. total, per outcome_status). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> memberCounts() { + return Json.optional(json, "member_counts", Conv.OBJECT); + } + + /** + * Breakdown of members by outcome_status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> memberStatus() { + return Json.optional(json, "member_status", Conv.OBJECT); + } + + /** + * Per signal_type coverage of this network's members. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signalCoverage() { + return Json.optional(json, "signal_coverage", Conv.OBJECT); + } + + /** + * The first_activity_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstActivityAt() { + return Json.optional(json, "first_activity_at", Conv.DATE_TIME); + } + + /** + * The last_activity_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastActivityAt() { + return Json.optional(json, "last_activity_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkListItem from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Human-readable per-organization sequential id, e.g. N-0001. + * + * @param networkId the value + * @return this builder + */ + public Builder networkId(String networkId) { + return set("network_id", Conv.STRING, networkId); + } + + /** + * The name field. + * + * @param name the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder name(@Nullable String name) { + return setNullable("name", Conv.STRING, name); + } + + /** + * Network lifecycle status. Distinct from the per-applicant outcome_status inside a network (approved/in_review/declined/not_completed). + * + * @param status the value + * @return this builder + */ + public Builder status(NetworkListItem.Status status) { + return set("status", Conv.enumeration(NetworkListItem.Status::of), status); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(NetworkRiskDisplay risk) { + return set("risk", Conv.model(NetworkRiskDisplay::fromJson), risk); + } + + /** + * The clustering patterns detected in this network. + * + * @param patternTypes the value + * @return this builder + */ + public Builder patternTypes(List patternTypes) { + return set("pattern_types", Conv.list(Conv.enumeration(NetworkListItem.PatternTypes::of)), patternTypes); + } + + /** + * The distinct signal types present in this network. + * + * @param signalTypes the value + * @return this builder + */ + public Builder signalTypes(List signalTypes) { + return set("signal_types", Conv.list(Conv.enumeration(NetworkListItem.SignalTypes::of)), signalTypes); + } + + /** + * Counts of members by category (e.g. total, per outcome_status). + * + * @param memberCounts the value + * @return this builder + */ + public Builder memberCounts(Map memberCounts) { + return setAny("member_counts", memberCounts); + } + + /** + * Breakdown of members by outcome_status. + * + * @param memberStatus the value + * @return this builder + */ + public Builder memberStatus(Map memberStatus) { + return setAny("member_status", memberStatus); + } + + /** + * Per signal_type coverage of this network's members. + * + * @param signalCoverage the value + * @return this builder + */ + public Builder signalCoverage(Map signalCoverage) { + return setAny("signal_coverage", signalCoverage); + } + + /** + * The first_activity_at field. + * + * @param firstActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstActivityAt(@Nullable OffsetDateTime firstActivityAt) { + return setNullable("first_activity_at", Conv.DATE_TIME, firstActivityAt); + } + + /** + * The last_activity_at field. + * + * @param lastActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastActivityAt(@Nullable OffsetDateTime lastActivityAt) { + return setNullable("last_activity_at", Conv.DATE_TIME, lastActivityAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkListItem} + */ + public NetworkListItem build() { + return new NetworkListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Network lifecycle status. Distinct from the per-applicant outcome_status inside a network (approved/in_review/declined/not_completed). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "active"}. */ + public static final Status ACTIVE = new Status("active"); + + /** The value {@code "in_review"}. */ + public static final Status IN_REVIEW = new Status("in_review"); + + /** The value {@code "resolved"}. */ + public static final Status RESOLVED = new Status("resolved"); + + /** The value {@code "dismissed"}. */ + public static final Status DISMISSED = new Status("dismissed"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, IN_REVIEW, RESOLVED, DISMISSED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PatternTypes extends StringEnum { + /** The value {@code "exact_same_device"}. */ + public static final PatternTypes EXACT_SAME_DEVICE = new PatternTypes("exact_same_device"); + + /** The value {@code "similar_device"}. */ + public static final PatternTypes SIMILAR_DEVICE = new PatternTypes("similar_device"); + + /** The value {@code "same_ip_address"}. */ + public static final PatternTypes SAME_IP_ADDRESS = new PatternTypes("same_ip_address"); + + /** The value {@code "same_address"}. */ + public static final PatternTypes SAME_ADDRESS = new PatternTypes("same_address"); + + /** The value {@code "similar_selfie_backgrounds"}. */ + public static final PatternTypes SIMILAR_SELFIE_BACKGROUNDS = new PatternTypes("similar_selfie_backgrounds"); + + /** The value {@code "similar_poa_documents"}. */ + public static final PatternTypes SIMILAR_POA_DOCUMENTS = new PatternTypes("similar_poa_documents"); + + /** The value {@code "same_document_number"}. */ + public static final PatternTypes SAME_DOCUMENT_NUMBER = new PatternTypes("same_document_number"); + + /** The value {@code "same_phone_number"}. */ + public static final PatternTypes SAME_PHONE_NUMBER = new PatternTypes("same_phone_number"); + + /** The value {@code "same_email"}. */ + public static final PatternTypes SAME_EMAIL = new PatternTypes("same_email"); + + private static final List KNOWN_VALUES = List.of(EXACT_SAME_DEVICE, SIMILAR_DEVICE, SAME_IP_ADDRESS, SAME_ADDRESS, SIMILAR_SELFIE_BACKGROUNDS, SIMILAR_POA_DOCUMENTS, SAME_DOCUMENT_NUMBER, SAME_PHONE_NUMBER, SAME_EMAIL); + + private PatternTypes(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PatternTypes of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PatternTypes::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SignalTypes extends StringEnum { + /** The value {@code "ip_address"}. */ + public static final SignalTypes IP_ADDRESS = new SignalTypes("ip_address"); + + /** The value {@code "device"}. */ + public static final SignalTypes DEVICE = new SignalTypes("device"); + + /** The value {@code "face"}. */ + public static final SignalTypes FACE = new SignalTypes("face"); + + /** The value {@code "document_number"}. */ + public static final SignalTypes DOCUMENT_NUMBER = new SignalTypes("document_number"); + + /** The value {@code "phone"}. */ + public static final SignalTypes PHONE = new SignalTypes("phone"); + + /** The value {@code "email"}. */ + public static final SignalTypes EMAIL = new SignalTypes("email"); + + /** The value {@code "address"}. */ + public static final SignalTypes ADDRESS = new SignalTypes("address"); + + private static final List KNOWN_VALUES = List.of(IP_ADDRESS, DEVICE, FACE, DOCUMENT_NUMBER, PHONE, EMAIL, ADDRESS); + + private SignalTypes(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SignalTypes of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SignalTypes::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworkMap.java b/src/main/java/me/didit/types/NetworkMap.java new file mode 100644 index 0000000..134e72f --- /dev/null +++ b/src/main/java/me/didit/types/NetworkMap.java @@ -0,0 +1,365 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class NetworkMap extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("network", "convergence_count", "countries", "points"); + + private NetworkMap(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkMap} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkMap fromJson(JsonNode json) { + return new NetworkMap(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The network field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional network() { + return Json.optional(json, "network", Conv.model(NetworkDetail::fromJson)); + } + + /** + * Number of distinct address/location points members converge on. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional convergenceCount() { + return Json.optional(json, "convergence_count", Conv.LONG); + } + + /** + * The countries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> countries() { + return Json.optional(json, "countries", Conv.list(Conv.STRING)); + } + + /** + * The points field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> points() { + return Json.optional(json, "points", Conv.list(Conv.model(NetworkMap.Points::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkMap}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkMap from) { + super(from); + } + + /** + * The network field. + * + * @param network the value + * @return this builder + */ + public Builder network(NetworkDetail network) { + return set("network", Conv.model(NetworkDetail::fromJson), network); + } + + /** + * Number of distinct address/location points members converge on. + * + * @param convergenceCount the value + * @return this builder + */ + public Builder convergenceCount(long convergenceCount) { + return set("convergence_count", Conv.LONG, convergenceCount); + } + + /** + * The countries field. + * + * @param countries the value + * @return this builder + */ + public Builder countries(List countries) { + return set("countries", Conv.list(Conv.STRING), countries); + } + + /** + * The points field. + * + * @param points the value + * @return this builder + */ + public Builder points(List points) { + return set("points", Conv.list(Conv.model(NetworkMap.Points::fromJson)), points); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkMap} + */ + public NetworkMap build() { + return new NetworkMap(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Points extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "country", "country_code", "city", "latitude", "longitude", "observed_at"); + + private Points(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Points} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Points fromJson(JsonNode json) { + return new Points(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The country_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + /** + * The observed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional observedAt() { + return Json.optional(json, "observed_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Points}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Points from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The country field. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * The country_code field. + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * The latitude field. + * + * @param latitude the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder latitude(@Nullable Double latitude) { + return setNullable("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder longitude(@Nullable Double longitude) { + return setNullable("longitude", Conv.DOUBLE, longitude); + } + + /** + * The observed_at field. + * + * @param observedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder observedAt(@Nullable OffsetDateTime observedAt) { + return setNullable("observed_at", Conv.DATE_TIME, observedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Points} + */ + public Points build() { + return new Points(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/NetworkMember.java b/src/main/java/me/didit/types/NetworkMember.java new file mode 100644 index 0000000..0ef91c2 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkMember.java @@ -0,0 +1,461 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class NetworkMember extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("subject", "outcome_status", "node_status", "tags", "risk", "signal_coverage", "shared_infrastructure", "joined_at", "last_seen_at", "provenance"); + + private NetworkMember(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkMember} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkMember fromJson(JsonNode json) { + return new NetworkMember(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The vendor_user, vendor_business, or transaction_party this member represents. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subject() { + return Json.optional(json, "subject", Conv.OBJECT); + } + + /** + * The subject's verification/decision outcome. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomeStatus() { + return Json.optional(json, "outcome_status", Conv.STRING); + } + + /** + * For a member row this is always one of the subject-outcome values: approved, in_review, declined, or not_completed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeStatus() { + return Json.optional(json, "node_status", Conv.enumeration(NetworkMember.NodeStatus::of)); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(NetworkNodeTag::fromJson))); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.model(NetworkRiskDisplay::fromJson)); + } + + /** + * The signal_coverage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signalCoverage() { + return Json.optional(json, "signal_coverage", Conv.OBJECT); + } + + /** + * The shared_infrastructure field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sharedInfrastructure() { + return Json.optional(json, "shared_infrastructure", Conv.OBJECT); + } + + /** + * The joined_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional joinedAt() { + return Json.optional(json, "joined_at", Conv.DATE_TIME); + } + + /** + * The last_seen_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSeenAt() { + return Json.optional(json, "last_seen_at", Conv.DATE_TIME); + } + + /** + * The provenance field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional provenance() { + return Json.optional(json, "provenance", Conv.model(NetworkMember.Provenance::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkMember}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkMember from) { + super(from); + } + + /** + * The vendor_user, vendor_business, or transaction_party this member represents. + * + * @param subject the value + * @return this builder + */ + public Builder subject(Map subject) { + return setAny("subject", subject); + } + + /** + * The subject's verification/decision outcome. + * + * @param outcomeStatus the value + * @return this builder + */ + public Builder outcomeStatus(String outcomeStatus) { + return set("outcome_status", Conv.STRING, outcomeStatus); + } + + /** + * For a member row this is always one of the subject-outcome values: approved, in_review, declined, or not_completed. + * + * @param nodeStatus the value + * @return this builder + */ + public Builder nodeStatus(NetworkMember.NodeStatus nodeStatus) { + return set("node_status", Conv.enumeration(NetworkMember.NodeStatus::of), nodeStatus); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(NetworkNodeTag::fromJson)), tags); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(NetworkRiskDisplay risk) { + return set("risk", Conv.model(NetworkRiskDisplay::fromJson), risk); + } + + /** + * The signal_coverage field. + * + * @param signalCoverage the value + * @return this builder + */ + public Builder signalCoverage(Map signalCoverage) { + return setAny("signal_coverage", signalCoverage); + } + + /** + * The shared_infrastructure field. + * + * @param sharedInfrastructure the value + * @return this builder + */ + public Builder sharedInfrastructure(Map sharedInfrastructure) { + return setAny("shared_infrastructure", sharedInfrastructure); + } + + /** + * The joined_at field. + * + * @param joinedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder joinedAt(@Nullable OffsetDateTime joinedAt) { + return setNullable("joined_at", Conv.DATE_TIME, joinedAt); + } + + /** + * The last_seen_at field. + * + * @param lastSeenAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSeenAt(@Nullable OffsetDateTime lastSeenAt) { + return setNullable("last_seen_at", Conv.DATE_TIME, lastSeenAt); + } + + /** + * The provenance field. + * + * @param provenance the value + * @return this builder + */ + public Builder provenance(NetworkMember.Provenance provenance) { + return set("provenance", Conv.model(NetworkMember.Provenance::fromJson), provenance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkMember} + */ + public NetworkMember build() { + return new NetworkMember(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * For a member row this is always one of the subject-outcome values: approved, in_review, declined, or not_completed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NodeStatus extends StringEnum { + /** The value {@code "approved"}. */ + public static final NodeStatus APPROVED = new NodeStatus("approved"); + + /** The value {@code "in_review"}. */ + public static final NodeStatus IN_REVIEW = new NodeStatus("in_review"); + + /** The value {@code "declined"}. */ + public static final NodeStatus DECLINED = new NodeStatus("declined"); + + /** The value {@code "not_completed"}. */ + public static final NodeStatus NOT_COMPLETED = new NodeStatus("not_completed"); + + /** The value {@code "signal_active"}. */ + public static final NodeStatus SIGNAL_ACTIVE = new NodeStatus("signal_active"); + + /** The value {@code "signal_guarded"}. */ + public static final NodeStatus SIGNAL_GUARDED = new NodeStatus("signal_guarded"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED, NOT_COMPLETED, SIGNAL_ACTIVE, SIGNAL_GUARDED); + + private NodeStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NodeStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NodeStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Provenance extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_ids", "business_session_ids", "transaction_ids"); + + private Provenance(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Provenance} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Provenance fromJson(JsonNode json) { + return new Provenance(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The session_ids field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sessionIds() { + return Json.optional(json, "session_ids", Conv.list(Conv.STRING)); + } + + /** + * The business_session_ids field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> businessSessionIds() { + return Json.optional(json, "business_session_ids", Conv.list(Conv.STRING)); + } + + /** + * The transaction_ids field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> transactionIds() { + return Json.optional(json, "transaction_ids", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Provenance}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Provenance from) { + super(from); + } + + /** + * The session_ids field. + * + * @param sessionIds the value + * @return this builder + */ + public Builder sessionIds(List sessionIds) { + return set("session_ids", Conv.list(Conv.STRING), sessionIds); + } + + /** + * The business_session_ids field. + * + * @param businessSessionIds the value + * @return this builder + */ + public Builder businessSessionIds(List businessSessionIds) { + return set("business_session_ids", Conv.list(Conv.STRING), businessSessionIds); + } + + /** + * The transaction_ids field. + * + * @param transactionIds the value + * @return this builder + */ + public Builder transactionIds(List transactionIds) { + return set("transaction_ids", Conv.list(Conv.STRING), transactionIds); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Provenance} + */ + public Provenance build() { + return new Provenance(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/NetworkNodeTag.java b/src/main/java/me/didit/types/NetworkNodeTag.java new file mode 100644 index 0000000..a0b531b --- /dev/null +++ b/src/main/java/me/didit/types/NetworkNodeTag.java @@ -0,0 +1,272 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class NetworkNodeTag extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "name", "color", "source", "category"); + + private NetworkNodeTag(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkNodeTag} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkNodeTag fromJson(JsonNode json) { + return new NetworkNodeTag(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Null for guard tags, whose color token the renderer owns. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional color() { + return Json.optional(json, "color", Conv.STRING); + } + + /** + * Where the tag came from: a tag on the user/business, a tag on a session in this network, a tag on a transaction a party belongs to, or a signal guard condition (e.g. hub, datacenter IP). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(NetworkNodeTag.Source::of)); + } + + /** + * customer for customer-defined tags, quality for signal-quality guard tags. Null when not applicable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.enumeration(NetworkNodeTag.Category::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkNodeTag}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkNodeTag from) { + super(from); + } + + /** + * The id field. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Null for guard tags, whose color token the renderer owns. + * + * @param color the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder color(@Nullable String color) { + return setNullable("color", Conv.STRING, color); + } + + /** + * Where the tag came from: a tag on the user/business, a tag on a session in this network, a tag on a transaction a party belongs to, or a signal guard condition (e.g. hub, datacenter IP). + * + * @param source the value + * @return this builder + */ + public Builder source(NetworkNodeTag.Source source) { + return set("source", Conv.enumeration(NetworkNodeTag.Source::of), source); + } + + /** + * customer for customer-defined tags, quality for signal-quality guard tags. Null when not applicable. + * + * @param category the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder category(NetworkNodeTag.@Nullable Category category) { + return setNullable("category", Conv.enumeration(NetworkNodeTag.Category::of), category); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkNodeTag} + */ + public NetworkNodeTag build() { + return new NetworkNodeTag(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Where the tag came from: a tag on the user/business, a tag on a session in this network, a tag on a transaction a party belongs to, or a signal guard condition (e.g. hub, datacenter IP). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "subject_tag"}. */ + public static final Source SUBJECT_TAG = new Source("subject_tag"); + + /** The value {@code "session_tag"}. */ + public static final Source SESSION_TAG = new Source("session_tag"); + + /** The value {@code "transaction_tag"}. */ + public static final Source TRANSACTION_TAG = new Source("transaction_tag"); + + /** The value {@code "signal_guard"}. */ + public static final Source SIGNAL_GUARD = new Source("signal_guard"); + + private static final List KNOWN_VALUES = List.of(SUBJECT_TAG, SESSION_TAG, TRANSACTION_TAG, SIGNAL_GUARD); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * customer for customer-defined tags, quality for signal-quality guard tags. Null when not applicable. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Category extends StringEnum { + /** The value {@code "customer"}. */ + public static final Category CUSTOMER = new Category("customer"); + + /** The value {@code "quality"}. */ + public static final Category QUALITY = new Category("quality"); + + private static final List KNOWN_VALUES = List.of(CUSTOMER, QUALITY); + + private Category(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Category of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Category::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworkNote.java b/src/main/java/me/didit/types/NetworkNote.java new file mode 100644 index 0000000..1027f29 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkNote.java @@ -0,0 +1,184 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class NetworkNote extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "actor_email", "comment", "client_reference", "created_at"); + + private NetworkNote(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkNote} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkNote fromJson(JsonNode json) { + return new NetworkNote(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * Authenticated author, assigned by the server. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String actorEmail() { + return Json.required(json, "actor_email", Conv.STRING); + } + + /** + * The comment field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String comment() { + return Json.required(json, "comment", Conv.STRING); + } + + /** + * The client_reference field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String clientReference() { + return Json.required(json, "client_reference", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkNote}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkNote from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Authenticated author, assigned by the server. + * + * @param actorEmail the value + * @return this builder + */ + public Builder actorEmail(String actorEmail) { + return set("actor_email", Conv.STRING, actorEmail); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * The client_reference field. + * + * @param clientReference the value + * @return this builder + */ + public Builder clientReference(String clientReference) { + return set("client_reference", Conv.STRING, clientReference); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkNote} + * @throws IllegalStateException when a required field is missing + */ + public NetworkNote build() { + require("uuid", false); + require("actor_email", false); + require("comment", false); + require("client_reference", false); + require("created_at", false); + return new NetworkNote(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworkRiskDisplay.java b/src/main/java/me/didit/types/NetworkRiskDisplay.java new file mode 100644 index 0000000..a0174cf --- /dev/null +++ b/src/main/java/me/didit/types/NetworkRiskDisplay.java @@ -0,0 +1,185 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class NetworkRiskDisplay extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "band", "bar"); + + private NetworkRiskDisplay(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkRiskDisplay} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkRiskDisplay fromJson(JsonNode json) { + return new NetworkRiskDisplay(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Risk score, 0-100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * Band the score renders as. high >= 70, medium >= 40, otherwise low. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional band() { + return Json.optional(json, "band", Conv.enumeration(NetworkRiskDisplay.Band::of)); + } + + /** + * Normalized 0-1 value for rendering a risk bar. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bar() { + return Json.optional(json, "bar", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkRiskDisplay}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkRiskDisplay from) { + super(from); + } + + /** + * Risk score, 0-100. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * Band the score renders as. high >= 70, medium >= 40, otherwise low. + * + * @param band the value + * @return this builder + */ + public Builder band(NetworkRiskDisplay.Band band) { + return set("band", Conv.enumeration(NetworkRiskDisplay.Band::of), band); + } + + /** + * Normalized 0-1 value for rendering a risk bar. + * + * @param bar the value + * @return this builder + */ + public Builder bar(double bar) { + return set("bar", Conv.DOUBLE, bar); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkRiskDisplay} + */ + public NetworkRiskDisplay build() { + return new NetworkRiskDisplay(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Band the score renders as. high >= 70, medium >= 40, otherwise low. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Band extends StringEnum { + /** The value {@code "low"}. */ + public static final Band LOW = new Band("low"); + + /** The value {@code "medium"}. */ + public static final Band MEDIUM = new Band("medium"); + + /** The value {@code "high"}. */ + public static final Band HIGH = new Band("high"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private Band(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Band of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Band::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworkSignal.java b/src/main/java/me/didit/types/NetworkSignal.java new file mode 100644 index 0000000..b9dbc8d --- /dev/null +++ b/src/main/java/me/didit/types/NetworkSignal.java @@ -0,0 +1,420 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class NetworkSignal extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "signal_type", "subject_count", "coverage", "is_hub", "is_datacenter_ip", "is_high_collision_device", "node_status", "tags", "risk_evidence", "first_seen_at", "last_seen_at"); + + private NetworkSignal(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkSignal} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkSignal fromJson(JsonNode json) { + return new NetworkSignal(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The signal_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signalType() { + return Json.optional(json, "signal_type", Conv.enumeration(NetworkSignal.SignalType::of)); + } + + /** + * The subject_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subjectCount() { + return Json.optional(json, "subject_count", Conv.LONG); + } + + /** + * The coverage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional coverage() { + return Json.optional(json, "coverage", Conv.DOUBLE); + } + + /** + * True when this signal links an unusually large number of subjects. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isHub() { + return Json.optional(json, "is_hub", Conv.BOOLEAN); + } + + /** + * The is_datacenter_ip field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDatacenterIp() { + return Json.optional(json, "is_datacenter_ip", Conv.BOOLEAN); + } + + /** + * The is_high_collision_device field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isHighCollisionDevice() { + return Json.optional(json, "is_high_collision_device", Conv.BOOLEAN); + } + + /** + * The node_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeStatus() { + return Json.optional(json, "node_status", Conv.enumeration(NetworkSignal.NodeStatus::of)); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(NetworkNodeTag::fromJson))); + } + + /** + * The risk_evidence field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskEvidence() { + return Json.optional(json, "risk_evidence", Conv.OBJECT); + } + + /** + * The first_seen_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSeenAt() { + return Json.optional(json, "first_seen_at", Conv.DATE_TIME); + } + + /** + * The last_seen_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSeenAt() { + return Json.optional(json, "last_seen_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkSignal}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkSignal from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The signal_type field. + * + * @param signalType the value + * @return this builder + */ + public Builder signalType(NetworkSignal.SignalType signalType) { + return set("signal_type", Conv.enumeration(NetworkSignal.SignalType::of), signalType); + } + + /** + * The subject_count field. + * + * @param subjectCount the value + * @return this builder + */ + public Builder subjectCount(long subjectCount) { + return set("subject_count", Conv.LONG, subjectCount); + } + + /** + * The coverage field. + * + * @param coverage the value + * @return this builder + */ + public Builder coverage(double coverage) { + return set("coverage", Conv.DOUBLE, coverage); + } + + /** + * True when this signal links an unusually large number of subjects. + * + * @param isHub the value + * @return this builder + */ + public Builder isHub(boolean isHub) { + return set("is_hub", Conv.BOOLEAN, isHub); + } + + /** + * The is_datacenter_ip field. + * + * @param isDatacenterIp the value + * @return this builder + */ + public Builder isDatacenterIp(boolean isDatacenterIp) { + return set("is_datacenter_ip", Conv.BOOLEAN, isDatacenterIp); + } + + /** + * The is_high_collision_device field. + * + * @param isHighCollisionDevice the value + * @return this builder + */ + public Builder isHighCollisionDevice(boolean isHighCollisionDevice) { + return set("is_high_collision_device", Conv.BOOLEAN, isHighCollisionDevice); + } + + /** + * The node_status field. + * + * @param nodeStatus the value + * @return this builder + */ + public Builder nodeStatus(NetworkSignal.NodeStatus nodeStatus) { + return set("node_status", Conv.enumeration(NetworkSignal.NodeStatus::of), nodeStatus); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(NetworkNodeTag::fromJson)), tags); + } + + /** + * The risk_evidence field. + * + * @param riskEvidence the value + * @return this builder + */ + public Builder riskEvidence(Map riskEvidence) { + return setAny("risk_evidence", riskEvidence); + } + + /** + * The first_seen_at field. + * + * @param firstSeenAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSeenAt(@Nullable OffsetDateTime firstSeenAt) { + return setNullable("first_seen_at", Conv.DATE_TIME, firstSeenAt); + } + + /** + * The last_seen_at field. + * + * @param lastSeenAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSeenAt(@Nullable OffsetDateTime lastSeenAt) { + return setNullable("last_seen_at", Conv.DATE_TIME, lastSeenAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkSignal} + */ + public NetworkSignal build() { + return new NetworkSignal(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SignalType extends StringEnum { + /** The value {@code "ip_address"}. */ + public static final SignalType IP_ADDRESS = new SignalType("ip_address"); + + /** The value {@code "device"}. */ + public static final SignalType DEVICE = new SignalType("device"); + + /** The value {@code "face"}. */ + public static final SignalType FACE = new SignalType("face"); + + /** The value {@code "document_number"}. */ + public static final SignalType DOCUMENT_NUMBER = new SignalType("document_number"); + + /** The value {@code "phone"}. */ + public static final SignalType PHONE = new SignalType("phone"); + + /** The value {@code "email"}. */ + public static final SignalType EMAIL = new SignalType("email"); + + /** The value {@code "address"}. */ + public static final SignalType ADDRESS = new SignalType("address"); + + private static final List KNOWN_VALUES = List.of(IP_ADDRESS, DEVICE, FACE, DOCUMENT_NUMBER, PHONE, EMAIL, ADDRESS); + + private SignalType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SignalType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SignalType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NodeStatus extends StringEnum { + /** The value {@code "signal_active"}. */ + public static final NodeStatus SIGNAL_ACTIVE = new NodeStatus("signal_active"); + + /** The value {@code "signal_guarded"}. */ + public static final NodeStatus SIGNAL_GUARDED = new NodeStatus("signal_guarded"); + + private static final List KNOWN_VALUES = List.of(SIGNAL_ACTIVE, SIGNAL_GUARDED); + + private NodeStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NodeStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NodeStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworkTimelineEvent.java b/src/main/java/me/didit/types/NetworkTimelineEvent.java new file mode 100644 index 0000000..d1e3341 --- /dev/null +++ b/src/main/java/me/didit/types/NetworkTimelineEvent.java @@ -0,0 +1,160 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class NetworkTimelineEvent extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("event_type", "occurred_at", "label", "metadata"); + + private NetworkTimelineEvent(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkTimelineEvent} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkTimelineEvent fromJson(JsonNode json) { + return new NetworkTimelineEvent(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * e.g. network_detected, signal_observed, network_in_review, network_resolved, network_dismissed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional eventType() { + return Json.optional(json, "event_type", Conv.STRING); + } + + /** + * The occurred_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional occurredAt() { + return Json.optional(json, "occurred_at", Conv.DATE_TIME); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkTimelineEvent}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkTimelineEvent from) { + super(from); + } + + /** + * e.g. network_detected, signal_observed, network_in_review, network_resolved, network_dismissed. + * + * @param eventType the value + * @return this builder + */ + public Builder eventType(String eventType) { + return set("event_type", Conv.STRING, eventType); + } + + /** + * The occurred_at field. + * + * @param occurredAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder occurredAt(@Nullable OffsetDateTime occurredAt) { + return setNullable("occurred_at", Conv.DATE_TIME, occurredAt); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkTimelineEvent} + */ + public NetworkTimelineEvent build() { + return new NetworkTimelineEvent(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksListMembersResponse.java b/src/main/java/me/didit/types/NetworksListMembersResponse.java new file mode 100644 index 0000000..f2aea26 --- /dev/null +++ b/src/main/java/me/didit/types/NetworksListMembersResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class NetworksListMembersResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private NetworksListMembersResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksListMembersResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksListMembersResponse fromJson(JsonNode json) { + return new NetworksListMembersResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(NetworkMember::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksListMembersResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksListMembersResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(NetworkMember::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksListMembersResponse} + */ + public NetworksListMembersResponse build() { + return new NetworksListMembersResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksListParams.java b/src/main/java/me/didit/types/NetworksListParams.java new file mode 100644 index 0000000..50ae985 --- /dev/null +++ b/src/main/java/me/didit/types/NetworksListParams.java @@ -0,0 +1,320 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code networks.list}. */ +public final class NetworksListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "signal_type", "pattern_type", "risk_band", "min_size", "max_size", "date_from", "date_to", "q", "ordering", "limit", "offset"); + + private NetworksListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksListParams fromJson(JsonNode json) { + return new NetworksListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Comma-separated statuses to include: active,in_review,resolved,dismissed. Omit to exclude dismissed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Comma-separated signal types: ip_address,device,face,document_number,phone,email,address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signalType() { + return Json.optional(json, "signal_type", Conv.STRING); + } + + /** + * Comma-separated pattern types, e.g. exact_same_device,same_email. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional patternType() { + return Json.optional(json, "pattern_type", Conv.STRING); + } + + /** + * Comma-separated bands: low,medium,high. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskBand() { + return Json.optional(json, "risk_band", Conv.STRING); + } + + /** + * Minimum member count. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minSize() { + return Json.optional(json, "min_size", Conv.LONG); + } + + /** + * Maximum member count. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxSize() { + return Json.optional(json, "max_size", Conv.LONG); + } + + /** + * Lower bound on last_activity_at (ISO 8601 date or datetime). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateFrom() { + return Json.optional(json, "date_from", Conv.DATE); + } + + /** + * Upper bound on first_activity_at (ISO 8601 date or datetime). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateTo() { + return Json.optional(json, "date_to", Conv.DATE); + } + + /** + * Free-text search across network name, member names, the network_id (N-0001), and exact pattern_type tokens. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional q() { + return Json.optional(json, "q", Conv.STRING); + } + + /** + * One of risk_score, -risk_score, last_activity_at, -last_activity_at, first_activity_at, -first_activity_at, network_number, -network_number. Defaults to -risk_score,-last_activity_at. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + /** + * Page size, 1-500. Defaults to 100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset of the first record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksListParams from) { + super(from); + } + + /** + * Comma-separated statuses to include: active,in_review,resolved,dismissed. Omit to exclude dismissed. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Comma-separated signal types: ip_address,device,face,document_number,phone,email,address. + * + * @param signalType the value + * @return this builder + */ + public Builder signalType(String signalType) { + return set("signal_type", Conv.STRING, signalType); + } + + /** + * Comma-separated pattern types, e.g. exact_same_device,same_email. + * + * @param patternType the value + * @return this builder + */ + public Builder patternType(String patternType) { + return set("pattern_type", Conv.STRING, patternType); + } + + /** + * Comma-separated bands: low,medium,high. + * + * @param riskBand the value + * @return this builder + */ + public Builder riskBand(String riskBand) { + return set("risk_band", Conv.STRING, riskBand); + } + + /** + * Minimum member count. + * + * @param minSize the value + * @return this builder + */ + public Builder minSize(long minSize) { + return set("min_size", Conv.LONG, minSize); + } + + /** + * Maximum member count. + * + * @param maxSize the value + * @return this builder + */ + public Builder maxSize(long maxSize) { + return set("max_size", Conv.LONG, maxSize); + } + + /** + * Lower bound on last_activity_at (ISO 8601 date or datetime). + * + * @param dateFrom the value + * @return this builder + */ + public Builder dateFrom(LocalDate dateFrom) { + return set("date_from", Conv.DATE, dateFrom); + } + + /** + * Upper bound on first_activity_at (ISO 8601 date or datetime). + * + * @param dateTo the value + * @return this builder + */ + public Builder dateTo(LocalDate dateTo) { + return set("date_to", Conv.DATE, dateTo); + } + + /** + * Free-text search across network name, member names, the network_id (N-0001), and exact pattern_type tokens. + * + * @param q the value + * @return this builder + */ + public Builder q(String q) { + return set("q", Conv.STRING, q); + } + + /** + * One of risk_score, -risk_score, last_activity_at, -last_activity_at, first_activity_at, -first_activity_at, network_number, -network_number. Defaults to -risk_score,-last_activity_at. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Page size, 1-500. Defaults to 100. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset of the first record. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksListParams} + */ + public NetworksListParams build() { + return new NetworksListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksListResponse.java b/src/main/java/me/didit/types/NetworksListResponse.java new file mode 100644 index 0000000..80a409d --- /dev/null +++ b/src/main/java/me/didit/types/NetworksListResponse.java @@ -0,0 +1,345 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class NetworksListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results", "kpis"); + + private NetworksListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksListResponse fromJson(JsonNode json) { + return new NetworksListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Offset of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.LONG); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.LONG); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(NetworkListItem::fromJson))); + } + + /** + * Each key is {value, delta} over the results matching the current filters. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kpis() { + return Json.optional(json, "kpis", Conv.model(NetworksListResponse.Kpis::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksListResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Offset of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable Long next) { + return setNullable("next", Conv.LONG, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable Long previous) { + return setNullable("previous", Conv.LONG, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(NetworkListItem::fromJson)), results); + } + + /** + * Each key is {value, delta} over the results matching the current filters. + * + * @param kpis the value + * @return this builder + */ + public Builder kpis(NetworksListResponse.Kpis kpis) { + return set("kpis", Conv.model(NetworksListResponse.Kpis::fromJson), kpis); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksListResponse} + */ + public NetworksListResponse build() { + return new NetworksListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Each key is {value, delta} over the results matching the current filters. */ + public static final class Kpis extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("active", "in_review", "applicants_involved", "detected_this_period", "false_positive_rate"); + + private Kpis(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Kpis} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Kpis fromJson(JsonNode json) { + return new Kpis(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> active() { + return Json.optional(json, "active", Conv.OBJECT); + } + + /** + * The in_review field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> inReview() { + return Json.optional(json, "in_review", Conv.OBJECT); + } + + /** + * The applicants_involved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> applicantsInvolved() { + return Json.optional(json, "applicants_involved", Conv.OBJECT); + } + + /** + * The detected_this_period field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> detectedThisPeriod() { + return Json.optional(json, "detected_this_period", Conv.OBJECT); + } + + /** + * The false_positive_rate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> falsePositiveRate() { + return Json.optional(json, "false_positive_rate", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Kpis}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Kpis from) { + super(from); + } + + /** + * The active field. + * + * @param active the value + * @return this builder + */ + public Builder active(Map active) { + return setAny("active", active); + } + + /** + * The in_review field. + * + * @param inReview the value + * @return this builder + */ + public Builder inReview(Map inReview) { + return setAny("in_review", inReview); + } + + /** + * The applicants_involved field. + * + * @param applicantsInvolved the value + * @return this builder + */ + public Builder applicantsInvolved(Map applicantsInvolved) { + return setAny("applicants_involved", applicantsInvolved); + } + + /** + * The detected_this_period field. + * + * @param detectedThisPeriod the value + * @return this builder + */ + public Builder detectedThisPeriod(Map detectedThisPeriod) { + return setAny("detected_this_period", detectedThisPeriod); + } + + /** + * The false_positive_rate field. + * + * @param falsePositiveRate the value + * @return this builder + */ + public Builder falsePositiveRate(Map falsePositiveRate) { + return setAny("false_positive_rate", falsePositiveRate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Kpis} + */ + public Kpis build() { + return new Kpis(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/NetworksListSignalsResponse.java b/src/main/java/me/didit/types/NetworksListSignalsResponse.java new file mode 100644 index 0000000..d3d89ab --- /dev/null +++ b/src/main/java/me/didit/types/NetworksListSignalsResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class NetworksListSignalsResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private NetworksListSignalsResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksListSignalsResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksListSignalsResponse fromJson(JsonNode json) { + return new NetworksListSignalsResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(NetworkSignal::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksListSignalsResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksListSignalsResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(NetworkSignal::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksListSignalsResponse} + */ + public NetworksListSignalsResponse build() { + return new NetworksListSignalsResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksNotesCreateParams.java b/src/main/java/me/didit/types/NetworksNotesCreateParams.java new file mode 100644 index 0000000..24bf044 --- /dev/null +++ b/src/main/java/me/didit/types/NetworksNotesCreateParams.java @@ -0,0 +1,121 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code networks.notes.create}. */ +public final class NetworksNotesCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("comment", "client_reference"); + + private NetworksNotesCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksNotesCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksNotesCreateParams fromJson(JsonNode json) { + return new NetworksNotesCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The comment field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String comment() { + return Json.required(json, "comment", Conv.STRING); + } + + /** + * The client_reference field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String clientReference() { + return Json.required(json, "client_reference", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksNotesCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksNotesCreateParams from) { + super(from); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * The client_reference field. + * + * @param clientReference the value + * @return this builder + */ + public Builder clientReference(String clientReference) { + return set("client_reference", Conv.STRING, clientReference); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksNotesCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public NetworksNotesCreateParams build() { + require("comment", false); + require("client_reference", false); + return new NetworksNotesCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksNotesListParams.java b/src/main/java/me/didit/types/NetworksNotesListParams.java new file mode 100644 index 0000000..8192872 --- /dev/null +++ b/src/main/java/me/didit/types/NetworksNotesListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code networks.notes.list}. */ +public final class NetworksNotesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private NetworksNotesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksNotesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksNotesListParams fromJson(JsonNode json) { + return new NetworksNotesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The limit field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksNotesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksNotesListParams from) { + super(from); + } + + /** + * The limit field. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksNotesListParams} + */ + public NetworksNotesListParams build() { + return new NetworksNotesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksNotesListResponse.java b/src/main/java/me/didit/types/NetworksNotesListResponse.java new file mode 100644 index 0000000..06790e4 --- /dev/null +++ b/src/main/java/me/didit/types/NetworksNotesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class NetworksNotesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private NetworksNotesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksNotesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksNotesListResponse fromJson(JsonNode json) { + return new NetworksNotesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(NetworkNote::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksNotesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksNotesListResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(NetworkNote::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksNotesListResponse} + */ + public NetworksNotesListResponse build() { + return new NetworksNotesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/NetworksRetrieveGraphParams.java b/src/main/java/me/didit/types/NetworksRetrieveGraphParams.java new file mode 100644 index 0000000..3f3ff7c --- /dev/null +++ b/src/main/java/me/didit/types/NetworksRetrieveGraphParams.java @@ -0,0 +1,233 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code networks.retrieve_graph}. */ +public final class NetworksRetrieveGraphParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("depth", "focus_kind", "focus_id"); + + private NetworksRetrieveGraphParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksRetrieveGraphParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksRetrieveGraphParams fromJson(JsonNode json) { + return new NetworksRetrieveGraphParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Hops from the focus subject to include. Defaults to all (unbounded). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional depth() { + return Json.optional(json, "depth", Conv.enumeration(NetworksRetrieveGraphParams.Depth::of)); + } + + /** + * Subject type to center the graph on. Must be supplied together with focus_id; defaults to an arbitrary member when depth is bounded and neither is supplied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional focusKind() { + return Json.optional(json, "focus_kind", Conv.enumeration(NetworksRetrieveGraphParams.FocusKind::of)); + } + + /** + * Subject UUID to center the graph on. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional focusId() { + return Json.optional(json, "focus_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksRetrieveGraphParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksRetrieveGraphParams from) { + super(from); + } + + /** + * Hops from the focus subject to include. Defaults to all (unbounded). + * + * @param depth the value + * @return this builder + */ + public Builder depth(NetworksRetrieveGraphParams.Depth depth) { + return set("depth", Conv.enumeration(NetworksRetrieveGraphParams.Depth::of), depth); + } + + /** + * Subject type to center the graph on. Must be supplied together with focus_id; defaults to an arbitrary member when depth is bounded and neither is supplied. + * + * @param focusKind the value + * @return this builder + */ + public Builder focusKind(NetworksRetrieveGraphParams.FocusKind focusKind) { + return set("focus_kind", Conv.enumeration(NetworksRetrieveGraphParams.FocusKind::of), focusKind); + } + + /** + * Subject UUID to center the graph on. + * + * @param focusId the value + * @return this builder + */ + public Builder focusId(String focusId) { + return set("focus_id", Conv.STRING, focusId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksRetrieveGraphParams} + */ + public NetworksRetrieveGraphParams build() { + return new NetworksRetrieveGraphParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Depth extends StringEnum { + /** The value {@code "1"}. */ + public static final Depth _1 = new Depth("1"); + + /** The value {@code "2"}. */ + public static final Depth _2 = new Depth("2"); + + /** The value {@code "3"}. */ + public static final Depth _3 = new Depth("3"); + + /** The value {@code "all"}. */ + public static final Depth ALL = new Depth("all"); + + private static final List KNOWN_VALUES = List.of(_1, _2, _3, ALL); + + private Depth(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Depth of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Depth::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class FocusKind extends StringEnum { + /** The value {@code "vendor_user"}. */ + public static final FocusKind VENDOR_USER = new FocusKind("vendor_user"); + + /** The value {@code "vendor_business"}. */ + public static final FocusKind VENDOR_BUSINESS = new FocusKind("vendor_business"); + + /** The value {@code "transaction_party"}. */ + public static final FocusKind TRANSACTION_PARTY = new FocusKind("transaction_party"); + + private static final List KNOWN_VALUES = List.of(VENDOR_USER, VENDOR_BUSINESS, TRANSACTION_PARTY); + + private FocusKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FocusKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FocusKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/NetworksRetrieveTimelineResponse.java b/src/main/java/me/didit/types/NetworksRetrieveTimelineResponse.java new file mode 100644 index 0000000..eeca76e --- /dev/null +++ b/src/main/java/me/didit/types/NetworksRetrieveTimelineResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class NetworksRetrieveTimelineResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private NetworksRetrieveTimelineResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworksRetrieveTimelineResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworksRetrieveTimelineResponse fromJson(JsonNode json) { + return new NetworksRetrieveTimelineResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(NetworkTimelineEvent::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworksRetrieveTimelineResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworksRetrieveTimelineResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(NetworkTimelineEvent::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworksRetrieveTimelineResponse} + */ + public NetworksRetrieveTimelineResponse build() { + return new NetworksRetrieveTimelineResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/Organization.java b/src/main/java/me/didit/types/Organization.java new file mode 100644 index 0000000..c471aae --- /dev/null +++ b/src/main/java/me/didit/types/Organization.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class Organization extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "contact_email", "created_at"); + + private Organization(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Organization} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Organization fromJson(JsonNode json) { + return new Organization(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Use as {org_id} on the application endpoints. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Display name of the organization. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Primary contact email for the organization. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contactEmail() { + return Json.optional(json, "contact_email", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Organization}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Organization from) { + super(from); + } + + /** + * Use as {org_id} on the application endpoints. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Display name of the organization. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Primary contact email for the organization. + * + * @param contactEmail the value + * @return this builder + */ + public Builder contactEmail(String contactEmail) { + return set("contact_email", Conv.STRING, contactEmail); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Organization} + */ + public Organization build() { + return new Organization(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/OrganizationSummary.java b/src/main/java/me/didit/types/OrganizationSummary.java new file mode 100644 index 0000000..6a328b5 --- /dev/null +++ b/src/main/java/me/didit/types/OrganizationSummary.java @@ -0,0 +1,121 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** + * Minimal organization shape returned inline by POST /programmatic/verify-email/. + */ +public final class OrganizationSummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name"); + + private OrganizationSummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code OrganizationSummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static OrganizationSummary fromJson(JsonNode json) { + return new OrganizationSummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link OrganizationSummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(OrganizationSummary from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Builds the value. + * + * @return a new immutable {@code OrganizationSummary} + */ + public OrganizationSummary build() { + return new OrganizationSummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/PassiveLivenessCheckParams.java b/src/main/java/me/didit/types/PassiveLivenessCheckParams.java new file mode 100644 index 0000000..d69ead2 --- /dev/null +++ b/src/main/java/me/didit/types/PassiveLivenessCheckParams.java @@ -0,0 +1,211 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code passive_liveness.check}. */ +public final class PassiveLivenessCheckParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user_image", "face_liveness_score_decline_threshold", "rotate_image", "save_api_request", "vendor_data", "metadata"); + + private PassiveLivenessCheckParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PassiveLivenessCheckParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PassiveLivenessCheckParams fromJson(JsonNode json) { + return new PassiveLivenessCheckParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Front-facing face image (e.g. a selfie). Allowed extensions: tiff, jpg, jpeg, png, webp. Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not improve accuracy. The image should contain a single subject โ€” when several faces are present, the largest one is evaluated and a MULTIPLE_FACES_DETECTED warning is added. + * + * @return the file to upload, if set + */ + public Optional userImage() { + return file("user_image"); + } + + /** + * Liveness score threshold (0โ€“100). A computed score at or below this value emits a LOW_LIVENESS_SCORE warning and sets status to Declined. Default 30; raise it for a stricter anti-spoofing posture. Values outside 0โ€“100 return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceLivenessScoreDeclineThreshold() { + return Json.optional(json, "face_liveness_score_decline_threshold", Conv.DOUBLE); + } + + /** + * When true, the service tries 90-degree rotations of the input and uses the orientation that yields the best face detection. Useful when EXIF orientation is missing. Adds latency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rotateImage() { + return Json.optional(json, "rotate_image", Conv.BOOLEAN); + } + + /** + * When true (default), persists the call as an API-type session, stores the face images, emits a status.updated webhook, and enrolls the detected face into your face search index. When false, the call is one-shot โ€” nothing is stored and the face is not enrolled. Blocklist and duplicate screening run either way. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque identifier (your user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back. Also used to exclude prior sessions with the same vendor_data from the duplicate-face check, so re-verifying the same user does not raise DUPLICATED_FACE. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back. In multipart requests, send it as a JSON-encoded string field โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PassiveLivenessCheckParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PassiveLivenessCheckParams from) { + super(from); + } + + /** + * Front-facing face image (e.g. a selfie). Allowed extensions: tiff, jpg, jpeg, png, webp. Maximum upload size: 5 MB (larger files are rejected with 400). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not improve accuracy. The image should contain a single subject โ€” when several faces are present, the largest one is evaluated and a MULTIPLE_FACES_DETECTED warning is added. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(FileUpload userImage) { + return setFile("user_image", userImage); + } + + /** + * Uploads the file at {@code path} as {@code user_image}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder userImage(Path path) { + return setFile("user_image", FileUpload.of(path)); + } + + /** + * Liveness score threshold (0โ€“100). A computed score at or below this value emits a LOW_LIVENESS_SCORE warning and sets status to Declined. Default 30; raise it for a stricter anti-spoofing posture. Values outside 0โ€“100 return 400. + * + * @param faceLivenessScoreDeclineThreshold the value + * @return this builder + */ + public Builder faceLivenessScoreDeclineThreshold(double faceLivenessScoreDeclineThreshold) { + return set("face_liveness_score_decline_threshold", Conv.DOUBLE, faceLivenessScoreDeclineThreshold); + } + + /** + * When true, the service tries 90-degree rotations of the input and uses the orientation that yields the best face detection. Useful when EXIF orientation is missing. Adds latency. + * + * @param rotateImage the value + * @return this builder + */ + public Builder rotateImage(boolean rotateImage) { + return set("rotate_image", Conv.BOOLEAN, rotateImage); + } + + /** + * When true (default), persists the call as an API-type session, stores the face images, emits a status.updated webhook, and enrolls the detected face into your face search index. When false, the call is one-shot โ€” nothing is stored and the face is not enrolled. Blocklist and duplicate screening run either way. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque identifier (your user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back. Also used to exclude prior sessions with the same vendor_data from the duplicate-face check, so re-verifying the same user does not raise DUPLICATED_FACE. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back. In multipart requests, send it as a JSON-encoded string field โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PassiveLivenessCheckParams} + * @throws IllegalStateException when a required field is missing + */ + public PassiveLivenessCheckParams build() { + requireFile("user_image"); + return new PassiveLivenessCheckParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/PassiveLivenessCheckResponse.java b/src/main/java/me/didit/types/PassiveLivenessCheckResponse.java new file mode 100644 index 0000000..8af0300 --- /dev/null +++ b/src/main/java/me/didit/types/PassiveLivenessCheckResponse.java @@ -0,0 +1,1072 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class PassiveLivenessCheckResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "liveness", "vendor_data", "metadata", "created_at"); + + private PassiveLivenessCheckResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PassiveLivenessCheckResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PassiveLivenessCheckResponse fromJson(JsonNode json) { + return new PassiveLivenessCheckResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The liveness field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional liveness() { + return Json.optional(json, "liveness", Conv.model(PassiveLivenessCheckResponse.Liveness::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated, e.g. 2026-06-12T01:04:42.763237+00:00. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PassiveLivenessCheckResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PassiveLivenessCheckResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The liveness field. + * + * @param liveness the value + * @return this builder + */ + public Builder liveness(PassiveLivenessCheckResponse.Liveness liveness) { + return set("liveness", Conv.model(PassiveLivenessCheckResponse.Liveness::fromJson), liveness); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated, e.g. 2026-06-12T01:04:42.763237+00:00. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PassiveLivenessCheckResponse} + */ + public PassiveLivenessCheckResponse build() { + return new PassiveLivenessCheckResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Liveness extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "method", "score", "user_image", "warnings", "face_quality", "face_luminance"); + + private Liveness(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Liveness} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Liveness fromJson(JsonNode json) { + return new Liveness(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Declined when at least one error-severity warning fired (no face, low score, presentation attack, or a blocklist hit); Approved otherwise. warning/information entries (multiple faces, duplicates) never decline on their own. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Status::of)); + } + + /** + * Always PASSIVE for this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional method() { + return Json.optional(json, "method", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Method::of)); + } + + /** + * Liveness confidence (0โ€“100, two decimals) that the image depicts a live person rather than a spoof. null when the model returned no confidence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Face-detection results for the submitted image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userImage() { + return Json.optional(json, "user_image", Conv.model(PassiveLivenessCheckResponse.Liveness.UserImage::fromJson)); + } + + /** + * Risk signals. error severity (declines): NO_FACE_DETECTED, LOW_LIVENESS_SCORE (score at or below the threshold), LIVENESS_FACE_ATTACK, FACE_IN_BLOCKLIST, POSSIBLE_FACE_IN_BLOCKLIST. warning severity (review, no decline): MULTIPLE_FACES_DETECTED. information severity (no decline): DUPLICATED_FACE, POSSIBLE_DUPLICATED_FACE โ€” the same face already appeared in another approved session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(PassiveLivenessCheckResponse.Liveness.Warnings::fromJson))); + } + + /** + * Capture-quality score of the detected face, normalized to 0โ€“100. null when the model could not produce a reliable value. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceQuality() { + return Json.optional(json, "face_quality", Conv.DOUBLE); + } + + /** + * Brightness of the detected face, normalized to 0โ€“100. null when unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceLuminance() { + return Json.optional(json, "face_luminance", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Liveness}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Liveness from) { + super(from); + } + + /** + * Declined when at least one error-severity warning fired (no face, low score, presentation attack, or a blocklist hit); Approved otherwise. warning/information entries (multiple faces, duplicates) never decline on their own. + * + * @param status the value + * @return this builder + */ + public Builder status(PassiveLivenessCheckResponse.Liveness.Status status) { + return set("status", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Status::of), status); + } + + /** + * Always PASSIVE for this endpoint. + * + * @param method the value + * @return this builder + */ + public Builder method(PassiveLivenessCheckResponse.Liveness.Method method) { + return set("method", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Method::of), method); + } + + /** + * Liveness confidence (0โ€“100, two decimals) that the image depicts a live person rather than a spoof. null when the model returned no confidence. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Face-detection results for the submitted image. + * + * @param userImage the value + * @return this builder + */ + public Builder userImage(PassiveLivenessCheckResponse.Liveness.UserImage userImage) { + return set("user_image", Conv.model(PassiveLivenessCheckResponse.Liveness.UserImage::fromJson), userImage); + } + + /** + * Risk signals. error severity (declines): NO_FACE_DETECTED, LOW_LIVENESS_SCORE (score at or below the threshold), LIVENESS_FACE_ATTACK, FACE_IN_BLOCKLIST, POSSIBLE_FACE_IN_BLOCKLIST. warning severity (review, no decline): MULTIPLE_FACES_DETECTED. information severity (no decline): DUPLICATED_FACE, POSSIBLE_DUPLICATED_FACE โ€” the same face already appeared in another approved session. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(PassiveLivenessCheckResponse.Liveness.Warnings::fromJson)), warnings); + } + + /** + * Capture-quality score of the detected face, normalized to 0โ€“100. null when the model could not produce a reliable value. + * + * @param faceQuality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceQuality(@Nullable Double faceQuality) { + return setNullable("face_quality", Conv.DOUBLE, faceQuality); + } + + /** + * Brightness of the detected face, normalized to 0โ€“100. null when unavailable. + * + * @param faceLuminance the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceLuminance(@Nullable Double faceLuminance) { + return setNullable("face_luminance", Conv.DOUBLE, faceLuminance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Liveness} + */ + public Liveness build() { + return new Liveness(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Declined when at least one error-severity warning fired (no face, low score, presentation attack, or a blocklist hit); Approved otherwise. warning/information entries (multiple faces, duplicates) never decline on their own. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Always PASSIVE for this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Method extends StringEnum { + /** The value {@code "PASSIVE"}. */ + public static final Method PASSIVE = new Method("PASSIVE"); + + private static final List KNOWN_VALUES = List.of(PASSIVE); + + private Method(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Method of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Method::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Face-detection results for the submitted image. */ + public static final class UserImage extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entities", "best_angle"); + + private UserImage(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserImage} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserImage fromJson(JsonNode json) { + return new UserImage(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * One entry per detected face. The largest face is the one evaluated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> entities() { + return Json.optional(json, "entities", Conv.list(Conv.model(PassiveLivenessCheckResponse.Liveness.UserImage.Entities::fromJson))); + } + + /** + * Rotation (degrees) that produced the best face detection; non-zero only when rotate_image=true corrected the orientation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bestAngle() { + return Json.optional(json, "best_angle", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserImage}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserImage from) { + super(from); + } + + /** + * One entry per detected face. The largest face is the one evaluated. + * + * @param entities the value + * @return this builder + */ + public Builder entities(List entities) { + return set("entities", Conv.list(Conv.model(PassiveLivenessCheckResponse.Liveness.UserImage.Entities::fromJson)), entities); + } + + /** + * Rotation (degrees) that produced the best face detection; non-zero only when rotate_image=true corrected the orientation. + * + * @param bestAngle the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bestAngle(@Nullable Long bestAngle) { + return setNullable("best_angle", Conv.LONG, bestAngle); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserImage} + */ + public UserImage build() { + return new UserImage(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Entities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bbox", "confidence", "age", "gender", "race"); + + private Entities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Entities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Entities fromJson(JsonNode json) { + return new Entities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> bbox() { + return Json.optional(json, "bbox", Conv.list(Conv.LONG)); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + /** + * Model-estimated age of the detected face, in years. Informational only โ€” it does not affect the liveness decision. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional age() { + return Json.optional(json, "age", Conv.DOUBLE); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * Reserved field โ€” always null in responses from this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional race() { + return Json.optional(json, "race", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Entities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Entities from) { + super(from); + } + + /** + * Bounding box of the detected face as [x_min, y_min, x_max, y_max] pixel coordinates in the processed image. + * + * @param bbox the value + * @return this builder + */ + public Builder bbox(List bbox) { + return set("bbox", Conv.list(Conv.LONG), bbox); + } + + /** + * Face-detection confidence (0โ€“1). + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * Model-estimated age of the detected face, in years. Informational only โ€” it does not affect the liveness decision. + * + * @param age the value + * @return this builder + */ + public Builder age(double age) { + return set("age", Conv.DOUBLE, age); + } + + /** + * Model-predicted gender of the detected face (male or female). Informational only. + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * Reserved field โ€” always null in responses from this endpoint. + * + * @param race the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder race(@Nullable String race) { + return setNullable("race", Conv.STRING, race); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Entities} + */ + public Entities build() { + return new Entities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Warnings.Risk::of)); + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Warnings.Feature::of)); + } + + /** + * null for most warnings. Blocklist hits carry {blocklisted_session_id, blocklisted_session_number, api_service}; duplicate hits carry {duplicated_session_id, duplicated_session_number, api_service} pointing at the matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. + * + * @param risk the value + * @return this builder + */ + public Builder risk(PassiveLivenessCheckResponse.Liveness.Warnings.Risk risk) { + return set("risk", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Warnings.Risk::of), risk); + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(PassiveLivenessCheckResponse.Liveness.Warnings.Feature feature) { + return set("feature", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Warnings.Feature::of), feature); + } + + /** + * null for most warnings. Blocklist hits carry {blocklisted_session_id, blocklisted_session_number, api_service}; duplicate hits carry {duplicated_session_id, duplicated_session_number, api_service} pointing at the matching session. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + * @param logType the value + * @return this builder + */ + public Builder logType(PassiveLivenessCheckResponse.Liveness.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(PassiveLivenessCheckResponse.Liveness.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Machine-readable risk code. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Risk extends StringEnum { + /** The value {@code "NO_FACE_DETECTED"}. */ + public static final Risk NO_FACE_DETECTED = new Risk("NO_FACE_DETECTED"); + + /** The value {@code "LOW_LIVENESS_SCORE"}. */ + public static final Risk LOW_LIVENESS_SCORE = new Risk("LOW_LIVENESS_SCORE"); + + /** The value {@code "LIVENESS_FACE_ATTACK"}. */ + public static final Risk LIVENESS_FACE_ATTACK = new Risk("LIVENESS_FACE_ATTACK"); + + /** The value {@code "MULTIPLE_FACES_DETECTED"}. */ + public static final Risk MULTIPLE_FACES_DETECTED = new Risk("MULTIPLE_FACES_DETECTED"); + + /** The value {@code "FACE_IN_BLOCKLIST"}. */ + public static final Risk FACE_IN_BLOCKLIST = new Risk("FACE_IN_BLOCKLIST"); + + /** The value {@code "POSSIBLE_FACE_IN_BLOCKLIST"}. */ + public static final Risk POSSIBLE_FACE_IN_BLOCKLIST = new Risk("POSSIBLE_FACE_IN_BLOCKLIST"); + + /** The value {@code "DUPLICATED_FACE"}. */ + public static final Risk DUPLICATED_FACE = new Risk("DUPLICATED_FACE"); + + /** The value {@code "POSSIBLE_DUPLICATED_FACE"}. */ + public static final Risk POSSIBLE_DUPLICATED_FACE = new Risk("POSSIBLE_DUPLICATED_FACE"); + + private static final List KNOWN_VALUES = List.of(NO_FACE_DETECTED, LOW_LIVENESS_SCORE, LIVENESS_FACE_ATTACK, MULTIPLE_FACES_DETECTED, FACE_IN_BLOCKLIST, POSSIBLE_FACE_IN_BLOCKLIST, DUPLICATED_FACE, POSSIBLE_DUPLICATED_FACE); + + private Risk(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Risk of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Risk::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Feature that raised the warning. Always LIVENESS on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + private static final List KNOWN_VALUES = List.of(LIVENESS); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity. error warnings drive status to Declined; warning and information entries are advisory and never decline on their own. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/PhoneCheckCodeParams.java b/src/main/java/me/didit/types/PhoneCheckCodeParams.java new file mode 100644 index 0000000..c4b9ae6 --- /dev/null +++ b/src/main/java/me/didit/types/PhoneCheckCodeParams.java @@ -0,0 +1,395 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code phone.check_code}. */ +public final class PhoneCheckCodeParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("phone_number", "code", "duplicated_phone_number_action", "disposable_number_action", "voip_number_action", "enable_social", "phone_no_social_presence_action"); + + private PhoneCheckCodeParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneCheckCodeParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneCheckCodeParams fromJson(JsonNode json) { + return new PhoneCheckCodeParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The same phone number used in the matching [POST /v3/phone/send/](/standalone-apis/phone-send) call, in E.164 format. This is what links the check to the send. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String phoneNumber() { + return Json.required(json, "phone_number", Conv.STRING); + } + + /** + * The OTP the end user received. Must be 4โ€“8 numeric digits โ€” anything else returns 400 without consuming an attempt. A well-formed but wrong code returns 200 with status: "Failed" and consumes one of the 3 attempts. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String code() { + return Json.required(json, "code", Conv.STRING); + } + + /** + * What to do when the same number was already used by a different user (different vendor_data) of your application. DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings and fills phone.matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional duplicatedPhoneNumberAction() { + return Json.optional(json, "duplicated_phone_number_action", Conv.enumeration(PhoneCheckCodeParams.DuplicatedPhoneNumberAction::of)); + } + + /** + * What to do when the carrier lookup flags the number as a temporary/burner line (phone.is_disposable). DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disposableNumberAction() { + return Json.optional(json, "disposable_number_action", Conv.enumeration(PhoneCheckCodeParams.DisposableNumberAction::of)); + } + + /** + * What to do when the carrier lookup reports a virtual line type โ€” voip, isp, or vpn (phone.is_virtual). DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional voipNumberAction() { + return Json.optional(json, "voip_number_action", Conv.enumeration(PhoneCheckCodeParams.VoipNumberAction::of)); + } + + /** + * When true, also look up the social footprint of the number - the messaging, social, e-commerce and professional platforms it is registered on. Billed as one phone_social unit per request in addition to this endpoint's own price. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enableSocial() { + return Json.optional(json, "enable_social", Conv.BOOLEAN); + } + + /** + * Action when the social footprint check finds the number registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint; REVIEW is available on the workflow configuration key of the same name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNoSocialPresenceAction() { + return Json.optional(json, "phone_no_social_presence_action", Conv.enumeration(PhoneCheckCodeParams.PhoneNoSocialPresenceAction::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneCheckCodeParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneCheckCodeParams from) { + super(from); + } + + /** + * The same phone number used in the matching [POST /v3/phone/send/](/standalone-apis/phone-send) call, in E.164 format. This is what links the check to the send. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * The OTP the end user received. Must be 4โ€“8 numeric digits โ€” anything else returns 400 without consuming an attempt. A well-formed but wrong code returns 200 with status: "Failed" and consumes one of the 3 attempts. + * + * @param code the value + * @return this builder + */ + public Builder code(String code) { + return set("code", Conv.STRING, code); + } + + /** + * What to do when the same number was already used by a different user (different vendor_data) of your application. DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings and fills phone.matches. + * + * @param duplicatedPhoneNumberAction the value + * @return this builder + */ + public Builder duplicatedPhoneNumberAction(PhoneCheckCodeParams.DuplicatedPhoneNumberAction duplicatedPhoneNumberAction) { + return set("duplicated_phone_number_action", Conv.enumeration(PhoneCheckCodeParams.DuplicatedPhoneNumberAction::of), duplicatedPhoneNumberAction); + } + + /** + * What to do when the carrier lookup flags the number as a temporary/burner line (phone.is_disposable). DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings. + * + * @param disposableNumberAction the value + * @return this builder + */ + public Builder disposableNumberAction(PhoneCheckCodeParams.DisposableNumberAction disposableNumberAction) { + return set("disposable_number_action", Conv.enumeration(PhoneCheckCodeParams.DisposableNumberAction::of), disposableNumberAction); + } + + /** + * What to do when the carrier lookup reports a virtual line type โ€” voip, isp, or vpn (phone.is_virtual). DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings. + * + * @param voipNumberAction the value + * @return this builder + */ + public Builder voipNumberAction(PhoneCheckCodeParams.VoipNumberAction voipNumberAction) { + return set("voip_number_action", Conv.enumeration(PhoneCheckCodeParams.VoipNumberAction::of), voipNumberAction); + } + + /** + * When true, also look up the social footprint of the number - the messaging, social, e-commerce and professional platforms it is registered on. Billed as one phone_social unit per request in addition to this endpoint's own price. + * + * @param enableSocial the value + * @return this builder + */ + public Builder enableSocial(boolean enableSocial) { + return set("enable_social", Conv.BOOLEAN, enableSocial); + } + + /** + * Action when the social footprint check finds the number registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint; REVIEW is available on the workflow configuration key of the same name. + * + * @param phoneNoSocialPresenceAction the value + * @return this builder + */ + public Builder phoneNoSocialPresenceAction(PhoneCheckCodeParams.PhoneNoSocialPresenceAction phoneNoSocialPresenceAction) { + return set("phone_no_social_presence_action", Conv.enumeration(PhoneCheckCodeParams.PhoneNoSocialPresenceAction::of), phoneNoSocialPresenceAction); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneCheckCodeParams} + * @throws IllegalStateException when a required field is missing + */ + public PhoneCheckCodeParams build() { + require("phone_number", false); + require("code", false); + return new PhoneCheckCodeParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What to do when the same number was already used by a different user (different vendor_data) of your application. DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings and fills phone.matches. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DuplicatedPhoneNumberAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final DuplicatedPhoneNumberAction NO_ACTION = new DuplicatedPhoneNumberAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final DuplicatedPhoneNumberAction DECLINE = new DuplicatedPhoneNumberAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private DuplicatedPhoneNumberAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DuplicatedPhoneNumberAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DuplicatedPhoneNumberAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the carrier lookup flags the number as a temporary/burner line (phone.is_disposable). DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DisposableNumberAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final DisposableNumberAction NO_ACTION = new DisposableNumberAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final DisposableNumberAction DECLINE = new DisposableNumberAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private DisposableNumberAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DisposableNumberAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DisposableNumberAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the carrier lookup reports a virtual line type โ€” voip, isp, or vpn (phone.is_virtual). DECLINE flips the final status to Declined; NO_ACTION records the risk in phone.warnings. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VoipNumberAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final VoipNumberAction NO_ACTION = new VoipNumberAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final VoipNumberAction DECLINE = new VoipNumberAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private VoipNumberAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VoipNumberAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VoipNumberAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Action when the social footprint check finds the number registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint; REVIEW is available on the workflow configuration key of the same name. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PhoneNoSocialPresenceAction extends StringEnum { + /** The value {@code "NO_ACTION"}. */ + public static final PhoneNoSocialPresenceAction NO_ACTION = new PhoneNoSocialPresenceAction("NO_ACTION"); + + /** The value {@code "DECLINE"}. */ + public static final PhoneNoSocialPresenceAction DECLINE = new PhoneNoSocialPresenceAction("DECLINE"); + + private static final List KNOWN_VALUES = List.of(NO_ACTION, DECLINE); + + private PhoneNoSocialPresenceAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PhoneNoSocialPresenceAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PhoneNoSocialPresenceAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/PhoneIntelligence.java b/src/main/java/me/didit/types/PhoneIntelligence.java new file mode 100644 index 0000000..334d49c --- /dev/null +++ b/src/main/java/me/didit/types/PhoneIntelligence.java @@ -0,0 +1,262 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Normalized phone-intelligence block. Present only when the intelligence add-on ran for this lookup; when present it is also exposed under the enrichment alias with identical values. + */ +public final class PhoneIntelligence extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "phone_type_risk", "phone_trust_index", "network_stability_index", "is_disposable", "is_ported", "is_recently_ported", "carrier_type", "reason_codes"); + + private PhoneIntelligence(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneIntelligence} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneIntelligence fromJson(JsonNode json) { + return new PhoneIntelligence(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Normalized 0-100 risk score. Higher is riskier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Low, Medium or High, derived from the score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneTypeRisk() { + return Json.optional(json, "phone_type_risk", Conv.STRING); + } + + /** + * Inverse of the score, for dashboards that prefer higher is better. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneTrustIndex() { + return Json.optional(json, "phone_trust_index", Conv.DOUBLE); + } + + /** + * Stability of the line's network. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkStabilityIndex() { + return Json.optional(json, "network_stability_index", Conv.DOUBLE); + } + + /** + * true when the number looks disposable or virtual. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * true when the number has moved carrier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isPorted() { + return Json.optional(json, "is_ported", Conv.BOOLEAN); + } + + /** + * true when the port happened recently. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isRecentlyPorted() { + return Json.optional(json, "is_recently_ported", Conv.BOOLEAN); + } + + /** + * Line classification reported by the lookup (e.g., mobile). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional carrierType() { + return Json.optional(json, "carrier_type", Conv.STRING); + } + + /** + * Machine-readable codes explaining the score. Values can grow over time, so do not reject unknown codes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reasonCodes() { + return Json.optional(json, "reason_codes", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneIntelligence}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneIntelligence from) { + super(from); + } + + /** + * Normalized 0-100 risk score. Higher is riskier. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Low, Medium or High, derived from the score. + * + * @param phoneTypeRisk the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneTypeRisk(@Nullable String phoneTypeRisk) { + return setNullable("phone_type_risk", Conv.STRING, phoneTypeRisk); + } + + /** + * Inverse of the score, for dashboards that prefer higher is better. + * + * @param phoneTrustIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneTrustIndex(@Nullable Double phoneTrustIndex) { + return setNullable("phone_trust_index", Conv.DOUBLE, phoneTrustIndex); + } + + /** + * Stability of the line's network. + * + * @param networkStabilityIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder networkStabilityIndex(@Nullable Double networkStabilityIndex) { + return setNullable("network_stability_index", Conv.DOUBLE, networkStabilityIndex); + } + + /** + * true when the number looks disposable or virtual. + * + * @param isDisposable the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDisposable(@Nullable Boolean isDisposable) { + return setNullable("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * true when the number has moved carrier. + * + * @param isPorted the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isPorted(@Nullable Boolean isPorted) { + return setNullable("is_ported", Conv.BOOLEAN, isPorted); + } + + /** + * true when the port happened recently. + * + * @param isRecentlyPorted the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isRecentlyPorted(@Nullable Boolean isRecentlyPorted) { + return setNullable("is_recently_ported", Conv.BOOLEAN, isRecentlyPorted); + } + + /** + * Line classification reported by the lookup (e.g., mobile). + * + * @param carrierType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder carrierType(@Nullable String carrierType) { + return setNullable("carrier_type", Conv.STRING, carrierType); + } + + /** + * Machine-readable codes explaining the score. Values can grow over time, so do not reject unknown codes. + * + * @param reasonCodes the value + * @return this builder + */ + public Builder reasonCodes(List reasonCodes) { + return set("reason_codes", Conv.list(Conv.STRING), reasonCodes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneIntelligence} + */ + public PhoneIntelligence build() { + return new PhoneIntelligence(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/PhoneMatchItem.java b/src/main/java/me/didit/types/PhoneMatchItem.java new file mode 100644 index 0000000..ab0c83f --- /dev/null +++ b/src/main/java/me/didit/types/PhoneMatchItem.java @@ -0,0 +1,262 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** + * Another session of your application that used the same phone number with a different vendor_data. + */ +public final class PhoneMatchItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "phone_number", "status", "is_blocklisted", "api_service", "source"); + + private PhoneMatchItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneMatchItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneMatchItem fromJson(JsonNode json) { + return new PhoneMatchItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session id of the other verification that used this phone number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Human-friendly sequential number of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * vendor_data of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.STRING); + } + + /** + * The matched phone number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the phone number is on your application's blocklist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * For API-type sessions, the standalone API that created it; null for regular verification sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry uses list_entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneMatchItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneMatchItem from) { + super(from); + } + + /** + * Session id of the other verification that used this phone number. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Human-friendly sequential number of that session. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * vendor_data of that session. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @param verificationDate the value + * @return this builder + */ + public Builder verificationDate(String verificationDate) { + return set("verification_date", Conv.STRING, verificationDate); + } + + /** + * The matched phone number. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Whether the phone number is on your application's blocklist. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * For API-type sessions, the standalone API that created it; null for regular verification sessions. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry uses list_entry. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneMatchItem} + */ + public PhoneMatchItem build() { + return new PhoneMatchItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/PhoneRiskRequest.java b/src/main/java/me/didit/types/PhoneRiskRequest.java new file mode 100644 index 0000000..8ee3bc7 --- /dev/null +++ b/src/main/java/me/didit/types/PhoneRiskRequest.java @@ -0,0 +1,201 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class PhoneRiskRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("phone_number", "country_code", "signals", "vendor_data", "metadata", "enable_social"); + + private PhoneRiskRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneRiskRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneRiskRequest fromJson(JsonNode json) { + return new PhoneRiskRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Phone number to score. It is validated and normalized to E.164. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String phoneNumber() { + return Json.required(json, "phone_number", Conv.STRING); + } + + /** + * Optional ISO 3166-1 alpha-2 or alpha-3 country hint for intelligence coverage. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Optional device and network context observed by your application. All fields are optional. Passing them feeds cross-session match detection in Networks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signals() { + return Json.optional(json, "signals", Conv.model(RiskSignals::fromJson)); + } + + /** + * Your stable reference for this request. Stored on the API session and echoed in the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Your non-sensitive JSON metadata. Stored on the API session and echoed in the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * When true, also look up the social footprint of the number - the messaging, social, e-commerce and professional platforms it is registered on. Billed as one phone_social unit per request in addition to this endpoint's own price. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enableSocial() { + return Json.optional(json, "enable_social", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneRiskRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneRiskRequest from) { + super(from); + } + + /** + * Phone number to score. It is validated and normalized to E.164. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Optional ISO 3166-1 alpha-2 or alpha-3 country hint for intelligence coverage. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Optional device and network context observed by your application. All fields are optional. Passing them feeds cross-session match detection in Networks. + * + * @param signals the value + * @return this builder + */ + public Builder signals(RiskSignals signals) { + return set("signals", Conv.model(RiskSignals::fromJson), signals); + } + + /** + * Your stable reference for this request. Stored on the API session and echoed in the response. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Your non-sensitive JSON metadata. Stored on the API session and echoed in the response. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * When true, also look up the social footprint of the number - the messaging, social, e-commerce and professional platforms it is registered on. Billed as one phone_social unit per request in addition to this endpoint's own price. + * + * @param enableSocial the value + * @return this builder + */ + public Builder enableSocial(boolean enableSocial) { + return set("enable_social", Conv.BOOLEAN, enableSocial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneRiskRequest} + * @throws IllegalStateException when a required field is missing + */ + public PhoneRiskRequest build() { + require("phone_number", false); + return new PhoneRiskRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/PhoneRiskResponse.java b/src/main/java/me/didit/types/PhoneRiskResponse.java new file mode 100644 index 0000000..4af8820 --- /dev/null +++ b/src/main/java/me/didit/types/PhoneRiskResponse.java @@ -0,0 +1,833 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class PhoneRiskResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "vendor_data", "metadata", "created_at", "phone"); + + private PhoneRiskResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneRiskResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneRiskResponse fromJson(JsonNode json) { + return new PhoneRiskResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Id of the API session created for this request. Store it with vendor_data if you need to correlate the result with later webhooks or console activity. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String requestId() { + return Json.required(json, "request_id", Conv.STRING); + } + + /** + * Final decision for this API session. Normally Approved; the risk evaluation can produce In Review or Declined. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public PhoneRiskResponse.Status status() { + return Json.required(json, "status", Conv.enumeration(PhoneRiskResponse.Status::of)); + } + + /** + * Echo of the vendor_data you sent, null when you did not send one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata you sent, null when you did not send one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Timestamp of this response. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * Normalized phone report, the same block used by Phone Verification responses. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.model(PhoneRiskResponse.Phone::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneRiskResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneRiskResponse from) { + super(from); + } + + /** + * Id of the API session created for this request. Store it with vendor_data if you need to correlate the result with later webhooks or console activity. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Final decision for this API session. Normally Approved; the risk evaluation can produce In Review or Declined. + * + * @param status the value + * @return this builder + */ + public Builder status(PhoneRiskResponse.Status status) { + return set("status", Conv.enumeration(PhoneRiskResponse.Status::of), status); + } + + /** + * Echo of the vendor_data you sent, null when you did not send one. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata you sent, null when you did not send one. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Timestamp of this response. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Normalized phone report, the same block used by Phone Verification responses. + * + * @param phone the value + * @return this builder + */ + public Builder phone(PhoneRiskResponse.Phone phone) { + return set("phone", Conv.model(PhoneRiskResponse.Phone::fromJson), phone); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneRiskResponse} + * @throws IllegalStateException when a required field is missing + */ + public PhoneRiskResponse build() { + require("request_id", false); + require("status", false); + require("created_at", false); + return new PhoneRiskResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Final decision for this API session. Normally Approved; the risk evaluation can produce In Review or Declined. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Normalized phone report, the same block used by Phone Verification responses. */ + public static final class Phone extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "phone_number_prefix", "phone_number", "full_number", "country_code", "country_name", "carrier", "is_disposable", "is_virtual", "verification_method", "verification_attempts", "verified_at", "warnings", "lifecycle", "matches", "phone_intelligence", "enrichment", "phone_social"); + + private Phone(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Phone} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Phone fromJson(JsonNode json) { + return new Phone(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Decision for this phone number. Mirrors the top-level status. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public PhoneRiskResponse.Phone.Status status() { + return Json.required(json, "status", Conv.enumeration(PhoneRiskResponse.Phone.Status::of)); + } + + /** + * Country calling code with leading + (e.g., +1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumberPrefix() { + return Json.optional(json, "phone_number_prefix", Conv.STRING); + } + + /** + * National number without the country calling code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * Complete number in E.164 format. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullNumber() { + return Json.optional(json, "full_number", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country of the number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Full country name derived from country_code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryName() { + return Json.optional(json, "country_name", Conv.STRING); + } + + /** + * Current network serving the number. null when the lookup could not resolve a carrier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional carrier() { + return Json.optional(json, "carrier", Conv.model(PhoneRiskResponse.Phone.Carrier::fromJson)); + } + + /** + * true when the number belongs to a temporary or burner number service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * true when the line type is virtual (voip, isp, or vpn). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVirtual() { + return Json.optional(json, "is_virtual", Conv.BOOLEAN); + } + + /** + * OTP channel of the underlying verification. null for risk lookups, which never send a code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationMethod() { + return Json.optional(json, "verification_method", Conv.STRING); + } + + /** + * OTP sends for this number. 0 for risk lookups. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationAttempts() { + return Json.optional(json, "verification_attempts", Conv.LONG); + } + + /** + * When the number was last verified by an OTP. null for risk lookups. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * Risk warnings recorded for this request. Empty array when there are none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(RiskWarning::fromJson))); + } + + /** + * Chronological audit trail of the request. Empty array for risk lookups without send events. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lifecycle() { + return Json.optional(json, "lifecycle", Conv.list(Conv.model(RiskLifecycleEvent::fromJson))); + } + + /** + * Other sessions of your application where the same phone number was used by a different user (different vendor_data). Up to 5 entries. Empty array when there are no matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(PhoneMatchItem::fromJson))); + } + + /** + * Normalized phone-intelligence block. Present only when the intelligence add-on ran for this lookup; when present it is also exposed under the enrichment alias with identical values. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneIntelligence() { + return Json.optional(json, "phone_intelligence", Conv.model(PhoneIntelligence::fromJson)); + } + + /** + * Normalized phone-intelligence block. Present only when the intelligence add-on ran for this lookup; when present it is also exposed under the enrichment alias with identical values. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enrichment() { + return Json.optional(json, "enrichment", Conv.model(PhoneIntelligence::fromJson)); + } + + /** + * Social footprint of the phone number: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the phone number was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneSocial() { + return Json.optional(json, "phone_social", Conv.model(PhoneSocialFootprint::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Phone}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Phone from) { + super(from); + } + + /** + * Decision for this phone number. Mirrors the top-level status. + * + * @param status the value + * @return this builder + */ + public Builder status(PhoneRiskResponse.Phone.Status status) { + return set("status", Conv.enumeration(PhoneRiskResponse.Phone.Status::of), status); + } + + /** + * Country calling code with leading + (e.g., +1). + * + * @param phoneNumberPrefix the value + * @return this builder + */ + public Builder phoneNumberPrefix(String phoneNumberPrefix) { + return set("phone_number_prefix", Conv.STRING, phoneNumberPrefix); + } + + /** + * National number without the country calling code. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Complete number in E.164 format. + * + * @param fullNumber the value + * @return this builder + */ + public Builder fullNumber(String fullNumber) { + return set("full_number", Conv.STRING, fullNumber); + } + + /** + * ISO 3166-1 alpha-2 country of the number. + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Full country name derived from country_code. + * + * @param countryName the value + * @return this builder + */ + public Builder countryName(String countryName) { + return set("country_name", Conv.STRING, countryName); + } + + /** + * Current network serving the number. null when the lookup could not resolve a carrier. + * + * @param carrier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder carrier(PhoneRiskResponse.Phone.@Nullable Carrier carrier) { + return setNullable("carrier", Conv.model(PhoneRiskResponse.Phone.Carrier::fromJson), carrier); + } + + /** + * true when the number belongs to a temporary or burner number service. + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * true when the line type is virtual (voip, isp, or vpn). + * + * @param isVirtual the value + * @return this builder + */ + public Builder isVirtual(boolean isVirtual) { + return set("is_virtual", Conv.BOOLEAN, isVirtual); + } + + /** + * OTP channel of the underlying verification. null for risk lookups, which never send a code. + * + * @param verificationMethod the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationMethod(@Nullable String verificationMethod) { + return setNullable("verification_method", Conv.STRING, verificationMethod); + } + + /** + * OTP sends for this number. 0 for risk lookups. + * + * @param verificationAttempts the value + * @return this builder + */ + public Builder verificationAttempts(long verificationAttempts) { + return set("verification_attempts", Conv.LONG, verificationAttempts); + } + + /** + * When the number was last verified by an OTP. null for risk lookups. + * + * @param verifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verifiedAt(@Nullable OffsetDateTime verifiedAt) { + return setNullable("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Risk warnings recorded for this request. Empty array when there are none. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(RiskWarning::fromJson)), warnings); + } + + /** + * Chronological audit trail of the request. Empty array for risk lookups without send events. + * + * @param lifecycle the value + * @return this builder + */ + public Builder lifecycle(List lifecycle) { + return set("lifecycle", Conv.list(Conv.model(RiskLifecycleEvent::fromJson)), lifecycle); + } + + /** + * Other sessions of your application where the same phone number was used by a different user (different vendor_data). Up to 5 entries. Empty array when there are no matches. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(PhoneMatchItem::fromJson)), matches); + } + + /** + * Normalized phone-intelligence block. Present only when the intelligence add-on ran for this lookup; when present it is also exposed under the enrichment alias with identical values. + * + * @param phoneIntelligence the value + * @return this builder + */ + public Builder phoneIntelligence(PhoneIntelligence phoneIntelligence) { + return set("phone_intelligence", Conv.model(PhoneIntelligence::fromJson), phoneIntelligence); + } + + /** + * Normalized phone-intelligence block. Present only when the intelligence add-on ran for this lookup; when present it is also exposed under the enrichment alias with identical values. + * + * @param enrichment the value + * @return this builder + */ + public Builder enrichment(PhoneIntelligence enrichment) { + return set("enrichment", Conv.model(PhoneIntelligence::fromJson), enrichment); + } + + /** + * Social footprint of the phone number: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the phone number was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @param phoneSocial the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneSocial(@Nullable PhoneSocialFootprint phoneSocial) { + return setNullable("phone_social", Conv.model(PhoneSocialFootprint::fromJson), phoneSocial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Phone} + * @throws IllegalStateException when a required field is missing + */ + public Phone build() { + require("status", false); + return new Phone(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Decision for this phone number. Mirrors the top-level status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Current network serving the number. null when the lookup could not resolve a carrier. + */ + public static final class Carrier extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "type"); + + private Carrier(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Carrier} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Carrier fromJson(JsonNode json) { + return new Carrier(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Carrier name. Empty string when the lookup could not identify it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Line type reported by the lookup: mobile, fixed_line, voip, isp, vpn, toll_free, premium_rate, or similar. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Carrier}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Carrier from) { + super(from); + } + + /** + * Carrier name. Empty string when the lookup could not identify it. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Line type reported by the lookup: mobile, fixed_line, voip, isp, vpn, toll_free, premium_rate, or similar. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Carrier} + */ + public Carrier build() { + return new Carrier(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/PhoneSendCodeParams.java b/src/main/java/me/didit/types/PhoneSendCodeParams.java new file mode 100644 index 0000000..d07a48c --- /dev/null +++ b/src/main/java/me/didit/types/PhoneSendCodeParams.java @@ -0,0 +1,667 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code phone.send_code}. */ +public final class PhoneSendCodeParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("phone_number", "options", "signals", "vendor_data", "metadata"); + + private PhoneSendCodeParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneSendCodeParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneSendCodeParams fromJson(JsonNode json) { + return new PhoneSendCodeParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Recipient phone number in E.164 format โ€” leading + and country code (e.g., +14155552671). Numbers are validated and normalized to E.164; unparseable or invalid numbers return 400 with a phone_number field error. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String phoneNumber() { + return Json.required(json, "phone_number", Conv.STRING); + } + + /** + * OTP delivery options. All fields are optional. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional options() { + return Json.optional(json, "options", Conv.model(PhoneSendCodeParams.Options::fromJson)); + } + + /** + * Optional device and network signals about the end user, forwarded to the anti-fraud layer to improve detection of abusive or automated traffic. All fields are optional. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signals() { + return Json.optional(json, "signals", Conv.model(PhoneSendCodeParams.Signals::fromJson)); + } + + /** + * Optional caller-controlled identifier (your internal user id, an email, a UUID, etc.) persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. Use it to correlate Didit's request_id with your user record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional free-form JSON object persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneSendCodeParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneSendCodeParams from) { + super(from); + } + + /** + * Recipient phone number in E.164 format โ€” leading + and country code (e.g., +14155552671). Numbers are validated and normalized to E.164; unparseable or invalid numbers return 400 with a phone_number field error. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * OTP delivery options. All fields are optional. + * + * @param options_ the value + * @return this builder + */ + public Builder options(PhoneSendCodeParams.Options options_) { + return set("options", Conv.model(PhoneSendCodeParams.Options::fromJson), options_); + } + + /** + * Optional device and network signals about the end user, forwarded to the anti-fraud layer to improve detection of abusive or automated traffic. All fields are optional. + * + * @param signals the value + * @return this builder + */ + public Builder signals(PhoneSendCodeParams.Signals signals) { + return set("signals", Conv.model(PhoneSendCodeParams.Signals::fromJson), signals); + } + + /** + * Optional caller-controlled identifier (your internal user id, an email, a UUID, etc.) persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. Use it to correlate Didit's request_id with your user record. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional free-form JSON object persisted on the session and echoed back in the send response, the matching check response, webhooks, and the Business Console. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneSendCodeParams} + * @throws IllegalStateException when a required field is missing + */ + public PhoneSendCodeParams build() { + require("phone_number", false); + return new PhoneSendCodeParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** OTP delivery options. All fields are optional. */ + public static final class Options extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("code_size", "locale", "preferred_channel", "use_white_label_customization", "sms_sender_name"); + + private Options(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Options} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Options fromJson(JsonNode json) { + return new Options(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of digits in the OTP. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional codeSize() { + return Json.optional(json, "code_size", Conv.LONG); + } + + /** + * BCP-47 locale used to localize the verification message (e.g., en-US, fr, es). Invalid formats return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locale() { + return Json.optional(json, "locale", Conv.STRING); + } + + /** + * Preferred delivery channel. If the channel is unavailable for the destination country or number, the message automatically falls back to SMS โ€” the send still reports Success. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional preferredChannel() { + return Json.optional(json, "preferred_channel", Conv.enumeration(PhoneSendCodeParams.Options.PreferredChannel::of)); + } + + /** + * When true, the send is white-labelled: if your application has no SMS sender name, the SMS names your white-label public name instead ("123456 is your verification code for Acme Bank"). Your SMS sender name, when set, is used with or without this flag. Applies to SMS messages, including an SMS fallback from another channel; WhatsApp codes are sent with a fixed message and are not branded. Defaults to false. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional useWhiteLabelCustomization() { + return Json.optional(json, "use_white_label_customization", Conv.BOOLEAN); + } + + /** + * The name this code's SMS carries ("123456 is your verification code for Acme Bank"), instead of your application's SMS sender name. Free. 1 to 30 characters: letters, digits, spaces and ' & - ! only, not only digits, with single spaces between words; any other value returns 400 and no code is sent. Omitted, null or blank, your application's SMS sender name is used. Each application can start using up to two new names per day (UTC); past that, the code is sent with your application's name. Applies to SMS messages, including an SMS fallback from another channel; WhatsApp codes are not branded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional smsSenderName() { + return Json.optional(json, "sms_sender_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Options}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Options from) { + super(from); + } + + /** + * Number of digits in the OTP. + * + * @param codeSize the value + * @return this builder + */ + public Builder codeSize(long codeSize) { + return set("code_size", Conv.LONG, codeSize); + } + + /** + * BCP-47 locale used to localize the verification message (e.g., en-US, fr, es). Invalid formats return 400. + * + * @param locale the value + * @return this builder + */ + public Builder locale(String locale) { + return set("locale", Conv.STRING, locale); + } + + /** + * Preferred delivery channel. If the channel is unavailable for the destination country or number, the message automatically falls back to SMS โ€” the send still reports Success. + * + * @param preferredChannel the value + * @return this builder + */ + public Builder preferredChannel(PhoneSendCodeParams.Options.PreferredChannel preferredChannel) { + return set("preferred_channel", Conv.enumeration(PhoneSendCodeParams.Options.PreferredChannel::of), preferredChannel); + } + + /** + * When true, the send is white-labelled: if your application has no SMS sender name, the SMS names your white-label public name instead ("123456 is your verification code for Acme Bank"). Your SMS sender name, when set, is used with or without this flag. Applies to SMS messages, including an SMS fallback from another channel; WhatsApp codes are sent with a fixed message and are not branded. Defaults to false. + * + * @param useWhiteLabelCustomization the value + * @return this builder + */ + public Builder useWhiteLabelCustomization(boolean useWhiteLabelCustomization) { + return set("use_white_label_customization", Conv.BOOLEAN, useWhiteLabelCustomization); + } + + /** + * The name this code's SMS carries ("123456 is your verification code for Acme Bank"), instead of your application's SMS sender name. Free. 1 to 30 characters: letters, digits, spaces and ' & - ! only, not only digits, with single spaces between words; any other value returns 400 and no code is sent. Omitted, null or blank, your application's SMS sender name is used. Each application can start using up to two new names per day (UTC); past that, the code is sent with your application's name. Applies to SMS messages, including an SMS fallback from another channel; WhatsApp codes are not branded. + * + * @param smsSenderName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder smsSenderName(@Nullable String smsSenderName) { + return setNullable("sms_sender_name", Conv.STRING, smsSenderName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Options} + */ + public Options build() { + return new Options(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Preferred delivery channel. If the channel is unavailable for the destination country or number, the message automatically falls back to SMS โ€” the send still reports Success. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PreferredChannel extends StringEnum { + /** The value {@code "whatsapp"}. */ + public static final PreferredChannel WHATSAPP = new PreferredChannel("whatsapp"); + + /** The value {@code "sms"}. */ + public static final PreferredChannel SMS = new PreferredChannel("sms"); + + /** The value {@code "telegram"}. */ + public static final PreferredChannel TELEGRAM = new PreferredChannel("telegram"); + + /** The value {@code "voice"}. */ + public static final PreferredChannel VOICE = new PreferredChannel("voice"); + + /** The value {@code "rcs"}. */ + public static final PreferredChannel RCS = new PreferredChannel("rcs"); + + /** The value {@code "viber"}. */ + public static final PreferredChannel VIBER = new PreferredChannel("viber"); + + /** The value {@code "zalo"}. */ + public static final PreferredChannel ZALO = new PreferredChannel("zalo"); + + private static final List KNOWN_VALUES = List.of(WHATSAPP, SMS, TELEGRAM, VOICE, RCS, VIBER, ZALO); + + private PreferredChannel(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PreferredChannel of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PreferredChannel::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Optional device and network signals about the end user, forwarded to the anti-fraud layer to improve detection of abusive or automated traffic. All fields are optional. + */ + public static final class Signals extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip", "device_id", "device_platform", "device_model", "os_version", "app_version", "user_agent"); + + private Signals(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Signals} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Signals fromJson(JsonNode json) { + return new Signals(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * IP address of the end user's device. IPv4 or IPv6. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ip() { + return Json.optional(json, "ip", Conv.STRING); + } + + /** + * Unique identifier of the end user's device. Android: ANDROID_ID; iOS: identifierForVendor. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceId() { + return Json.optional(json, "device_id", Conv.STRING); + } + + /** + * Platform of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional devicePlatform() { + return Json.optional(json, "device_platform", Conv.enumeration(PhoneSendCodeParams.Signals.DevicePlatform::of)); + } + + /** + * Model of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceModel() { + return Json.optional(json, "device_model", Conv.STRING); + } + + /** + * Operating-system version of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osVersion() { + return Json.optional(json, "os_version", Conv.STRING); + } + + /** + * Version of your application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appVersion() { + return Json.optional(json, "app_version", Conv.STRING); + } + + /** + * User agent of the end user's browser or app. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Signals}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Signals from) { + super(from); + } + + /** + * IP address of the end user's device. IPv4 or IPv6. + * + * @param ip the value + * @return this builder + */ + public Builder ip(String ip) { + return set("ip", Conv.STRING, ip); + } + + /** + * Unique identifier of the end user's device. Android: ANDROID_ID; iOS: identifierForVendor. + * + * @param deviceId the value + * @return this builder + */ + public Builder deviceId(String deviceId) { + return set("device_id", Conv.STRING, deviceId); + } + + /** + * Platform of the end user's device. + * + * @param devicePlatform the value + * @return this builder + */ + public Builder devicePlatform(PhoneSendCodeParams.Signals.DevicePlatform devicePlatform) { + return set("device_platform", Conv.enumeration(PhoneSendCodeParams.Signals.DevicePlatform::of), devicePlatform); + } + + /** + * Model of the end user's device. + * + * @param deviceModel the value + * @return this builder + */ + public Builder deviceModel(String deviceModel) { + return set("device_model", Conv.STRING, deviceModel); + } + + /** + * Operating-system version of the end user's device. + * + * @param osVersion the value + * @return this builder + */ + public Builder osVersion(String osVersion) { + return set("os_version", Conv.STRING, osVersion); + } + + /** + * Version of your application. + * + * @param appVersion the value + * @return this builder + */ + public Builder appVersion(String appVersion) { + return set("app_version", Conv.STRING, appVersion); + } + + /** + * User agent of the end user's browser or app. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Signals} + */ + public Signals build() { + return new Signals(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Platform of the end user's device. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DevicePlatform extends StringEnum { + /** The value {@code "android"}. */ + public static final DevicePlatform ANDROID = new DevicePlatform("android"); + + /** The value {@code "ios"}. */ + public static final DevicePlatform IOS = new DevicePlatform("ios"); + + /** The value {@code "ipados"}. */ + public static final DevicePlatform IPADOS = new DevicePlatform("ipados"); + + /** The value {@code "tvos"}. */ + public static final DevicePlatform TVOS = new DevicePlatform("tvos"); + + /** The value {@code "web"}. */ + public static final DevicePlatform WEB = new DevicePlatform("web"); + + private static final List KNOWN_VALUES = List.of(ANDROID, IOS, IPADOS, TVOS, WEB); + + private DevicePlatform(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DevicePlatform of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DevicePlatform::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/PhoneSocialFootprint.java b/src/main/java/me/didit/types/PhoneSocialFootprint.java new file mode 100644 index 0000000..e8f9916 --- /dev/null +++ b/src/main/java/me/didit/types/PhoneSocialFootprint.java @@ -0,0 +1,472 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Social footprint of the phone number: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the phone number was found on none of them - a valid, billable answer and a common synthetic-identity signal. + */ +public final class PhoneSocialFootprint extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("profiles_registered", "profiles_checked", "names_found", "photos_found", "communication_breadth", "digital_footprint_diversity", "digital_sophistication_index", "engagement_depth_index", "subscription_affordability_index", "free_platforms", "full_paid_platforms", "partial_paid_platforms", "whatsapp_profile_completeness", "registered_platforms", "not_registered_platforms", "categories", "profiles"); + + private PhoneSocialFootprint(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneSocialFootprint} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneSocialFootprint fromJson(JsonNode json) { + return new PhoneSocialFootprint(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Platforms where the phone number is confirmed registered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional profilesRegistered() { + return Json.optional(json, "profiles_registered", Conv.LONG); + } + + /** + * Platforms evaluated for registration. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional profilesChecked() { + return Json.optional(json, "profiles_checked", Conv.LONG); + } + + /** + * Platforms that returned an associated name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional namesFound() { + return Json.optional(json, "names_found", Conv.LONG); + } + + /** + * Platforms that returned a profile photo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional photosFound() { + return Json.optional(json, "photos_found", Conv.LONG); + } + + /** + * Communication platforms with detected presence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional communicationBreadth() { + return Json.optional(json, "communication_breadth", Conv.LONG); + } + + /** + * Distinct platform categories with detected presence. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional digitalFootprintDiversity() { + return Json.optional(json, "digital_footprint_diversity", Conv.LONG); + } + + /** + * Composite digital-maturity indicator, 0-10. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional digitalSophisticationIndex() { + return Json.optional(json, "digital_sophistication_index", Conv.LONG); + } + + /** + * Profile-richness indicator, 0-10. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional engagementDepthIndex() { + return Json.optional(json, "engagement_depth_index", Conv.LONG); + } + + /** + * Free vs paid platform mix, 0-10. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subscriptionAffordabilityIndex() { + return Json.optional(json, "subscription_affordability_index", Conv.LONG); + } + + /** + * Registrations on free platforms. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional freePlatforms() { + return Json.optional(json, "free_platforms", Conv.LONG); + } + + /** + * Registrations on fully paid platforms. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullPaidPlatforms() { + return Json.optional(json, "full_paid_platforms", Conv.LONG); + } + + /** + * Registrations on freemium platforms. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional partialPaidPlatforms() { + return Json.optional(json, "partial_paid_platforms", Conv.LONG); + } + + /** + * Completeness of the WhatsApp profile. Phone only; null for email. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional whatsappProfileCompleteness() { + return Json.optional(json, "whatsapp_profile_completeness", Conv.enumeration(PhoneSocialFootprint.WhatsappProfileCompleteness::of)); + } + + /** + * Platforms where registration is confirmed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registeredPlatforms() { + return Json.optional(json, "registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson))); + } + + /** + * Platforms checked with a negative result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> notRegisteredPlatforms() { + return Json.optional(json, "not_registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson))); + } + + /** + * Registered count and ratio per platform category. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> categories() { + return Json.optional(json, "categories", Conv.map(Conv.model(SocialFootprintCategorySummary::fromJson))); + } + + /** + * Per-platform profile details, keyed by platform, when the platform exposes them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> profiles() { + return Json.optional(json, "profiles", Conv.map(Conv.model(SocialFootprintProfile::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneSocialFootprint}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneSocialFootprint from) { + super(from); + } + + /** + * Platforms where the phone number is confirmed registered. + * + * @param profilesRegistered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder profilesRegistered(@Nullable Long profilesRegistered) { + return setNullable("profiles_registered", Conv.LONG, profilesRegistered); + } + + /** + * Platforms evaluated for registration. + * + * @param profilesChecked the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder profilesChecked(@Nullable Long profilesChecked) { + return setNullable("profiles_checked", Conv.LONG, profilesChecked); + } + + /** + * Platforms that returned an associated name. + * + * @param namesFound the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder namesFound(@Nullable Long namesFound) { + return setNullable("names_found", Conv.LONG, namesFound); + } + + /** + * Platforms that returned a profile photo. + * + * @param photosFound the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder photosFound(@Nullable Long photosFound) { + return setNullable("photos_found", Conv.LONG, photosFound); + } + + /** + * Communication platforms with detected presence. + * + * @param communicationBreadth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder communicationBreadth(@Nullable Long communicationBreadth) { + return setNullable("communication_breadth", Conv.LONG, communicationBreadth); + } + + /** + * Distinct platform categories with detected presence. + * + * @param digitalFootprintDiversity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder digitalFootprintDiversity(@Nullable Long digitalFootprintDiversity) { + return setNullable("digital_footprint_diversity", Conv.LONG, digitalFootprintDiversity); + } + + /** + * Composite digital-maturity indicator, 0-10. + * + * @param digitalSophisticationIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder digitalSophisticationIndex(@Nullable Long digitalSophisticationIndex) { + return setNullable("digital_sophistication_index", Conv.LONG, digitalSophisticationIndex); + } + + /** + * Profile-richness indicator, 0-10. + * + * @param engagementDepthIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder engagementDepthIndex(@Nullable Long engagementDepthIndex) { + return setNullable("engagement_depth_index", Conv.LONG, engagementDepthIndex); + } + + /** + * Free vs paid platform mix, 0-10. + * + * @param subscriptionAffordabilityIndex the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subscriptionAffordabilityIndex(@Nullable Long subscriptionAffordabilityIndex) { + return setNullable("subscription_affordability_index", Conv.LONG, subscriptionAffordabilityIndex); + } + + /** + * Registrations on free platforms. + * + * @param freePlatforms the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder freePlatforms(@Nullable Long freePlatforms) { + return setNullable("free_platforms", Conv.LONG, freePlatforms); + } + + /** + * Registrations on fully paid platforms. + * + * @param fullPaidPlatforms the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullPaidPlatforms(@Nullable Long fullPaidPlatforms) { + return setNullable("full_paid_platforms", Conv.LONG, fullPaidPlatforms); + } + + /** + * Registrations on freemium platforms. + * + * @param partialPaidPlatforms the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder partialPaidPlatforms(@Nullable Long partialPaidPlatforms) { + return setNullable("partial_paid_platforms", Conv.LONG, partialPaidPlatforms); + } + + /** + * Completeness of the WhatsApp profile. Phone only; null for email. + * + * @param whatsappProfileCompleteness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder whatsappProfileCompleteness(PhoneSocialFootprint.@Nullable WhatsappProfileCompleteness whatsappProfileCompleteness) { + return setNullable("whatsapp_profile_completeness", Conv.enumeration(PhoneSocialFootprint.WhatsappProfileCompleteness::of), whatsappProfileCompleteness); + } + + /** + * Platforms where registration is confirmed. + * + * @param registeredPlatforms the value + * @return this builder + */ + public Builder registeredPlatforms(List registeredPlatforms) { + return set("registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson)), registeredPlatforms); + } + + /** + * Platforms checked with a negative result. + * + * @param notRegisteredPlatforms the value + * @return this builder + */ + public Builder notRegisteredPlatforms(List notRegisteredPlatforms) { + return set("not_registered_platforms", Conv.list(Conv.model(SocialFootprintPlatform::fromJson)), notRegisteredPlatforms); + } + + /** + * Registered count and ratio per platform category. + * + * @param categories the value + * @return this builder + */ + public Builder categories(Map categories) { + return set("categories", Conv.map(Conv.model(SocialFootprintCategorySummary::fromJson)), categories); + } + + /** + * Per-platform profile details, keyed by platform, when the platform exposes them. + * + * @param profiles the value + * @return this builder + */ + public Builder profiles(Map profiles) { + return set("profiles", Conv.map(Conv.model(SocialFootprintProfile::fromJson)), profiles); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneSocialFootprint} + */ + public PhoneSocialFootprint build() { + return new PhoneSocialFootprint(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Completeness of the WhatsApp profile. Phone only; null for email. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WhatsappProfileCompleteness extends StringEnum { + /** The value {@code "Basic"}. */ + public static final WhatsappProfileCompleteness BASIC = new WhatsappProfileCompleteness("Basic"); + + /** The value {@code "Partial"}. */ + public static final WhatsappProfileCompleteness PARTIAL = new WhatsappProfileCompleteness("Partial"); + + /** The value {@code "Complete"}. */ + public static final WhatsappProfileCompleteness COMPLETE = new WhatsappProfileCompleteness("Complete"); + + /** The value {@code "Not Present"}. */ + public static final WhatsappProfileCompleteness NOT_PRESENT = new WhatsappProfileCompleteness("Not Present"); + + private static final List KNOWN_VALUES = List.of(BASIC, PARTIAL, COMPLETE, NOT_PRESENT); + + private WhatsappProfileCompleteness(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WhatsappProfileCompleteness of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WhatsappProfileCompleteness::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/PhoneVerificationCheckResponse.java b/src/main/java/me/didit/types/PhoneVerificationCheckResponse.java new file mode 100644 index 0000000..ebc3753 --- /dev/null +++ b/src/main/java/me/didit/types/PhoneVerificationCheckResponse.java @@ -0,0 +1,1437 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class PhoneVerificationCheckResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "message", "phone", "vendor_data", "metadata", "created_at"); + + private PhoneVerificationCheckResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneVerificationCheckResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneVerificationCheckResponse fromJson(JsonNode json) { + return new PhoneVerificationCheckResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * On Approved/Declined: the session id of the matched verification โ€” identical to the request_id returned by POST /v3/phone/send/. On Failed and Expired or Not Found: a random one-off UUID that cannot be looked up later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * Approved โ€” correct code, no declining risk. Declined โ€” terminal: a declining risk matched or the attempt budget (3) was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” no pending verification for this number in the last 5 minutes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(PhoneVerificationCheckResponse.Status::of)); + } + + /** + * Human-readable explanation of the outcome, including the number of attempts remaining after a wrong code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + /** + * Full phone report. Present (non-null) only on finalized outcomes (Approved/Declined); null on Failed and absent on Expired or Not Found. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.model(PhoneVerificationCheckResponse.Phone::fromJson)); + } + + /** + * vendor_data of the matched verification's session. null on Expired or Not Found. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * metadata of the matched verification's session. null on Expired or Not Found. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Timestamp of this check response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneVerificationCheckResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneVerificationCheckResponse from) { + super(from); + } + + /** + * On Approved/Declined: the session id of the matched verification โ€” identical to the request_id returned by POST /v3/phone/send/. On Failed and Expired or Not Found: a random one-off UUID that cannot be looked up later. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Approved โ€” correct code, no declining risk. Declined โ€” terminal: a declining risk matched or the attempt budget (3) was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” no pending verification for this number in the last 5 minutes. + * + * @param status the value + * @return this builder + */ + public Builder status(PhoneVerificationCheckResponse.Status status) { + return set("status", Conv.enumeration(PhoneVerificationCheckResponse.Status::of), status); + } + + /** + * Human-readable explanation of the outcome, including the number of attempts remaining after a wrong code. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * Full phone report. Present (non-null) only on finalized outcomes (Approved/Declined); null on Failed and absent on Expired or Not Found. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(PhoneVerificationCheckResponse.@Nullable Phone phone) { + return setNullable("phone", Conv.model(PhoneVerificationCheckResponse.Phone::fromJson), phone); + } + + /** + * vendor_data of the matched verification's session. null on Expired or Not Found. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * metadata of the matched verification's session. null on Expired or Not Found. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Timestamp of this check response. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneVerificationCheckResponse} + */ + public PhoneVerificationCheckResponse build() { + return new PhoneVerificationCheckResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved โ€” correct code, no declining risk. Declined โ€” terminal: a declining risk matched or the attempt budget (3) was exhausted. Failed โ€” wrong code, attempts remaining. Expired or Not Found โ€” no pending verification for this number in the last 5 minutes. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "Failed"}. */ + public static final Status FAILED = new Status("Failed"); + + /** The value {@code "Expired or Not Found"}. */ + public static final Status EXPIRED_OR_NOT_FOUND = new Status("Expired or Not Found"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, FAILED, EXPIRED_OR_NOT_FOUND); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Full phone report. Present (non-null) only on finalized outcomes (Approved/Declined); null on Failed and absent on Expired or Not Found. + */ + public static final class Phone extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "phone_number_prefix", "phone_number", "full_number", "country_code", "country_name", "carrier", "is_disposable", "is_virtual", "verification_method", "verification_attempts", "verified_at", "warnings", "lifecycle", "matches", "phone_social"); + + private Phone(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Phone} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Phone fromJson(JsonNode json) { + return new Phone(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Final status of the phone verification. Matches the top-level status for finalized checks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(PhoneVerificationCheckResponse.Phone.Status::of)); + } + + /** + * Country calling code with leading + (e.g., +1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumberPrefix() { + return Json.optional(json, "phone_number_prefix", Conv.STRING); + } + + /** + * National number without the country calling code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * Complete number in E.164 format. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullNumber() { + return Json.optional(json, "full_number", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country of the number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Full country name derived from country_code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryName() { + return Json.optional(json, "country_name", Conv.STRING); + } + + /** + * Current network serving the number, from the carrier lookup run at finalization. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional carrier() { + return Json.optional(json, "carrier", Conv.model(PhoneVerificationCheckResponse.Phone.Carrier::fromJson)); + } + + /** + * true when the number belongs to a temporary/burner number service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * true when the line type is virtual (voip, isp, or vpn). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVirtual() { + return Json.optional(json, "is_virtual", Conv.BOOLEAN); + } + + /** + * Channel that actually delivered the OTP once delivery is confirmed (e.g., whatsapp, sms); until then, the requested channel. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationMethod() { + return Json.optional(json, "verification_method", Conv.STRING); + } + + /** + * Number of OTP sends for this verification (1, or 2 after a retry). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationAttempts() { + return Json.optional(json, "verification_attempts", Conv.LONG); + } + + /** + * When the correct code was entered. null if the verification was never approved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * Risk warnings recorded during the verification (duplicate, disposable, VoIP, attempts exceeded, blocklist, etc.). Empty array when there are none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(PhoneVerificationCheckResponse.Phone.Warnings::fromJson))); + } + + /** + * Chronological audit trail of the verification. Event type is one of PHONE_VERIFICATION_MESSAGE_SENT, PHONE_VERIFICATION_RETRY_MESSAGE_SENT, PHONE_VERIFICATION_BLOCKED, PHONE_DELIVERY_DELIVERED, PHONE_DELIVERY_UNDELIVERABLE, VALID_CODE_ENTERED, INVALID_CODE_ENTERED, PHONE_VERIFICATION_APPROVED, PHONE_VERIFICATION_DECLINED, PHONE_VERIFICATION_IN_REVIEW, PHONE_VERIFICATION_EXPIRED. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lifecycle() { + return Json.optional(json, "lifecycle", Conv.list(Conv.model(PhoneVerificationCheckResponse.Phone.Lifecycle::fromJson))); + } + + /** + * Other sessions of your application (KYC, KYB, or API) where the same phone number was used by a different user (different vendor_data). Up to 5 entries, a synthetic list-entry blocklist match first when present (session-derived matches keep query order). Empty array when there are no matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(PhoneVerificationCheckResponse.Phone.Matches::fromJson))); + } + + /** + * Social footprint of the phone number: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the phone number was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneSocial() { + return Json.optional(json, "phone_social", Conv.model(PhoneSocialFootprint::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Phone}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Phone from) { + super(from); + } + + /** + * Final status of the phone verification. Matches the top-level status for finalized checks. + * + * @param status the value + * @return this builder + */ + public Builder status(PhoneVerificationCheckResponse.Phone.Status status) { + return set("status", Conv.enumeration(PhoneVerificationCheckResponse.Phone.Status::of), status); + } + + /** + * Country calling code with leading + (e.g., +1). + * + * @param phoneNumberPrefix the value + * @return this builder + */ + public Builder phoneNumberPrefix(String phoneNumberPrefix) { + return set("phone_number_prefix", Conv.STRING, phoneNumberPrefix); + } + + /** + * National number without the country calling code. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Complete number in E.164 format. + * + * @param fullNumber the value + * @return this builder + */ + public Builder fullNumber(String fullNumber) { + return set("full_number", Conv.STRING, fullNumber); + } + + /** + * ISO 3166-1 alpha-2 country of the number. + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Full country name derived from country_code. + * + * @param countryName the value + * @return this builder + */ + public Builder countryName(String countryName) { + return set("country_name", Conv.STRING, countryName); + } + + /** + * Current network serving the number, from the carrier lookup run at finalization. + * + * @param carrier the value + * @return this builder + */ + public Builder carrier(PhoneVerificationCheckResponse.Phone.Carrier carrier) { + return set("carrier", Conv.model(PhoneVerificationCheckResponse.Phone.Carrier::fromJson), carrier); + } + + /** + * true when the number belongs to a temporary/burner number service. + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * true when the line type is virtual (voip, isp, or vpn). + * + * @param isVirtual the value + * @return this builder + */ + public Builder isVirtual(boolean isVirtual) { + return set("is_virtual", Conv.BOOLEAN, isVirtual); + } + + /** + * Channel that actually delivered the OTP once delivery is confirmed (e.g., whatsapp, sms); until then, the requested channel. + * + * @param verificationMethod the value + * @return this builder + */ + public Builder verificationMethod(String verificationMethod) { + return set("verification_method", Conv.STRING, verificationMethod); + } + + /** + * Number of OTP sends for this verification (1, or 2 after a retry). + * + * @param verificationAttempts the value + * @return this builder + */ + public Builder verificationAttempts(long verificationAttempts) { + return set("verification_attempts", Conv.LONG, verificationAttempts); + } + + /** + * When the correct code was entered. null if the verification was never approved. + * + * @param verifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verifiedAt(@Nullable OffsetDateTime verifiedAt) { + return setNullable("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Risk warnings recorded during the verification (duplicate, disposable, VoIP, attempts exceeded, blocklist, etc.). Empty array when there are none. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(PhoneVerificationCheckResponse.Phone.Warnings::fromJson)), warnings); + } + + /** + * Chronological audit trail of the verification. Event type is one of PHONE_VERIFICATION_MESSAGE_SENT, PHONE_VERIFICATION_RETRY_MESSAGE_SENT, PHONE_VERIFICATION_BLOCKED, PHONE_DELIVERY_DELIVERED, PHONE_DELIVERY_UNDELIVERABLE, VALID_CODE_ENTERED, INVALID_CODE_ENTERED, PHONE_VERIFICATION_APPROVED, PHONE_VERIFICATION_DECLINED, PHONE_VERIFICATION_IN_REVIEW, PHONE_VERIFICATION_EXPIRED. + * + * @param lifecycle the value + * @return this builder + */ + public Builder lifecycle(List lifecycle) { + return set("lifecycle", Conv.list(Conv.model(PhoneVerificationCheckResponse.Phone.Lifecycle::fromJson)), lifecycle); + } + + /** + * Other sessions of your application (KYC, KYB, or API) where the same phone number was used by a different user (different vendor_data). Up to 5 entries, a synthetic list-entry blocklist match first when present (session-derived matches keep query order). Empty array when there are no matches. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(PhoneVerificationCheckResponse.Phone.Matches::fromJson)), matches); + } + + /** + * Social footprint of the phone number: the online platforms it is registered on. Present only when enable_social was set and the check completed. Every count may be null when no data was returned for it. profiles_registered: 0 means the platforms were checked and the phone number was found on none of them - a valid, billable answer and a common synthetic-identity signal. + * + * @param phoneSocial the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneSocial(@Nullable PhoneSocialFootprint phoneSocial) { + return setNullable("phone_social", Conv.model(PhoneSocialFootprint::fromJson), phoneSocial); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Phone} + */ + public Phone build() { + return new Phone(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Final status of the phone verification. Matches the top-level status for finalized checks. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW, NOT_FINISHED, EXPIRED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Current network serving the number, from the carrier lookup run at finalization. */ + public static final class Carrier extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "type"); + + private Carrier(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Carrier} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Carrier fromJson(JsonNode json) { + return new Carrier(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Carrier name. Empty string when the lookup could not identify it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Line type reported by the lookup: mobile, fixed_line, voip, isp, vpn, toll_free, premium_rate, pager, payphone, satellite, service, shared_cost, short_codes_commercial, calling_cards, local_rate, universal_access, voice_mail, other, or unknown. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Carrier}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Carrier from) { + super(from); + } + + /** + * Carrier name. Empty string when the lookup could not identify it. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Line type reported by the lookup: mobile, fixed_line, voip, isp, vpn, toll_free, premium_rate, pager, payphone, satellite, service, shared_cost, short_codes_commercial, calling_cards, local_rate, universal_access, voice_mail, other, or unknown. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Carrier} + */ + public Carrier build() { + return new Carrier(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature that produced the warning. Always PHONE here. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Machine-readable risk code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Risk-specific context (e.g., the duplicated session id for duplicate risks). null when the risk carries no extra data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error risks decline the verification, warning flags it for review, information is recorded without affecting the status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(PhoneVerificationCheckResponse.Phone.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Feature that produced the warning. Always PHONE here. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Machine-readable risk code. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Risk-specific context (e.g., the duplicated session id for duplicate risks). null when the risk carries no extra data. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error risks decline the verification, warning flags it for review, information is recorded without affecting the status. + * + * @param logType the value + * @return this builder + */ + public Builder logType(PhoneVerificationCheckResponse.Phone.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(PhoneVerificationCheckResponse.Phone.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Severity. error risks decline the verification, warning flags it for review, information is recorded without affecting the status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Lifecycle extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "timestamp", "details", "fee"); + + private Lifecycle(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Lifecycle} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Lifecycle fromJson(JsonNode json) { + return new Lifecycle(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Event type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * When the event happened. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timestamp() { + return Json.optional(json, "timestamp", Conv.DATE_TIME); + } + + /** + * Event-specific payload. Send events: {status, reason, channel, actual_channel} (actual_channel is filled once delivery is confirmed). Delivery events: {channel, status}. Code-entry events: {code_tried, status}. Final-status events: null, or {reason} when declined or in review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.OBJECT); + } + + /** + * USD amount billed for this event. Non-zero only on send events (the delivery price); 0 for code entries, delivery confirmations, and status events. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fee() { + return Json.optional(json, "fee", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Lifecycle}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Lifecycle from) { + super(from); + } + + /** + * Event type. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * When the event happened. + * + * @param timestamp the value + * @return this builder + */ + public Builder timestamp(OffsetDateTime timestamp) { + return set("timestamp", Conv.DATE_TIME, timestamp); + } + + /** + * Event-specific payload. Send events: {status, reason, channel, actual_channel} (actual_channel is filled once delivery is confirmed). Delivery events: {channel, status}. Code-entry events: {code_tried, status}. Final-status events: null, or {reason} when declined or in review. + * + * @param details the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder details(@Nullable Map details) { + return setAny("details", details); + } + + /** + * USD amount billed for this event. Non-zero only on send events (the delivery price); 0 for code entries, delivery confirmations, and status events. + * + * @param fee the value + * @return this builder + */ + public Builder fee(double fee) { + return set("fee", Conv.DOUBLE, fee); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Lifecycle} + */ + public Lifecycle build() { + return new Lifecycle(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "phone_number", "status", "is_blocklisted", "api_service", "source"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session id of the other verification that used this phone number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Human-friendly sequential number of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * vendor_data of that session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.STRING); + } + + /** + * The matched phone number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the phone number is on your application's blocklist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * For API-type sessions, the standalone API that created it (e.g., PHONE_VERIFICATION); null for regular verification sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry prepends a synthetic match with source: "list_entry" and null session_id/session_number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * Session id of the other verification that used this phone number. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Human-friendly sequential number of that session. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * vendor_data of that session. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * When that session was created (YYYY-MM-DDTHH:MM:SSZ). + * + * @param verificationDate the value + * @return this builder + */ + public Builder verificationDate(String verificationDate) { + return set("verification_date", Conv.STRING, verificationDate); + } + + /** + * The matched phone number. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Status of that session (e.g., Approved, Declined, In Progress). + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Whether the phone number is on your application's blocklist. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * For API-type sessions, the standalone API that created it (e.g., PHONE_VERIFICATION); null for regular verification sessions. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Where the match was found. Usually session; a blocklist hit via an organization list entry prepends a synthetic match with source: "list_entry" and null session_id/session_number. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/PhoneVerificationSendResponse.java b/src/main/java/me/didit/types/PhoneVerificationSendResponse.java new file mode 100644 index 0000000..599e7eb --- /dev/null +++ b/src/main/java/me/didit/types/PhoneVerificationSendResponse.java @@ -0,0 +1,226 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class PhoneVerificationSendResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "status", "reason", "vendor_data", "metadata"); + + private PhoneVerificationSendResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneVerificationSendResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneVerificationSendResponse fromJson(JsonNode json) { + return new PhoneVerificationSendResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session id of the verification. A Retry send returns the same request_id as the original send. This id appears in the Business Console, is returned again by a finalized POST /v3/phone/check/, and can be passed to GET /v3/session/{sessionId}/decision/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * Success โ€” OTP sent to a new verification. Retry โ€” OTP re-sent for the pending verification created by a previous send. Blocked โ€” the anti-fraud layer refused to send; the verification is immediately finalized as Declined and nothing is billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(PhoneVerificationSendResponse.Status::of)); + } + + /** + * Why a send was Blocked (e.g., repeated_attempts, suspicious, spam). null on Success and Retry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * Echo of the vendor_data stored on the session (from the first send). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata stored on the session (from the first send). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneVerificationSendResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneVerificationSendResponse from) { + super(from); + } + + /** + * Session id of the verification. A Retry send returns the same request_id as the original send. This id appears in the Business Console, is returned again by a finalized POST /v3/phone/check/, and can be passed to GET /v3/session/{sessionId}/decision/. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * Success โ€” OTP sent to a new verification. Retry โ€” OTP re-sent for the pending verification created by a previous send. Blocked โ€” the anti-fraud layer refused to send; the verification is immediately finalized as Declined and nothing is billed. + * + * @param status the value + * @return this builder + */ + public Builder status(PhoneVerificationSendResponse.Status status) { + return set("status", Conv.enumeration(PhoneVerificationSendResponse.Status::of), status); + } + + /** + * Why a send was Blocked (e.g., repeated_attempts, suspicious, spam). null on Success and Retry. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * Echo of the vendor_data stored on the session (from the first send). + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata stored on the session (from the first send). + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneVerificationSendResponse} + */ + public PhoneVerificationSendResponse build() { + return new PhoneVerificationSendResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Success โ€” OTP sent to a new verification. Retry โ€” OTP re-sent for the pending verification created by a previous send. Blocked โ€” the anti-fraud layer refused to send; the verification is immediately finalized as Declined and nothing is billed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Success"}. */ + public static final Status SUCCESS = new Status("Success"); + + /** The value {@code "Retry"}. */ + public static final Status RETRY = new Status("Retry"); + + /** The value {@code "Blocked"}. */ + public static final Status BLOCKED = new Status("Blocked"); + + private static final List KNOWN_VALUES = List.of(SUCCESS, RETRY, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/ProofOfAddressVerifyParams.java b/src/main/java/me/didit/types/ProofOfAddressVerifyParams.java new file mode 100644 index 0000000..ec986a9 --- /dev/null +++ b/src/main/java/me/didit/types/ProofOfAddressVerifyParams.java @@ -0,0 +1,690 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code proof_of_address.verify}. */ +public final class ProofOfAddressVerifyParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("document", "document_password", "expected_address", "expected_country", "expected_first_name", "expected_last_name", "poa_languages_allowed", "poa_document_age_months", "poa_name_mismatch_action", "poa_document_issues_action", "poa_document_authenticity_action", "poa_unsupported_language_action", "poa_address_mismatch_action", "poa_issuer_not_identified_action", "save_api_request", "vendor_data", "metadata"); + + private ProofOfAddressVerifyParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ProofOfAddressVerifyParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ProofOfAddressVerifyParams fromJson(JsonNode json) { + return new ProofOfAddressVerifyParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The Proof of Address document. Allowed extensions: tiff, jpg, jpeg, png, pdf, webp. Maximum upload size: 15 MB (larger files are rejected with 400). Multi-page PDFs are supported (expect higher latency); encrypted PDFs require document_password. Images are automatically compressed before processing. + * + * @return the file to upload, if set + */ + public Optional document() { + return file("document"); + } + + /** + * Password to decrypt document when it is an encrypted PDF. Sending an encrypted PDF without (or with a wrong) password returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentPassword() { + return Json.optional(json, "document_password", Conv.STRING); + } + + /** + * Address to verify against the document. It is geocoded and compared with the extracted address; a mismatch (or an expected address that cannot be geocoded/verified) adds ADDRESS_MISMATCH_WITH_PROVIDED, governed by poa_address_mismatch_action. The geocoded form is echoed back in expected_details_formatted_address / expected_details_parsed_address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedAddress() { + return Json.optional(json, "expected_address", Conv.STRING); + } + + /** + * Country to verify against the document (ISO 3166-1 code, e.g. ARG or AR). A mismatch with the document's country adds POA_COUNTRY_MISMATCH_WITH_PROVIDED, governed by poa_address_mismatch_action. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedCountry() { + return Json.optional(json, "expected_country", Conv.STRING); + } + + /** + * First name to verify against name_on_document (fuzzy match, transliteration-aware). A score below the match threshold adds NAME_MISMATCH_WITH_PROVIDED, governed by poa_address_mismatch_action. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedFirstName() { + return Json.optional(json, "expected_first_name", Conv.STRING); + } + + /** + * Last name to verify against name_on_document, combined with expected_first_name for the match score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedLastName() { + return Json.optional(json, "expected_last_name", Conv.STRING); + } + + /** + * Comma-separated list of accepted document languages as ISO 639-1 codes (e.g. en,es,fr). When omitted or blank, all 51 supported languages are accepted. A document in a language outside the list adds UNSUPPORTED_DOCUMENT_LANGUAGE (governed by poa_unsupported_language_action); an unknown code in the list returns 400 with the full set of supported codes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaLanguagesAllowed() { + return Json.optional(json, "poa_languages_allowed", Conv.STRING); + } + + /** + * Comma-separated key:value pairs setting the maximum document age in months per document type โ€” keys: utility_bill, bank_statement, government_issued_document, other_poa_document; values: 1โ€“120, or -1 for unlimited (no age check). Defaults when omitted: utility_bill:3,bank_statement:3,government_issued_document:12,other_poa_document:12. A document older than its limit declines with POA_DOCUMENT_EXPIRED. Caution: when you provide this field, list *every* type you accept โ€” omitted types are treated as not accepted (informational POA_DOCUMENT_NOT_SUPPORTED_FOR_APPLICATION) and their age check is skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaDocumentAgeMonths() { + return Json.optional(json, "poa_document_age_months", Conv.STRING); + } + + /** + * Accepted but currently not applied โ€” name-mismatch warnings (NAME_MISMATCH_WITH_PROVIDED) follow poa_address_mismatch_action instead. Set poa_address_mismatch_action to control both name and address mismatch behavior. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaNameMismatchAction() { + return Json.optional(json, "poa_name_mismatch_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaNameMismatchAction::of)); + } + + /** + * What to do on file-integrity problems โ€” in practice only DOCUMENT_METADATA_MISMATCH is produced by this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaDocumentIssuesAction() { + return Json.optional(json, "poa_document_issues_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaDocumentIssuesAction::of)); + } + + /** + * What to do when document manipulation is suspected (SUSPECTED_DOCUMENT_MANIPULATION) โ€” e.g. the PDF was modified after digital signing, processed by a known PDF editor, shows overlay-text manipulation, or has inconsistent EXIF dates. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaDocumentAuthenticityAction() { + return Json.optional(json, "poa_document_authenticity_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaDocumentAuthenticityAction::of)); + } + + /** + * What to do when the document language is outside poa_languages_allowed (UNSUPPORTED_DOCUMENT_LANGUAGE). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaUnsupportedLanguageAction() { + return Json.optional(json, "poa_unsupported_language_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaUnsupportedLanguageAction::of)); + } + + /** + * What to do when the extracted details disagree with the expected_* fields: ADDRESS_MISMATCH_WITH_PROVIDED, NAME_MISMATCH_WITH_PROVIDED, and POA_COUNTRY_MISMATCH_WITH_PROVIDED all follow this action. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaAddressMismatchAction() { + return Json.optional(json, "poa_address_mismatch_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaAddressMismatchAction::of)); + } + + /** + * What to do when no issuing company/organization can be identified on the document (ISSUER_NOT_IDENTIFIED). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaIssuerNotIdentifiedAction() { + return Json.optional(json, "poa_issuer_not_identified_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaIssuerNotIdentifiedAction::of)); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, announced through a status.updated webhook, and with the uploaded document stored. When false, nothing is stored and request_id is a transient UUID for response correlation only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional saveApiRequest() { + return Json.optional(json, "save_api_request", Conv.BOOLEAN); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"onboarding"}) โ€” it is parsed into an object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ProofOfAddressVerifyParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ProofOfAddressVerifyParams from) { + super(from); + } + + /** + * The Proof of Address document. Allowed extensions: tiff, jpg, jpeg, png, pdf, webp. Maximum upload size: 15 MB (larger files are rejected with 400). Multi-page PDFs are supported (expect higher latency); encrypted PDFs require document_password. Images are automatically compressed before processing. + * + * @param document the value + * @return this builder + */ + public Builder document(FileUpload document) { + return setFile("document", document); + } + + /** + * Uploads the file at {@code path} as {@code document}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder document(Path path) { + return setFile("document", FileUpload.of(path)); + } + + /** + * Password to decrypt document when it is an encrypted PDF. Sending an encrypted PDF without (or with a wrong) password returns 400. + * + * @param documentPassword the value + * @return this builder + */ + public Builder documentPassword(String documentPassword) { + return set("document_password", Conv.STRING, documentPassword); + } + + /** + * Address to verify against the document. It is geocoded and compared with the extracted address; a mismatch (or an expected address that cannot be geocoded/verified) adds ADDRESS_MISMATCH_WITH_PROVIDED, governed by poa_address_mismatch_action. The geocoded form is echoed back in expected_details_formatted_address / expected_details_parsed_address. + * + * @param expectedAddress the value + * @return this builder + */ + public Builder expectedAddress(String expectedAddress) { + return set("expected_address", Conv.STRING, expectedAddress); + } + + /** + * Country to verify against the document (ISO 3166-1 code, e.g. ARG or AR). A mismatch with the document's country adds POA_COUNTRY_MISMATCH_WITH_PROVIDED, governed by poa_address_mismatch_action. + * + * @param expectedCountry the value + * @return this builder + */ + public Builder expectedCountry(String expectedCountry) { + return set("expected_country", Conv.STRING, expectedCountry); + } + + /** + * First name to verify against name_on_document (fuzzy match, transliteration-aware). A score below the match threshold adds NAME_MISMATCH_WITH_PROVIDED, governed by poa_address_mismatch_action. + * + * @param expectedFirstName the value + * @return this builder + */ + public Builder expectedFirstName(String expectedFirstName) { + return set("expected_first_name", Conv.STRING, expectedFirstName); + } + + /** + * Last name to verify against name_on_document, combined with expected_first_name for the match score. + * + * @param expectedLastName the value + * @return this builder + */ + public Builder expectedLastName(String expectedLastName) { + return set("expected_last_name", Conv.STRING, expectedLastName); + } + + /** + * Comma-separated list of accepted document languages as ISO 639-1 codes (e.g. en,es,fr). When omitted or blank, all 51 supported languages are accepted. A document in a language outside the list adds UNSUPPORTED_DOCUMENT_LANGUAGE (governed by poa_unsupported_language_action); an unknown code in the list returns 400 with the full set of supported codes. + * + * @param poaLanguagesAllowed the value + * @return this builder + */ + public Builder poaLanguagesAllowed(String poaLanguagesAllowed) { + return set("poa_languages_allowed", Conv.STRING, poaLanguagesAllowed); + } + + /** + * Comma-separated key:value pairs setting the maximum document age in months per document type โ€” keys: utility_bill, bank_statement, government_issued_document, other_poa_document; values: 1โ€“120, or -1 for unlimited (no age check). Defaults when omitted: utility_bill:3,bank_statement:3,government_issued_document:12,other_poa_document:12. A document older than its limit declines with POA_DOCUMENT_EXPIRED. Caution: when you provide this field, list *every* type you accept โ€” omitted types are treated as not accepted (informational POA_DOCUMENT_NOT_SUPPORTED_FOR_APPLICATION) and their age check is skipped. + * + * @param poaDocumentAgeMonths the value + * @return this builder + */ + public Builder poaDocumentAgeMonths(String poaDocumentAgeMonths) { + return set("poa_document_age_months", Conv.STRING, poaDocumentAgeMonths); + } + + /** + * Accepted but currently not applied โ€” name-mismatch warnings (NAME_MISMATCH_WITH_PROVIDED) follow poa_address_mismatch_action instead. Set poa_address_mismatch_action to control both name and address mismatch behavior. + * + * @param poaNameMismatchAction the value + * @return this builder + */ + public Builder poaNameMismatchAction(ProofOfAddressVerifyParams.PoaNameMismatchAction poaNameMismatchAction) { + return set("poa_name_mismatch_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaNameMismatchAction::of), poaNameMismatchAction); + } + + /** + * What to do on file-integrity problems โ€” in practice only DOCUMENT_METADATA_MISMATCH is produced by this endpoint. + * + * @param poaDocumentIssuesAction the value + * @return this builder + */ + public Builder poaDocumentIssuesAction(ProofOfAddressVerifyParams.PoaDocumentIssuesAction poaDocumentIssuesAction) { + return set("poa_document_issues_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaDocumentIssuesAction::of), poaDocumentIssuesAction); + } + + /** + * What to do when document manipulation is suspected (SUSPECTED_DOCUMENT_MANIPULATION) โ€” e.g. the PDF was modified after digital signing, processed by a known PDF editor, shows overlay-text manipulation, or has inconsistent EXIF dates. + * + * @param poaDocumentAuthenticityAction the value + * @return this builder + */ + public Builder poaDocumentAuthenticityAction(ProofOfAddressVerifyParams.PoaDocumentAuthenticityAction poaDocumentAuthenticityAction) { + return set("poa_document_authenticity_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaDocumentAuthenticityAction::of), poaDocumentAuthenticityAction); + } + + /** + * What to do when the document language is outside poa_languages_allowed (UNSUPPORTED_DOCUMENT_LANGUAGE). + * + * @param poaUnsupportedLanguageAction the value + * @return this builder + */ + public Builder poaUnsupportedLanguageAction(ProofOfAddressVerifyParams.PoaUnsupportedLanguageAction poaUnsupportedLanguageAction) { + return set("poa_unsupported_language_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaUnsupportedLanguageAction::of), poaUnsupportedLanguageAction); + } + + /** + * What to do when the extracted details disagree with the expected_* fields: ADDRESS_MISMATCH_WITH_PROVIDED, NAME_MISMATCH_WITH_PROVIDED, and POA_COUNTRY_MISMATCH_WITH_PROVIDED all follow this action. + * + * @param poaAddressMismatchAction the value + * @return this builder + */ + public Builder poaAddressMismatchAction(ProofOfAddressVerifyParams.PoaAddressMismatchAction poaAddressMismatchAction) { + return set("poa_address_mismatch_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaAddressMismatchAction::of), poaAddressMismatchAction); + } + + /** + * What to do when no issuing company/organization can be identified on the document (ISSUER_NOT_IDENTIFIED). + * + * @param poaIssuerNotIdentifiedAction the value + * @return this builder + */ + public Builder poaIssuerNotIdentifiedAction(ProofOfAddressVerifyParams.PoaIssuerNotIdentifiedAction poaIssuerNotIdentifiedAction) { + return set("poa_issuer_not_identified_action", Conv.enumeration(ProofOfAddressVerifyParams.PoaIssuerNotIdentifiedAction::of), poaIssuerNotIdentifiedAction); + } + + /** + * When true (default), persists the call as an API-type session โ€” visible in the Business Console, retrievable via GET /v3/session/{sessionId}/decision/ using the returned request_id, announced through a status.updated webhook, and with the uploaded document stored. When false, nothing is stored and request_id is a transient UUID for response correlation only. + * + * @param saveApiRequest the value + * @return this builder + */ + public Builder saveApiRequest(boolean saveApiRequest) { + return set("save_api_request", Conv.BOOLEAN, saveApiRequest); + } + + /** + * Optional opaque string (your internal user id, email, UUIDโ€ฆ) stored on the persisted session and echoed back in the response. Use it to correlate API calls with your own records and to filter sessions later. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional JSON object stored with the session (when save_api_request=true) and echoed back in the response. In multipart requests, send it as a JSON-encoded string field (e.g. metadata={"flow":"onboarding"}) โ€” it is parsed into an object. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ProofOfAddressVerifyParams} + * @throws IllegalStateException when a required field is missing + */ + public ProofOfAddressVerifyParams build() { + requireFile("document"); + return new ProofOfAddressVerifyParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Accepted but currently not applied โ€” name-mismatch warnings (NAME_MISMATCH_WITH_PROVIDED) follow poa_address_mismatch_action instead. Set poa_address_mismatch_action to control both name and address mismatch behavior. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PoaNameMismatchAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PoaNameMismatchAction DECLINE = new PoaNameMismatchAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PoaNameMismatchAction NO_ACTION = new PoaNameMismatchAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PoaNameMismatchAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PoaNameMismatchAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PoaNameMismatchAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do on file-integrity problems โ€” in practice only DOCUMENT_METADATA_MISMATCH is produced by this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PoaDocumentIssuesAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PoaDocumentIssuesAction DECLINE = new PoaDocumentIssuesAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PoaDocumentIssuesAction NO_ACTION = new PoaDocumentIssuesAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PoaDocumentIssuesAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PoaDocumentIssuesAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PoaDocumentIssuesAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when document manipulation is suspected (SUSPECTED_DOCUMENT_MANIPULATION) โ€” e.g. the PDF was modified after digital signing, processed by a known PDF editor, shows overlay-text manipulation, or has inconsistent EXIF dates. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PoaDocumentAuthenticityAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PoaDocumentAuthenticityAction DECLINE = new PoaDocumentAuthenticityAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PoaDocumentAuthenticityAction NO_ACTION = new PoaDocumentAuthenticityAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PoaDocumentAuthenticityAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PoaDocumentAuthenticityAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PoaDocumentAuthenticityAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the document language is outside poa_languages_allowed (UNSUPPORTED_DOCUMENT_LANGUAGE). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PoaUnsupportedLanguageAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PoaUnsupportedLanguageAction DECLINE = new PoaUnsupportedLanguageAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PoaUnsupportedLanguageAction NO_ACTION = new PoaUnsupportedLanguageAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PoaUnsupportedLanguageAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PoaUnsupportedLanguageAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PoaUnsupportedLanguageAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when the extracted details disagree with the expected_* fields: ADDRESS_MISMATCH_WITH_PROVIDED, NAME_MISMATCH_WITH_PROVIDED, and POA_COUNTRY_MISMATCH_WITH_PROVIDED all follow this action. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PoaAddressMismatchAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PoaAddressMismatchAction DECLINE = new PoaAddressMismatchAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PoaAddressMismatchAction NO_ACTION = new PoaAddressMismatchAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PoaAddressMismatchAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PoaAddressMismatchAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PoaAddressMismatchAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What to do when no issuing company/organization can be identified on the document (ISSUER_NOT_IDENTIFIED). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PoaIssuerNotIdentifiedAction extends StringEnum { + /** The value {@code "DECLINE"}. */ + public static final PoaIssuerNotIdentifiedAction DECLINE = new PoaIssuerNotIdentifiedAction("DECLINE"); + + /** The value {@code "NO_ACTION"}. */ + public static final PoaIssuerNotIdentifiedAction NO_ACTION = new PoaIssuerNotIdentifiedAction("NO_ACTION"); + + private static final List KNOWN_VALUES = List.of(DECLINE, NO_ACTION); + + private PoaIssuerNotIdentifiedAction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PoaIssuerNotIdentifiedAction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PoaIssuerNotIdentifiedAction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/ProofOfAddressVerifyResponse.java b/src/main/java/me/didit/types/ProofOfAddressVerifyResponse.java new file mode 100644 index 0000000..58fc4d9 --- /dev/null +++ b/src/main/java/me/didit/types/ProofOfAddressVerifyResponse.java @@ -0,0 +1,1532 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class ProofOfAddressVerifyResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("request_id", "poa", "vendor_data", "metadata", "created_at"); + + private ProofOfAddressVerifyResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ProofOfAddressVerifyResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ProofOfAddressVerifyResponse fromJson(JsonNode json) { + return new ProofOfAddressVerifyResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestId() { + return Json.optional(json, "request_id", Conv.STRING); + } + + /** + * The poa field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poa() { + return Json.optional(json, "poa", Conv.model(ProofOfAddressVerifyResponse.Poa::fromJson)); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ProofOfAddressVerifyResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ProofOfAddressVerifyResponse from) { + super(from); + } + + /** + * Persisted session id when save_api_request=true (usable with GET /v3/session/{sessionId}/decision/); otherwise a transient correlation UUID. + * + * @param requestId the value + * @return this builder + */ + public Builder requestId(String requestId) { + return set("request_id", Conv.STRING, requestId); + } + + /** + * The poa field. + * + * @param poa the value + * @return this builder + */ + public Builder poa(ProofOfAddressVerifyResponse.Poa poa) { + return set("poa", Conv.model(ProofOfAddressVerifyResponse.Poa::fromJson), poa); + } + + /** + * Echo of the vendor_data you sent, or null. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Echo of the metadata object you sent, or null. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * ISO 8601 timestamp (UTC) of when the response was generated. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ProofOfAddressVerifyResponse} + */ + public ProofOfAddressVerifyResponse build() { + return new ProofOfAddressVerifyResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Poa extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "issuing_state", "document_type", "document_subtype", "document_language", "issuer", "issue_date", "expiration_date", "poa_address", "poa_formatted_address", "poa_parsed_address", "expected_details_address", "expected_details_formatted_address", "expected_details_parsed_address", "name_on_document", "extra_fields", "warnings", "detected_codes"); + + private Poa(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Poa} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Poa fromJson(JsonNode json) { + return new Poa(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Approved when no warning resolves to a decline; Declined otherwise โ€” the warnings list explains why. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.Status::of)); + } + + /** + * Country the document was issued in, as extracted from the document โ€” usually ISO 3166-1 alpha-3 (e.g. ARG). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * Detected document category. UNKNOWN means the document could not be classified as an acceptable Proof of Address and auto-declines with INVALID_DOCUMENT_TYPE. Never null โ€” classification failures fall back to UNKNOWN. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.DocumentType::of)); + } + + /** + * Finer-grained classification within document_type โ€” e.g. ELECTRICITY_BILL, WATER_BILL, GAS_BILL, INTERNET_BILL, PHONE_BILL (utility bills); ACCOUNT_STATEMENT, CREDIT_CARD_STATEMENT (bank statements); TAX_ASSESSMENT, RESIDENCY_CERTIFICATE (government documents). UNKNOWN when no subtype could be determined. Never null โ€” classification failures fall back to UNKNOWN. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * Detected document language (ISO 639-1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLanguage() { + return Json.optional(json, "document_language", Conv.STRING); + } + + /** + * Company or organization that issued the document. null adds ISSUER_NOT_IDENTIFIED. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + /** + * Document issue date (YYYY-MM-DD). null when it could not be extracted โ€” that declines with UNABLE_TO_EXTRACT_ISSUE_DATE on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issueDate() { + return Json.optional(json, "issue_date", Conv.DATE); + } + + /** + * Explicit expiry/validity date printed on the document, when present. Independent of the poa_document_age_months age check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * Address exactly as printed on the document. null auto-declines with MISSING_ADDRESS_INFORMATION. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaAddress() { + return Json.optional(json, "poa_address", Conv.STRING); + } + + /** + * Geocoded, normalized version of poa_address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaFormattedAddress() { + return Json.optional(json, "poa_formatted_address", Conv.STRING); + } + + /** + * Structured, geocoded breakdown of the document address. null when the address could not be parsed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaParsedAddress() { + return Json.optional(json, "poa_parsed_address", Conv.model(ProofOfAddressVerifyResponse.Poa.PoaParsedAddress::fromJson)); + } + + /** + * Echo of the expected_address you sent, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedDetailsAddress() { + return Json.optional(json, "expected_details_address", Conv.STRING); + } + + /** + * Geocoded, normalized version of expected_address; null when not provided or not geocodable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedDetailsFormattedAddress() { + return Json.optional(json, "expected_details_formatted_address", Conv.STRING); + } + + /** + * Full geocoding result for expected_address (street/city/region/country/postal code plus raw geocoder output and an is_verified flag). null when expected_address was not provided. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> expectedDetailsParsedAddress() { + return Json.optional(json, "expected_details_parsed_address", Conv.OBJECT); + } + + /** + * Primary holder name extracted from the document; compared against expected_first_name/expected_last_name when provided. null declines with POA_NAME_NOT_DETECTED on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameOnDocument() { + return Json.optional(json, "name_on_document", Conv.STRING); + } + + /** + * Document-specific extras. Bank fields are populated for bank statements when printed on the document; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional extraFields() { + return Json.optional(json, "extra_fields", Conv.model(ProofOfAddressVerifyResponse.Poa.ExtraFields::fromJson)); + } + + /** + * Empty on a clean approval. Every entry explains one detected risk; entries with log_type: "error" set status to Declined. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(ProofOfAddressVerifyResponse.Poa.Warnings::fromJson))); + } + + /** + * QR codes and barcodes detected across every processed page of the document. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> detectedCodes() { + return Json.optional(json, "detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Poa}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Poa from) { + super(from); + } + + /** + * Approved when no warning resolves to a decline; Declined otherwise โ€” the warnings list explains why. + * + * @param status the value + * @return this builder + */ + public Builder status(ProofOfAddressVerifyResponse.Poa.Status status) { + return set("status", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.Status::of), status); + } + + /** + * Country the document was issued in, as extracted from the document โ€” usually ISO 3166-1 alpha-3 (e.g. ARG). + * + * @param issuingState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingState(@Nullable String issuingState) { + return setNullable("issuing_state", Conv.STRING, issuingState); + } + + /** + * Detected document category. UNKNOWN means the document could not be classified as an acceptable Proof of Address and auto-declines with INVALID_DOCUMENT_TYPE. Never null โ€” classification failures fall back to UNKNOWN. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(ProofOfAddressVerifyResponse.Poa.DocumentType documentType) { + return set("document_type", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.DocumentType::of), documentType); + } + + /** + * Finer-grained classification within document_type โ€” e.g. ELECTRICITY_BILL, WATER_BILL, GAS_BILL, INTERNET_BILL, PHONE_BILL (utility bills); ACCOUNT_STATEMENT, CREDIT_CARD_STATEMENT (bank statements); TAX_ASSESSMENT, RESIDENCY_CERTIFICATE (government documents). UNKNOWN when no subtype could be determined. Never null โ€” classification failures fall back to UNKNOWN. + * + * @param documentSubtype the value + * @return this builder + */ + public Builder documentSubtype(String documentSubtype) { + return set("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * Detected document language (ISO 639-1). + * + * @param documentLanguage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentLanguage(@Nullable String documentLanguage) { + return setNullable("document_language", Conv.STRING, documentLanguage); + } + + /** + * Company or organization that issued the document. null adds ISSUER_NOT_IDENTIFIED. + * + * @param issuer the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuer(@Nullable String issuer) { + return setNullable("issuer", Conv.STRING, issuer); + } + + /** + * Document issue date (YYYY-MM-DD). null when it could not be extracted โ€” that declines with UNABLE_TO_EXTRACT_ISSUE_DATE on this endpoint. + * + * @param issueDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issueDate(@Nullable LocalDate issueDate) { + return setNullable("issue_date", Conv.DATE, issueDate); + } + + /** + * Explicit expiry/validity date printed on the document, when present. Independent of the poa_document_age_months age check. + * + * @param expirationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expirationDate(@Nullable LocalDate expirationDate) { + return setNullable("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Address exactly as printed on the document. null auto-declines with MISSING_ADDRESS_INFORMATION. + * + * @param poaAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaAddress(@Nullable String poaAddress) { + return setNullable("poa_address", Conv.STRING, poaAddress); + } + + /** + * Geocoded, normalized version of poa_address. + * + * @param poaFormattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaFormattedAddress(@Nullable String poaFormattedAddress) { + return setNullable("poa_formatted_address", Conv.STRING, poaFormattedAddress); + } + + /** + * Structured, geocoded breakdown of the document address. null when the address could not be parsed. + * + * @param poaParsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaParsedAddress(ProofOfAddressVerifyResponse.Poa.@Nullable PoaParsedAddress poaParsedAddress) { + return setNullable("poa_parsed_address", Conv.model(ProofOfAddressVerifyResponse.Poa.PoaParsedAddress::fromJson), poaParsedAddress); + } + + /** + * Echo of the expected_address you sent, or null. + * + * @param expectedDetailsAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedDetailsAddress(@Nullable String expectedDetailsAddress) { + return setNullable("expected_details_address", Conv.STRING, expectedDetailsAddress); + } + + /** + * Geocoded, normalized version of expected_address; null when not provided or not geocodable. + * + * @param expectedDetailsFormattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedDetailsFormattedAddress(@Nullable String expectedDetailsFormattedAddress) { + return setNullable("expected_details_formatted_address", Conv.STRING, expectedDetailsFormattedAddress); + } + + /** + * Full geocoding result for expected_address (street/city/region/country/postal code plus raw geocoder output and an is_verified flag). null when expected_address was not provided. + * + * @param expectedDetailsParsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedDetailsParsedAddress(@Nullable Map expectedDetailsParsedAddress) { + return setAny("expected_details_parsed_address", expectedDetailsParsedAddress); + } + + /** + * Primary holder name extracted from the document; compared against expected_first_name/expected_last_name when provided. null declines with POA_NAME_NOT_DETECTED on this endpoint. + * + * @param nameOnDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameOnDocument(@Nullable String nameOnDocument) { + return setNullable("name_on_document", Conv.STRING, nameOnDocument); + } + + /** + * Document-specific extras. Bank fields are populated for bank statements when printed on the document; null otherwise. + * + * @param extraFields the value + * @return this builder + */ + public Builder extraFields(ProofOfAddressVerifyResponse.Poa.ExtraFields extraFields) { + return set("extra_fields", Conv.model(ProofOfAddressVerifyResponse.Poa.ExtraFields::fromJson), extraFields); + } + + /** + * Empty on a clean approval. Every entry explains one detected risk; entries with log_type: "error" set status to Declined. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(ProofOfAddressVerifyResponse.Poa.Warnings::fromJson)), warnings); + } + + /** + * QR codes and barcodes detected across every processed page of the document. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @param detectedCodes the value + * @return this builder + */ + public Builder detectedCodes(List detectedCodes) { + return set("detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson)), detectedCodes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Poa} + */ + public Poa build() { + return new Poa(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Approved when no warning resolves to a decline; Declined otherwise โ€” the warnings list explains why. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Detected document category. UNKNOWN means the document could not be classified as an acceptable Proof of Address and auto-declines with INVALID_DOCUMENT_TYPE. Never null โ€” classification failures fall back to UNKNOWN. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "UTILITY_BILL"}. */ + public static final DocumentType UTILITY_BILL = new DocumentType("UTILITY_BILL"); + + /** The value {@code "BANK_STATEMENT"}. */ + public static final DocumentType BANK_STATEMENT = new DocumentType("BANK_STATEMENT"); + + /** The value {@code "GOVERNMENT_ISSUED_DOCUMENT"}. */ + public static final DocumentType GOVERNMENT_ISSUED_DOCUMENT = new DocumentType("GOVERNMENT_ISSUED_DOCUMENT"); + + /** The value {@code "OTHER_POA_DOCUMENT"}. */ + public static final DocumentType OTHER_POA_DOCUMENT = new DocumentType("OTHER_POA_DOCUMENT"); + + /** The value {@code "UNKNOWN"}. */ + public static final DocumentType UNKNOWN = new DocumentType("UNKNOWN"); + + private static final List KNOWN_VALUES = List.of(UTILITY_BILL, BANK_STATEMENT, GOVERNMENT_ISSUED_DOCUMENT, OTHER_POA_DOCUMENT, UNKNOWN); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Structured, geocoded breakdown of the document address. null when the address could not be parsed. + */ + public static final class PoaParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("street_1", "street_2", "city", "region", "country", "postal_code", "document_location"); + + private PoaParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PoaParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PoaParsedAddress fromJson(JsonNode json) { + return new PoaParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * The region field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * Geocoded coordinates of the document address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLocation() { + return Json.optional(json, "document_location", Conv.model(ProofOfAddressVerifyResponse.Poa.PoaParsedAddress.DocumentLocation::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PoaParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PoaParsedAddress from) { + super(from); + } + + /** + * The street_1 field. + * + * @param street1 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street1(@Nullable String street1) { + return setNullable("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * The region field. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * The postal_code field. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * Geocoded coordinates of the document address. + * + * @param documentLocation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentLocation(ProofOfAddressVerifyResponse.Poa.PoaParsedAddress.@Nullable DocumentLocation documentLocation) { + return setNullable("document_location", Conv.model(ProofOfAddressVerifyResponse.Poa.PoaParsedAddress.DocumentLocation::fromJson), documentLocation); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PoaParsedAddress} + */ + public PoaParsedAddress build() { + return new PoaParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Geocoded coordinates of the document address. */ + public static final class DocumentLocation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private DocumentLocation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentLocation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentLocation fromJson(JsonNode json) { + return new DocumentLocation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentLocation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentLocation from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentLocation} + */ + public DocumentLocation build() { + return new DocumentLocation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Document-specific extras. Bank fields are populated for bank statements when printed on the document; null otherwise. + */ + public static final class ExtraFields extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bank_account_number", "bank_iban", "bank_sort_code", "bank_routing_number", "bank_swift_bic", "bank_branch_name", "bank_branch_address", "document_phone_number", "additional_names"); + + private ExtraFields(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ExtraFields} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ExtraFields fromJson(JsonNode json) { + return new ExtraFields(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The bank_account_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankAccountNumber() { + return Json.optional(json, "bank_account_number", Conv.STRING); + } + + /** + * The bank_iban field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankIban() { + return Json.optional(json, "bank_iban", Conv.STRING); + } + + /** + * The bank_sort_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankSortCode() { + return Json.optional(json, "bank_sort_code", Conv.STRING); + } + + /** + * The bank_routing_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankRoutingNumber() { + return Json.optional(json, "bank_routing_number", Conv.STRING); + } + + /** + * The bank_swift_bic field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankSwiftBic() { + return Json.optional(json, "bank_swift_bic", Conv.STRING); + } + + /** + * The bank_branch_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankBranchName() { + return Json.optional(json, "bank_branch_name", Conv.STRING); + } + + /** + * The bank_branch_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankBranchAddress() { + return Json.optional(json, "bank_branch_address", Conv.STRING); + } + + /** + * Contact phone number printed on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentPhoneNumber() { + return Json.optional(json, "document_phone_number", Conv.STRING); + } + + /** + * Other holder names found on the document (e.g. co-account holders, previous account names). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalNames() { + return Json.optional(json, "additional_names", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ExtraFields}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ExtraFields from) { + super(from); + } + + /** + * The bank_account_number field. + * + * @param bankAccountNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankAccountNumber(@Nullable String bankAccountNumber) { + return setNullable("bank_account_number", Conv.STRING, bankAccountNumber); + } + + /** + * The bank_iban field. + * + * @param bankIban the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankIban(@Nullable String bankIban) { + return setNullable("bank_iban", Conv.STRING, bankIban); + } + + /** + * The bank_sort_code field. + * + * @param bankSortCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankSortCode(@Nullable String bankSortCode) { + return setNullable("bank_sort_code", Conv.STRING, bankSortCode); + } + + /** + * The bank_routing_number field. + * + * @param bankRoutingNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankRoutingNumber(@Nullable String bankRoutingNumber) { + return setNullable("bank_routing_number", Conv.STRING, bankRoutingNumber); + } + + /** + * The bank_swift_bic field. + * + * @param bankSwiftBic the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankSwiftBic(@Nullable String bankSwiftBic) { + return setNullable("bank_swift_bic", Conv.STRING, bankSwiftBic); + } + + /** + * The bank_branch_name field. + * + * @param bankBranchName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankBranchName(@Nullable String bankBranchName) { + return setNullable("bank_branch_name", Conv.STRING, bankBranchName); + } + + /** + * The bank_branch_address field. + * + * @param bankBranchAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankBranchAddress(@Nullable String bankBranchAddress) { + return setNullable("bank_branch_address", Conv.STRING, bankBranchAddress); + } + + /** + * Contact phone number printed on the document. + * + * @param documentPhoneNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentPhoneNumber(@Nullable String documentPhoneNumber) { + return setNullable("document_phone_number", Conv.STRING, documentPhoneNumber); + } + + /** + * Other holder names found on the document (e.g. co-account holders, previous account names). + * + * @param additionalNames the value + * @return this builder + */ + public Builder additionalNames(List additionalNames) { + return set("additional_names", Conv.list(Conv.STRING), additionalNames); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ExtraFields} + */ + public ExtraFields build() { + return new ExtraFields(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("risk", "feature", "additional_data", "log_type", "short_description", "long_description"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable risk code. Always-decline: MISSING_ADDRESS_INFORMATION, POA_DOCUMENT_EXPIRED, INVALID_DOCUMENT_TYPE, UNABLE_TO_VALIDATE_DOCUMENT_AGE, plus UNABLE_TO_EXTRACT_ISSUE_DATE and POA_NAME_NOT_DETECTED (fixed to decline on this endpoint). Governed by request options: NAME_MISMATCH_WITH_PROVIDED / ADDRESS_MISMATCH_WITH_PROVIDED / POA_COUNTRY_MISMATCH_WITH_PROVIDED (poa_address_mismatch_action), POOR_DOCUMENT_QUALITY (never produced by this endpoint) / DOCUMENT_METADATA_MISMATCH (poa_document_issues_action), SUSPECTED_DOCUMENT_MANIPULATION (poa_document_authenticity_action), UNSUPPORTED_DOCUMENT_LANGUAGE (poa_unsupported_language_action), ISSUER_NOT_IDENTIFIED (poa_issuer_not_identified_action). Informational on this endpoint: POA_DOCUMENT_NOT_SUPPORTED_FOR_APPLICATION, UNPARSABLE_OR_INVALID_ADDRESS. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Feature that raised the warning. Always PROOF_OF_ADDRESS on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.Warnings.Feature::of)); + } + + /** + * Extra context for some risks โ€” e.g. POA_DOCUMENT_EXPIRED includes expiration_reason (printed_expiration or age_window), document_type, document_subtype, and issue_date, plus expiration_date on the printed_expiration path or max_age_months on the age_window path; SUSPECTED_DOCUMENT_MANIPULATION includes reason and detection_method. null for most risks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity. error warnings drive status to Declined; information entries are advisory and never decline on their own. (warning is not produced by this endpoint โ€” its options only accept DECLINE or NO_ACTION.) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.Warnings.LogType::of)); + } + + /** + * Human-readable one-line summary of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation of the risk. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * Machine-readable risk code. Always-decline: MISSING_ADDRESS_INFORMATION, POA_DOCUMENT_EXPIRED, INVALID_DOCUMENT_TYPE, UNABLE_TO_VALIDATE_DOCUMENT_AGE, plus UNABLE_TO_EXTRACT_ISSUE_DATE and POA_NAME_NOT_DETECTED (fixed to decline on this endpoint). Governed by request options: NAME_MISMATCH_WITH_PROVIDED / ADDRESS_MISMATCH_WITH_PROVIDED / POA_COUNTRY_MISMATCH_WITH_PROVIDED (poa_address_mismatch_action), POOR_DOCUMENT_QUALITY (never produced by this endpoint) / DOCUMENT_METADATA_MISMATCH (poa_document_issues_action), SUSPECTED_DOCUMENT_MANIPULATION (poa_document_authenticity_action), UNSUPPORTED_DOCUMENT_LANGUAGE (poa_unsupported_language_action), ISSUER_NOT_IDENTIFIED (poa_issuer_not_identified_action). Informational on this endpoint: POA_DOCUMENT_NOT_SUPPORTED_FOR_APPLICATION, UNPARSABLE_OR_INVALID_ADDRESS. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Feature that raised the warning. Always PROOF_OF_ADDRESS on this endpoint. + * + * @param feature the value + * @return this builder + */ + public Builder feature(ProofOfAddressVerifyResponse.Poa.Warnings.Feature feature) { + return set("feature", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.Warnings.Feature::of), feature); + } + + /** + * Extra context for some risks โ€” e.g. POA_DOCUMENT_EXPIRED includes expiration_reason (printed_expiration or age_window), document_type, document_subtype, and issue_date, plus expiration_date on the printed_expiration path or max_age_months on the age_window path; SUSPECTED_DOCUMENT_MANIPULATION includes reason and detection_method. null for most risks. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity. error warnings drive status to Declined; information entries are advisory and never decline on their own. (warning is not produced by this endpoint โ€” its options only accept DECLINE or NO_ACTION.) + * + * @param logType the value + * @return this builder + */ + public Builder logType(ProofOfAddressVerifyResponse.Poa.Warnings.LogType logType) { + return set("log_type", Conv.enumeration(ProofOfAddressVerifyResponse.Poa.Warnings.LogType::of), logType); + } + + /** + * Human-readable one-line summary of the risk. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation of the risk. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature that raised the warning. Always PROOF_OF_ADDRESS on this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + private static final List KNOWN_VALUES = List.of(PROOF_OF_ADDRESS); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Severity. error warnings drive status to Declined; information entries are advisory and never decline on their own. (warning is not produced by this endpoint โ€” its options only accept DECLINE or NO_ACTION.) + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/QuestionnaireDetail.java b/src/main/java/me/didit/types/QuestionnaireDetail.java new file mode 100644 index 0000000..b1d1160 --- /dev/null +++ b/src/main/java/me/didit/types/QuestionnaireDetail.java @@ -0,0 +1,404 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Full questionnaire detail returned from GET, POST (create) and PATCH (update) endpoints. */ +public final class QuestionnaireDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("questionnaire_id", "title", "description", "languages", "default_language", "is_active", "is_simple_questionnaire", "graph", "sections", "questionnaire_group_id", "version", "status", "published_at", "is_editable"); + + private QuestionnaireDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code QuestionnaireDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static QuestionnaireDetail fromJson(JsonNode json) { + return new QuestionnaireDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier of the questionnaire. Use this id when referencing the questionnaire from a workflow or in subsequent update/delete requests. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional questionnaireId() { + return Json.optional(json, "questionnaire_id", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The languages field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> languages() { + return Json.optional(json, "languages", Conv.list(Conv.STRING)); + } + + /** + * The default_language field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultLanguage() { + return Json.optional(json, "default_language", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The is_simple_questionnaire field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSimpleQuestionnaire() { + return Json.optional(json, "is_simple_questionnaire", Conv.BOOLEAN); + } + + /** + * Graph structure with start_node and nodes map. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> graph() { + return Json.optional(json, "graph", Conv.OBJECT); + } + + /** + * Questionnaire content grouped into sections (derived from the graph). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> sections() { + return Json.optional(json, "sections", Conv.list(Conv.OBJECT)); + } + + /** + * Stable identifier that groups all versions of the same questionnaire. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional questionnaireGroupId() { + return Json.optional(json, "questionnaire_group_id", Conv.STRING); + } + + /** + * The version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(QuestionnaireDetail.Status::of)); + } + + /** + * The published_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publishedAt() { + return Json.optional(json, "published_at", Conv.DATE_TIME); + } + + /** + * True when the questionnaire can still be edited in place (draft versions). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link QuestionnaireDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(QuestionnaireDetail from) { + super(from); + } + + /** + * Unique identifier of the questionnaire. Use this id when referencing the questionnaire from a workflow or in subsequent update/delete requests. + * + * @param questionnaireId the value + * @return this builder + */ + public Builder questionnaireId(String questionnaireId) { + return set("questionnaire_id", Conv.STRING, questionnaireId); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The languages field. + * + * @param languages the value + * @return this builder + */ + public Builder languages(List languages) { + return set("languages", Conv.list(Conv.STRING), languages); + } + + /** + * The default_language field. + * + * @param defaultLanguage the value + * @return this builder + */ + public Builder defaultLanguage(String defaultLanguage) { + return set("default_language", Conv.STRING, defaultLanguage); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The is_simple_questionnaire field. + * + * @param isSimpleQuestionnaire the value + * @return this builder + */ + public Builder isSimpleQuestionnaire(boolean isSimpleQuestionnaire) { + return set("is_simple_questionnaire", Conv.BOOLEAN, isSimpleQuestionnaire); + } + + /** + * Graph structure with start_node and nodes map. + * + * @param graph the value + * @return this builder + */ + public Builder graph(Map graph) { + return setAny("graph", graph); + } + + /** + * Questionnaire content grouped into sections (derived from the graph). + * + * @param sections the value + * @return this builder + */ + public Builder sections(List> sections) { + return setAny("sections", sections); + } + + /** + * Stable identifier that groups all versions of the same questionnaire. + * + * @param questionnaireGroupId the value + * @return this builder + */ + public Builder questionnaireGroupId(String questionnaireGroupId) { + return set("questionnaire_group_id", Conv.STRING, questionnaireGroupId); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(QuestionnaireDetail.Status status) { + return set("status", Conv.enumeration(QuestionnaireDetail.Status::of), status); + } + + /** + * The published_at field. + * + * @param publishedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder publishedAt(@Nullable OffsetDateTime publishedAt) { + return setNullable("published_at", Conv.DATE_TIME, publishedAt); + } + + /** + * True when the questionnaire can still be edited in place (draft versions). + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Builds the value. + * + * @return a new immutable {@code QuestionnaireDetail} + */ + public QuestionnaireDetail build() { + return new QuestionnaireDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/QuestionnaireListItem.java b/src/main/java/me/didit/types/QuestionnaireListItem.java new file mode 100644 index 0000000..2e304c6 --- /dev/null +++ b/src/main/java/me/didit/types/QuestionnaireListItem.java @@ -0,0 +1,444 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** One questionnaire version in the list view. */ +public final class QuestionnaireListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "title", "description", "languages", "default_language", "is_active", "is_simple_questionnaire", "created_at", "updated_at", "question_types", "workflow_names", "questionnaire_group_id", "version", "status", "published_at", "is_editable"); + + private QuestionnaireListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code QuestionnaireListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static QuestionnaireListItem fromJson(JsonNode json) { + return new QuestionnaireListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Per-version UUID. Use as {questionnaire_uuid} for get/update/delete and as questionnaire_uuid in a workflow's QUESTIONNAIRE feature config. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The languages field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> languages() { + return Json.optional(json, "languages", Conv.list(Conv.STRING)); + } + + /** + * The default_language field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultLanguage() { + return Json.optional(json, "default_language", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * True for linear questionnaires created through this API; false for graph-based questionnaires built in the Console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSimpleQuestionnaire() { + return Json.optional(json, "is_simple_questionnaire", Conv.BOOLEAN); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * Uppercase element types of the answerable questions, in creation order (e.g. SHORT_TEXT, MULTIPLE_CHOICE, FILE_UPLOAD). Structural SECTION_HEADER and SEPARATOR elements are excluded. One entry per question, so values can repeat. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> questionTypes() { + return Json.optional(json, "question_types", Conv.list(Conv.STRING)); + } + + /** + * Names of workflows using this questionnaire. Currently always [] on this endpoint (populated only in the Console listing). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> workflowNames() { + return Json.optional(json, "workflow_names", Conv.list(Conv.STRING)); + } + + /** + * Stable identifier that groups all versions of the same questionnaire. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional questionnaireGroupId() { + return Json.optional(json, "questionnaire_group_id", Conv.STRING); + } + + /** + * Version number within the group, starting at 1. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(QuestionnaireListItem.Status::of)); + } + + /** + * When this version was published. null for drafts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publishedAt() { + return Json.optional(json, "published_at", Conv.DATE_TIME); + } + + /** + * True when this version is a draft. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link QuestionnaireListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(QuestionnaireListItem from) { + super(from); + } + + /** + * Per-version UUID. Use as {questionnaire_uuid} for get/update/delete and as questionnaire_uuid in a workflow's QUESTIONNAIRE feature config. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The languages field. + * + * @param languages the value + * @return this builder + */ + public Builder languages(List languages) { + return set("languages", Conv.list(Conv.STRING), languages); + } + + /** + * The default_language field. + * + * @param defaultLanguage the value + * @return this builder + */ + public Builder defaultLanguage(String defaultLanguage) { + return set("default_language", Conv.STRING, defaultLanguage); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * True for linear questionnaires created through this API; false for graph-based questionnaires built in the Console. + * + * @param isSimpleQuestionnaire the value + * @return this builder + */ + public Builder isSimpleQuestionnaire(boolean isSimpleQuestionnaire) { + return set("is_simple_questionnaire", Conv.BOOLEAN, isSimpleQuestionnaire); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Uppercase element types of the answerable questions, in creation order (e.g. SHORT_TEXT, MULTIPLE_CHOICE, FILE_UPLOAD). Structural SECTION_HEADER and SEPARATOR elements are excluded. One entry per question, so values can repeat. + * + * @param questionTypes the value + * @return this builder + */ + public Builder questionTypes(List questionTypes) { + return set("question_types", Conv.list(Conv.STRING), questionTypes); + } + + /** + * Names of workflows using this questionnaire. Currently always [] on this endpoint (populated only in the Console listing). + * + * @param workflowNames the value + * @return this builder + */ + public Builder workflowNames(List workflowNames) { + return set("workflow_names", Conv.list(Conv.STRING), workflowNames); + } + + /** + * Stable identifier that groups all versions of the same questionnaire. + * + * @param questionnaireGroupId the value + * @return this builder + */ + public Builder questionnaireGroupId(String questionnaireGroupId) { + return set("questionnaire_group_id", Conv.STRING, questionnaireGroupId); + } + + /** + * Version number within the group, starting at 1. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(QuestionnaireListItem.Status status) { + return set("status", Conv.enumeration(QuestionnaireListItem.Status::of), status); + } + + /** + * When this version was published. null for drafts. + * + * @param publishedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder publishedAt(@Nullable OffsetDateTime publishedAt) { + return setNullable("published_at", Conv.DATE_TIME, publishedAt); + } + + /** + * True when this version is a draft. + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Builds the value. + * + * @return a new immutable {@code QuestionnaireListItem} + */ + public QuestionnaireListItem build() { + return new QuestionnaireListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/QuestionnairesListParams.java b/src/main/java/me/didit/types/QuestionnairesListParams.java new file mode 100644 index 0000000..9bc0634 --- /dev/null +++ b/src/main/java/me/didit/types/QuestionnairesListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code questionnaires.list}. */ +public final class QuestionnairesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private QuestionnairesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code QuestionnairesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static QuestionnairesListParams fromJson(JsonNode json) { + return new QuestionnairesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size (number of questionnaires per page). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Number of rows to skip before the first returned questionnaire. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link QuestionnairesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(QuestionnairesListParams from) { + super(from); + } + + /** + * Page size (number of questionnaires per page). + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Number of rows to skip before the first returned questionnaire. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code QuestionnairesListParams} + */ + public QuestionnairesListParams build() { + return new QuestionnairesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/QuestionnairesListResponse.java b/src/main/java/me/didit/types/QuestionnairesListResponse.java new file mode 100644 index 0000000..9389e19 --- /dev/null +++ b/src/main/java/me/didit/types/QuestionnairesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class QuestionnairesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private QuestionnairesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code QuestionnairesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static QuestionnairesListResponse fromJson(JsonNode json) { + return new QuestionnairesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Total number of questionnaire versions for the application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(QuestionnaireListItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link QuestionnairesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(QuestionnairesListResponse from) { + super(from); + } + + /** + * Total number of questionnaire versions for the application. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(QuestionnaireListItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code QuestionnairesListResponse} + */ + public QuestionnairesListResponse build() { + return new QuestionnairesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RateLimitError.java b/src/main/java/me/didit/types/RateLimitError.java new file mode 100644 index 0000000..edb8500 --- /dev/null +++ b/src/main/java/me/didit/types/RateLimitError.java @@ -0,0 +1,99 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Rate-limit or progressive-lockout response. wait is the cooldown in seconds. */ +public final class RateLimitError extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private RateLimitError(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RateLimitError} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RateLimitError fromJson(JsonNode json) { + return new RateLimitError(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RateLimitError}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RateLimitError from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RateLimitError} + */ + public RateLimitError build() { + return new RateLimitError(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RegisterRequest.java b/src/main/java/me/didit/types/RegisterRequest.java new file mode 100644 index 0000000..3d519ca --- /dev/null +++ b/src/main/java/me/didit/types/RegisterRequest.java @@ -0,0 +1,120 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class RegisterRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "password"); + + private RegisterRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegisterRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegisterRequest fromJson(JsonNode json) { + return new RegisterRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Any valid email address (personal, work, alias). Used as the unique account identifier. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * Minimum 8 characters. Must contain at least one uppercase letter (A-Z), one lowercase letter (a-z), one digit (0-9), and one special character from !@#$%^&*()_+-=[]{}|;:,.<>?. Validation reports one failed rule at a time. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String password() { + return Json.required(json, "password", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegisterRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegisterRequest from) { + super(from); + } + + /** + * Any valid email address (personal, work, alias). Used as the unique account identifier. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Minimum 8 characters. Must contain at least one uppercase letter (A-Z), one lowercase letter (a-z), one digit (0-9), and one special character from !@#$%^&*()_+-=[]{}|;:,.<>?. Validation reports one failed rule at a time. + * + * @param password the value + * @return this builder + */ + public Builder password(String password) { + return set("password", Conv.STRING, password); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegisterRequest} + * @throws IllegalStateException when a required field is missing + */ + public RegisterRequest build() { + require("email", false); + require("password", false); + return new RegisterRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RegisterResponse.java b/src/main/java/me/didit/types/RegisterResponse.java new file mode 100644 index 0000000..b522079 --- /dev/null +++ b/src/main/java/me/didit/types/RegisterResponse.java @@ -0,0 +1,118 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class RegisterResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("message", "email"); + + private RegisterResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegisterResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegisterResponse fromJson(JsonNode json) { + return new RegisterResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Human-readable confirmation that the verification code was sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + /** + * The email the verification code was sent to. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegisterResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegisterResponse from) { + super(from); + } + + /** + * Human-readable confirmation that the verification code was sent. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * The email the verification code was sent to. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegisterResponse} + */ + public RegisterResponse build() { + return new RegisterResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportDetail.java b/src/main/java/me/didit/types/RegulatoryReportDetail.java new file mode 100644 index 0000000..e41345b --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportDetail.java @@ -0,0 +1,1179 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class RegulatoryReportDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "case_uuid", "case_number", "report_type", "report_type_display", "report_code", "report_number", "status", "status_display", "jurisdiction", "rentity_id", "rentity_branch", "submission_code", "entity_reference", "fiu_ref_number", "currency_code_local", "submission_date", "reporting_person", "location", "reason", "action", "activity", "narrative", "report_indicators", "included_fields", "transactions", "validation_errors", "validated_at", "finalized_at", "created_by_email", "created_by_name", "created_at", "updated_at"); + + private RegulatoryReportDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportDetail fromJson(JsonNode json) { + return new RegulatoryReportDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The case_uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseUuid() { + return Json.optional(json, "case_uuid", Conv.STRING); + } + + /** + * The case_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseNumber() { + return Json.optional(json, "case_number", Conv.STRING); + } + + /** + * The report_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportType() { + return Json.optional(json, "report_type", Conv.enumeration(RegulatoryReportDetail.ReportType::of)); + } + + /** + * The report_type_display field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportTypeDisplay() { + return Json.optional(json, "report_type_display", Conv.STRING); + } + + /** + * goAML report code derived from report_type, e.g. STR, CTR, BCR. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportCode() { + return Json.optional(json, "report_code", Conv.STRING); + } + + /** + * The report_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportNumber() { + return Json.optional(json, "report_number", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(RegulatoryReportDetail.Status::of)); + } + + /** + * The status_display field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional statusDisplay() { + return Json.optional(json, "status_display", Conv.STRING); + } + + /** + * The jurisdiction field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * Reporting entity ID issued by the FIU. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityId() { + return Json.optional(json, "rentity_id", Conv.STRING); + } + + /** + * The rentity_branch field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityBranch() { + return Json.optional(json, "rentity_branch", Conv.STRING); + } + + /** + * The submission_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionCode() { + return Json.optional(json, "submission_code", Conv.enumeration(RegulatoryReportDetail.SubmissionCode::of)); + } + + /** + * The entity_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityReference() { + return Json.optional(json, "entity_reference", Conv.STRING); + } + + /** + * The fiu_ref_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fiuRefNumber() { + return Json.optional(json, "fiu_ref_number", Conv.STRING); + } + + /** + * The currency_code_local field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currencyCodeLocal() { + return Json.optional(json, "currency_code_local", Conv.STRING); + } + + /** + * The submission_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionDate() { + return Json.optional(json, "submission_date", Conv.DATE_TIME); + } + + /** + * The reporting_person field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportingPerson() { + return Json.optional(json, "reporting_person", Conv.OBJECT); + } + + /** + * The location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> location() { + return Json.optional(json, "location", Conv.OBJECT); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The action field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.STRING); + } + + /** + * The activity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activity() { + return Json.optional(json, "activity", Conv.STRING); + } + + /** + * Five Ws narrative sections. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional narrative() { + return Json.optional(json, "narrative", Conv.model(RegulatoryReportDetail.Narrative::fromJson)); + } + + /** + * The report_indicators field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportIndicators() { + return Json.optional(json, "report_indicators", Conv.list(Conv.STRING)); + } + + /** + * The included_fields field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> includedFields() { + return Json.optional(json, "included_fields", Conv.list(Conv.STRING)); + } + + /** + * The transactions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> transactions() { + return Json.optional(json, "transactions", Conv.list(Conv.STRING)); + } + + /** + * Result of the most recent validation; each entry is a {field, message} object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> validationErrors() { + return Json.optional(json, "validation_errors", Conv.list(Conv.model(RegulatoryReportDetail.ValidationErrors::fromJson))); + } + + /** + * The validated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validatedAt() { + return Json.optional(json, "validated_at", Conv.DATE_TIME); + } + + /** + * The finalized_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional finalizedAt() { + return Json.optional(json, "finalized_at", Conv.DATE_TIME); + } + + /** + * The created_by_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdByEmail() { + return Json.optional(json, "created_by_email", Conv.STRING); + } + + /** + * The created_by_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdByName() { + return Json.optional(json, "created_by_name", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The case_uuid field. + * + * @param caseUuid the value + * @return this builder + */ + public Builder caseUuid(String caseUuid) { + return set("case_uuid", Conv.STRING, caseUuid); + } + + /** + * The case_number field. + * + * @param caseNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder caseNumber(@Nullable String caseNumber) { + return setNullable("case_number", Conv.STRING, caseNumber); + } + + /** + * The report_type field. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(RegulatoryReportDetail.ReportType reportType) { + return set("report_type", Conv.enumeration(RegulatoryReportDetail.ReportType::of), reportType); + } + + /** + * The report_type_display field. + * + * @param reportTypeDisplay the value + * @return this builder + */ + public Builder reportTypeDisplay(String reportTypeDisplay) { + return set("report_type_display", Conv.STRING, reportTypeDisplay); + } + + /** + * goAML report code derived from report_type, e.g. STR, CTR, BCR. + * + * @param reportCode the value + * @return this builder + */ + public Builder reportCode(String reportCode) { + return set("report_code", Conv.STRING, reportCode); + } + + /** + * The report_number field. + * + * @param reportNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reportNumber(@Nullable String reportNumber) { + return setNullable("report_number", Conv.STRING, reportNumber); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(RegulatoryReportDetail.Status status) { + return set("status", Conv.enumeration(RegulatoryReportDetail.Status::of), status); + } + + /** + * The status_display field. + * + * @param statusDisplay the value + * @return this builder + */ + public Builder statusDisplay(String statusDisplay) { + return set("status_display", Conv.STRING, statusDisplay); + } + + /** + * The jurisdiction field. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * Reporting entity ID issued by the FIU. + * + * @param rentityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityId(@Nullable String rentityId) { + return setNullable("rentity_id", Conv.STRING, rentityId); + } + + /** + * The rentity_branch field. + * + * @param rentityBranch the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityBranch(@Nullable String rentityBranch) { + return setNullable("rentity_branch", Conv.STRING, rentityBranch); + } + + /** + * The submission_code field. + * + * @param submissionCode the value + * @return this builder + */ + public Builder submissionCode(RegulatoryReportDetail.SubmissionCode submissionCode) { + return set("submission_code", Conv.enumeration(RegulatoryReportDetail.SubmissionCode::of), submissionCode); + } + + /** + * The entity_reference field. + * + * @param entityReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityReference(@Nullable String entityReference) { + return setNullable("entity_reference", Conv.STRING, entityReference); + } + + /** + * The fiu_ref_number field. + * + * @param fiuRefNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fiuRefNumber(@Nullable String fiuRefNumber) { + return setNullable("fiu_ref_number", Conv.STRING, fiuRefNumber); + } + + /** + * The currency_code_local field. + * + * @param currencyCodeLocal the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currencyCodeLocal(@Nullable String currencyCodeLocal) { + return setNullable("currency_code_local", Conv.STRING, currencyCodeLocal); + } + + /** + * The submission_date field. + * + * @param submissionDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder submissionDate(@Nullable OffsetDateTime submissionDate) { + return setNullable("submission_date", Conv.DATE_TIME, submissionDate); + } + + /** + * The reporting_person field. + * + * @param reportingPerson the value + * @return this builder + */ + public Builder reportingPerson(Map reportingPerson) { + return setAny("reporting_person", reportingPerson); + } + + /** + * The location field. + * + * @param location the value + * @return this builder + */ + public Builder location(Map location) { + return setAny("location", location); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The action field. + * + * @param action the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder action(@Nullable String action) { + return setNullable("action", Conv.STRING, action); + } + + /** + * The activity field. + * + * @param activity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder activity(@Nullable String activity) { + return setNullable("activity", Conv.STRING, activity); + } + + /** + * Five Ws narrative sections. + * + * @param narrative the value + * @return this builder + */ + public Builder narrative(RegulatoryReportDetail.Narrative narrative) { + return set("narrative", Conv.model(RegulatoryReportDetail.Narrative::fromJson), narrative); + } + + /** + * The report_indicators field. + * + * @param reportIndicators the value + * @return this builder + */ + public Builder reportIndicators(List reportIndicators) { + return set("report_indicators", Conv.list(Conv.STRING), reportIndicators); + } + + /** + * The included_fields field. + * + * @param includedFields the value + * @return this builder + */ + public Builder includedFields(List includedFields) { + return set("included_fields", Conv.list(Conv.STRING), includedFields); + } + + /** + * The transactions field. + * + * @param transactions the value + * @return this builder + */ + public Builder transactions(List transactions) { + return set("transactions", Conv.list(Conv.STRING), transactions); + } + + /** + * Result of the most recent validation; each entry is a {field, message} object. + * + * @param validationErrors the value + * @return this builder + */ + public Builder validationErrors(List validationErrors) { + return set("validation_errors", Conv.list(Conv.model(RegulatoryReportDetail.ValidationErrors::fromJson)), validationErrors); + } + + /** + * The validated_at field. + * + * @param validatedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder validatedAt(@Nullable OffsetDateTime validatedAt) { + return setNullable("validated_at", Conv.DATE_TIME, validatedAt); + } + + /** + * The finalized_at field. + * + * @param finalizedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder finalizedAt(@Nullable OffsetDateTime finalizedAt) { + return setNullable("finalized_at", Conv.DATE_TIME, finalizedAt); + } + + /** + * The created_by_email field. + * + * @param createdByEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder createdByEmail(@Nullable String createdByEmail) { + return setNullable("created_by_email", Conv.STRING, createdByEmail); + } + + /** + * The created_by_name field. + * + * @param createdByName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder createdByName(@Nullable String createdByName) { + return setNullable("created_by_name", Conv.STRING, createdByName); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportDetail} + */ + public RegulatoryReportDetail build() { + return new RegulatoryReportDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "DRAFT"}. */ + public static final Status DRAFT = new Status("DRAFT"); + + /** The value {@code "VALIDATED"}. */ + public static final Status VALIDATED = new Status("VALIDATED"); + + /** The value {@code "FINALIZED"}. */ + public static final Status FINALIZED = new Status("FINALIZED"); + + private static final List KNOWN_VALUES = List.of(DRAFT, VALIDATED, FINALIZED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SubmissionCode extends StringEnum { + /** The value {@code "E"}. */ + public static final SubmissionCode E = new SubmissionCode("E"); + + /** The value {@code "M"}. */ + public static final SubmissionCode M = new SubmissionCode("M"); + + private static final List KNOWN_VALUES = List.of(E, M); + + private SubmissionCode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SubmissionCode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SubmissionCode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Five Ws narrative sections. */ + public static final class Narrative extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("who", "what", "when", "where", "why", "how"); + + private Narrative(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Narrative} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Narrative fromJson(JsonNode json) { + return new Narrative(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The who field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional who() { + return Json.optional(json, "who", Conv.STRING); + } + + /** + * The what field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional what() { + return Json.optional(json, "what", Conv.STRING); + } + + /** + * The when field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional when_() { + return Json.optional(json, "when", Conv.STRING); + } + + /** + * The where field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional where() { + return Json.optional(json, "where", Conv.STRING); + } + + /** + * The why field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional why() { + return Json.optional(json, "why", Conv.STRING); + } + + /** + * The how field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional how() { + return Json.optional(json, "how", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Narrative}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Narrative from) { + super(from); + } + + /** + * The who field. + * + * @param who the value + * @return this builder + */ + public Builder who(String who) { + return set("who", Conv.STRING, who); + } + + /** + * The what field. + * + * @param what the value + * @return this builder + */ + public Builder what(String what) { + return set("what", Conv.STRING, what); + } + + /** + * The when field. + * + * @param when_ the value + * @return this builder + */ + public Builder when_(String when_) { + return set("when", Conv.STRING, when_); + } + + /** + * The where field. + * + * @param where the value + * @return this builder + */ + public Builder where(String where) { + return set("where", Conv.STRING, where); + } + + /** + * The why field. + * + * @param why the value + * @return this builder + */ + public Builder why(String why) { + return set("why", Conv.STRING, why); + } + + /** + * The how field. + * + * @param how the value + * @return this builder + */ + public Builder how(String how) { + return set("how", Conv.STRING, how); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Narrative} + */ + public Narrative build() { + return new Narrative(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class ValidationErrors extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("field", "message"); + + private ValidationErrors(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ValidationErrors} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ValidationErrors fromJson(JsonNode json) { + return new ValidationErrors(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The field field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional field() { + return Json.optional(json, "field", Conv.STRING); + } + + /** + * The message field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ValidationErrors}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ValidationErrors from) { + super(from); + } + + /** + * The field field. + * + * @param field the value + * @return this builder + */ + public Builder field(String field) { + return set("field", Conv.STRING, field); + } + + /** + * The message field. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ValidationErrors} + */ + public ValidationErrors build() { + return new ValidationErrors(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsCreateParams.java b/src/main/java/me/didit/types/RegulatoryReportsCreateParams.java new file mode 100644 index 0000000..3975409 --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsCreateParams.java @@ -0,0 +1,773 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code regulatory_reports.create}. */ +public final class RegulatoryReportsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case", "template", "report_type", "jurisdiction", "transactions", "rentity_id", "rentity_branch", "submission_code", "entity_reference", "fiu_ref_number", "currency_code_local", "submission_date", "reporting_person", "location", "reason", "action", "activity", "narrative", "report_indicators", "included_fields"); + + private RegulatoryReportsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsCreateParams fromJson(JsonNode json) { + return new RegulatoryReportsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The case field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String case_() { + return Json.required(json, "case", Conv.STRING); + } + + /** + * The template field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String template() { + return Json.required(json, "template", Conv.STRING); + } + + /** + * Required unless a template is given; the template's report_type is used otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportType() { + return Json.optional(json, "report_type", Conv.enumeration(RegulatoryReportsCreateParams.ReportType::of)); + } + + /** + * Required unless a template is given. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * Transactions to attach; defaults to the case's linked transactions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> transactions() { + return Json.optional(json, "transactions", Conv.list(Conv.STRING)); + } + + /** + * The rentity_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityId() { + return Json.optional(json, "rentity_id", Conv.STRING); + } + + /** + * The rentity_branch field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityBranch() { + return Json.optional(json, "rentity_branch", Conv.STRING); + } + + /** + * The submission_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionCode() { + return Json.optional(json, "submission_code", Conv.enumeration(RegulatoryReportsCreateParams.SubmissionCode::of)); + } + + /** + * The entity_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityReference() { + return Json.optional(json, "entity_reference", Conv.STRING); + } + + /** + * The fiu_ref_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fiuRefNumber() { + return Json.optional(json, "fiu_ref_number", Conv.STRING); + } + + /** + * The currency_code_local field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currencyCodeLocal() { + return Json.optional(json, "currency_code_local", Conv.STRING); + } + + /** + * The submission_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionDate() { + return Json.optional(json, "submission_date", Conv.DATE_TIME); + } + + /** + * The reporting_person field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportingPerson() { + return Json.optional(json, "reporting_person", Conv.OBJECT); + } + + /** + * The location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> location() { + return Json.optional(json, "location", Conv.OBJECT); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The action field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.STRING); + } + + /** + * The activity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activity() { + return Json.optional(json, "activity", Conv.STRING); + } + + /** + * The narrative field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional narrative() { + return Json.optional(json, "narrative", Conv.model(RegulatoryReportsCreateParams.Narrative::fromJson)); + } + + /** + * The report_indicators field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportIndicators() { + return Json.optional(json, "report_indicators", Conv.list(Conv.STRING)); + } + + /** + * The included_fields field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> includedFields() { + return Json.optional(json, "included_fields", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsCreateParams from) { + super(from); + } + + /** + * The case field. + * + * @param case_ the value + * @return this builder + */ + public Builder case_(String case_) { + return set("case", Conv.STRING, case_); + } + + /** + * The template field. + * + * @param template the value + * @return this builder + */ + public Builder template(String template) { + return set("template", Conv.STRING, template); + } + + /** + * Required unless a template is given; the template's report_type is used otherwise. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(RegulatoryReportsCreateParams.ReportType reportType) { + return set("report_type", Conv.enumeration(RegulatoryReportsCreateParams.ReportType::of), reportType); + } + + /** + * Required unless a template is given. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * Transactions to attach; defaults to the case's linked transactions. + * + * @param transactions the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder transactions(@Nullable List transactions) { + return setNullable("transactions", Conv.list(Conv.STRING), transactions); + } + + /** + * The rentity_id field. + * + * @param rentityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityId(@Nullable String rentityId) { + return setNullable("rentity_id", Conv.STRING, rentityId); + } + + /** + * The rentity_branch field. + * + * @param rentityBranch the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityBranch(@Nullable String rentityBranch) { + return setNullable("rentity_branch", Conv.STRING, rentityBranch); + } + + /** + * The submission_code field. + * + * @param submissionCode the value + * @return this builder + */ + public Builder submissionCode(RegulatoryReportsCreateParams.SubmissionCode submissionCode) { + return set("submission_code", Conv.enumeration(RegulatoryReportsCreateParams.SubmissionCode::of), submissionCode); + } + + /** + * The entity_reference field. + * + * @param entityReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityReference(@Nullable String entityReference) { + return setNullable("entity_reference", Conv.STRING, entityReference); + } + + /** + * The fiu_ref_number field. + * + * @param fiuRefNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fiuRefNumber(@Nullable String fiuRefNumber) { + return setNullable("fiu_ref_number", Conv.STRING, fiuRefNumber); + } + + /** + * The currency_code_local field. + * + * @param currencyCodeLocal the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currencyCodeLocal(@Nullable String currencyCodeLocal) { + return setNullable("currency_code_local", Conv.STRING, currencyCodeLocal); + } + + /** + * The submission_date field. + * + * @param submissionDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder submissionDate(@Nullable OffsetDateTime submissionDate) { + return setNullable("submission_date", Conv.DATE_TIME, submissionDate); + } + + /** + * The reporting_person field. + * + * @param reportingPerson the value + * @return this builder + */ + public Builder reportingPerson(Map reportingPerson) { + return setAny("reporting_person", reportingPerson); + } + + /** + * The location field. + * + * @param location the value + * @return this builder + */ + public Builder location(Map location) { + return setAny("location", location); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The action field. + * + * @param action the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder action(@Nullable String action) { + return setNullable("action", Conv.STRING, action); + } + + /** + * The activity field. + * + * @param activity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder activity(@Nullable String activity) { + return setNullable("activity", Conv.STRING, activity); + } + + /** + * The narrative field. + * + * @param narrative the value + * @return this builder + */ + public Builder narrative(RegulatoryReportsCreateParams.Narrative narrative) { + return set("narrative", Conv.model(RegulatoryReportsCreateParams.Narrative::fromJson), narrative); + } + + /** + * The report_indicators field. + * + * @param reportIndicators the value + * @return this builder + */ + public Builder reportIndicators(List reportIndicators) { + return set("report_indicators", Conv.list(Conv.STRING), reportIndicators); + } + + /** + * The included_fields field. + * + * @param includedFields the value + * @return this builder + */ + public Builder includedFields(List includedFields) { + return set("included_fields", Conv.list(Conv.STRING), includedFields); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public RegulatoryReportsCreateParams build() { + require("case", false); + require("template", false); + return new RegulatoryReportsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Required unless a template is given; the template's report_type is used otherwise. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SubmissionCode extends StringEnum { + /** The value {@code "E"}. */ + public static final SubmissionCode E = new SubmissionCode("E"); + + /** The value {@code "M"}. */ + public static final SubmissionCode M = new SubmissionCode("M"); + + private static final List KNOWN_VALUES = List.of(E, M); + + private SubmissionCode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SubmissionCode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SubmissionCode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Narrative extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("who", "what", "when", "where", "why", "how"); + + private Narrative(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Narrative} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Narrative fromJson(JsonNode json) { + return new Narrative(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The who field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional who() { + return Json.optional(json, "who", Conv.STRING); + } + + /** + * The what field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional what() { + return Json.optional(json, "what", Conv.STRING); + } + + /** + * The when field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional when_() { + return Json.optional(json, "when", Conv.STRING); + } + + /** + * The where field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional where() { + return Json.optional(json, "where", Conv.STRING); + } + + /** + * The why field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional why() { + return Json.optional(json, "why", Conv.STRING); + } + + /** + * The how field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional how() { + return Json.optional(json, "how", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Narrative}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Narrative from) { + super(from); + } + + /** + * The who field. + * + * @param who the value + * @return this builder + */ + public Builder who(String who) { + return set("who", Conv.STRING, who); + } + + /** + * The what field. + * + * @param what the value + * @return this builder + */ + public Builder what(String what) { + return set("what", Conv.STRING, what); + } + + /** + * The when field. + * + * @param when_ the value + * @return this builder + */ + public Builder when_(String when_) { + return set("when", Conv.STRING, when_); + } + + /** + * The where field. + * + * @param where the value + * @return this builder + */ + public Builder where(String where) { + return set("where", Conv.STRING, where); + } + + /** + * The why field. + * + * @param why the value + * @return this builder + */ + public Builder why(String why) { + return set("why", Conv.STRING, why); + } + + /** + * The how field. + * + * @param how the value + * @return this builder + */ + public Builder how(String how) { + return set("how", Conv.STRING, how); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Narrative} + */ + public Narrative build() { + return new Narrative(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsListParams.java b/src/main/java/me/didit/types/RegulatoryReportsListParams.java new file mode 100644 index 0000000..1585103 --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsListParams.java @@ -0,0 +1,285 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code regulatory_reports.list}. */ +public final class RegulatoryReportsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset", "status", "report_type", "case"); + + private RegulatoryReportsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsListParams fromJson(JsonNode json) { + return new RegulatoryReportsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + /** + * Filter by status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(RegulatoryReportsListParams.Status::of)); + } + + /** + * Filter by report type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportType() { + return Json.optional(json, "report_type", Conv.enumeration(RegulatoryReportsListParams.ReportType::of)); + } + + /** + * Filter to reports on this case. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional case_() { + return Json.optional(json, "case", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsListParams from) { + super(from); + } + + /** + * Page size. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Filter by status. + * + * @param status the value + * @return this builder + */ + public Builder status(RegulatoryReportsListParams.Status status) { + return set("status", Conv.enumeration(RegulatoryReportsListParams.Status::of), status); + } + + /** + * Filter by report type. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(RegulatoryReportsListParams.ReportType reportType) { + return set("report_type", Conv.enumeration(RegulatoryReportsListParams.ReportType::of), reportType); + } + + /** + * Filter to reports on this case. + * + * @param case_ the value + * @return this builder + */ + public Builder case_(String case_) { + return set("case", Conv.STRING, case_); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsListParams} + */ + public RegulatoryReportsListParams build() { + return new RegulatoryReportsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "DRAFT"}. */ + public static final Status DRAFT = new Status("DRAFT"); + + /** The value {@code "VALIDATED"}. */ + public static final Status VALIDATED = new Status("VALIDATED"); + + /** The value {@code "FINALIZED"}. */ + public static final Status FINALIZED = new Status("FINALIZED"); + + private static final List KNOWN_VALUES = List.of(DRAFT, VALIDATED, FINALIZED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsListResponse.java b/src/main/java/me/didit/types/RegulatoryReportsListResponse.java new file mode 100644 index 0000000..5322532 --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RegulatoryReportsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private RegulatoryReportsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsListResponse fromJson(JsonNode json) { + return new RegulatoryReportsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(RegulatoryReportDetail::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsListResponse from) { + super(from); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(RegulatoryReportDetail::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsListResponse} + */ + public RegulatoryReportsListResponse build() { + return new RegulatoryReportsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsRetrieveDownloadUrlParams.java b/src/main/java/me/didit/types/RegulatoryReportsRetrieveDownloadUrlParams.java new file mode 100644 index 0000000..7daf0d9 --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsRetrieveDownloadUrlParams.java @@ -0,0 +1,142 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code regulatory_reports.retrieve_download_url}. */ +public final class RegulatoryReportsRetrieveDownloadUrlParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("file"); + + private RegulatoryReportsRetrieveDownloadUrlParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsRetrieveDownloadUrlParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsRetrieveDownloadUrlParams fromJson(JsonNode json) { + return new RegulatoryReportsRetrieveDownloadUrlParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Which file to download. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional file() { + return Json.optional(json, "file", Conv.enumeration(RegulatoryReportsRetrieveDownloadUrlParams.File::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsRetrieveDownloadUrlParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsRetrieveDownloadUrlParams from) { + super(from); + } + + /** + * Which file to download. + * + * @param file the value + * @return this builder + */ + public Builder file(RegulatoryReportsRetrieveDownloadUrlParams.File file) { + return set("file", Conv.enumeration(RegulatoryReportsRetrieveDownloadUrlParams.File::of), file); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsRetrieveDownloadUrlParams} + */ + public RegulatoryReportsRetrieveDownloadUrlParams build() { + return new RegulatoryReportsRetrieveDownloadUrlParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class File extends StringEnum { + /** The value {@code "pdf"}. */ + public static final File PDF = new File("pdf"); + + /** The value {@code "xml"}. */ + public static final File XML = new File("xml"); + + private static final List KNOWN_VALUES = List.of(PDF, XML); + + private File(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static File of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, File::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsRetrieveDownloadUrlResponse.java b/src/main/java/me/didit/types/RegulatoryReportsRetrieveDownloadUrlResponse.java new file mode 100644 index 0000000..3f831dc --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsRetrieveDownloadUrlResponse.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class RegulatoryReportsRetrieveDownloadUrlResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("download_url", "file"); + + private RegulatoryReportsRetrieveDownloadUrlResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsRetrieveDownloadUrlResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsRetrieveDownloadUrlResponse fromJson(JsonNode json) { + return new RegulatoryReportsRetrieveDownloadUrlResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The download_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional downloadUrl() { + return Json.optional(json, "download_url", Conv.STRING); + } + + /** + * The file field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional file() { + return Json.optional(json, "file", Conv.enumeration(RegulatoryReportsRetrieveDownloadUrlResponse.File::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsRetrieveDownloadUrlResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsRetrieveDownloadUrlResponse from) { + super(from); + } + + /** + * The download_url field. + * + * @param downloadUrl the value + * @return this builder + */ + public Builder downloadUrl(String downloadUrl) { + return set("download_url", Conv.STRING, downloadUrl); + } + + /** + * The file field. + * + * @param file the value + * @return this builder + */ + public Builder file(RegulatoryReportsRetrieveDownloadUrlResponse.File file) { + return set("file", Conv.enumeration(RegulatoryReportsRetrieveDownloadUrlResponse.File::of), file); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsRetrieveDownloadUrlResponse} + */ + public RegulatoryReportsRetrieveDownloadUrlResponse build() { + return new RegulatoryReportsRetrieveDownloadUrlResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class File extends StringEnum { + /** The value {@code "pdf"}. */ + public static final File PDF = new File("pdf"); + + /** The value {@code "xml"}. */ + public static final File XML = new File("xml"); + + private static final List KNOWN_VALUES = List.of(PDF, XML); + + private File(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static File of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, File::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsUpdateParams.java b/src/main/java/me/didit/types/RegulatoryReportsUpdateParams.java new file mode 100644 index 0000000..74be0df --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsUpdateParams.java @@ -0,0 +1,629 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code regulatory_reports.update}. */ +public final class RegulatoryReportsUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("jurisdiction", "rentity_id", "rentity_branch", "submission_code", "entity_reference", "fiu_ref_number", "currency_code_local", "submission_date", "reporting_person", "location", "reason", "action", "activity", "narrative", "report_indicators", "included_fields"); + + private RegulatoryReportsUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsUpdateParams fromJson(JsonNode json) { + return new RegulatoryReportsUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The jurisdiction field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * The rentity_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityId() { + return Json.optional(json, "rentity_id", Conv.STRING); + } + + /** + * The rentity_branch field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rentityBranch() { + return Json.optional(json, "rentity_branch", Conv.STRING); + } + + /** + * The submission_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionCode() { + return Json.optional(json, "submission_code", Conv.enumeration(RegulatoryReportsUpdateParams.SubmissionCode::of)); + } + + /** + * The entity_reference field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityReference() { + return Json.optional(json, "entity_reference", Conv.STRING); + } + + /** + * The fiu_ref_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fiuRefNumber() { + return Json.optional(json, "fiu_ref_number", Conv.STRING); + } + + /** + * The currency_code_local field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currencyCodeLocal() { + return Json.optional(json, "currency_code_local", Conv.STRING); + } + + /** + * The submission_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submissionDate() { + return Json.optional(json, "submission_date", Conv.DATE_TIME); + } + + /** + * The reporting_person field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportingPerson() { + return Json.optional(json, "reporting_person", Conv.OBJECT); + } + + /** + * The location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> location() { + return Json.optional(json, "location", Conv.OBJECT); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The action field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.STRING); + } + + /** + * The activity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activity() { + return Json.optional(json, "activity", Conv.STRING); + } + + /** + * The narrative field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional narrative() { + return Json.optional(json, "narrative", Conv.model(RegulatoryReportsUpdateParams.Narrative::fromJson)); + } + + /** + * The report_indicators field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reportIndicators() { + return Json.optional(json, "report_indicators", Conv.list(Conv.STRING)); + } + + /** + * The included_fields field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> includedFields() { + return Json.optional(json, "included_fields", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsUpdateParams from) { + super(from); + } + + /** + * The jurisdiction field. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * The rentity_id field. + * + * @param rentityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityId(@Nullable String rentityId) { + return setNullable("rentity_id", Conv.STRING, rentityId); + } + + /** + * The rentity_branch field. + * + * @param rentityBranch the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rentityBranch(@Nullable String rentityBranch) { + return setNullable("rentity_branch", Conv.STRING, rentityBranch); + } + + /** + * The submission_code field. + * + * @param submissionCode the value + * @return this builder + */ + public Builder submissionCode(RegulatoryReportsUpdateParams.SubmissionCode submissionCode) { + return set("submission_code", Conv.enumeration(RegulatoryReportsUpdateParams.SubmissionCode::of), submissionCode); + } + + /** + * The entity_reference field. + * + * @param entityReference the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityReference(@Nullable String entityReference) { + return setNullable("entity_reference", Conv.STRING, entityReference); + } + + /** + * The fiu_ref_number field. + * + * @param fiuRefNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fiuRefNumber(@Nullable String fiuRefNumber) { + return setNullable("fiu_ref_number", Conv.STRING, fiuRefNumber); + } + + /** + * The currency_code_local field. + * + * @param currencyCodeLocal the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currencyCodeLocal(@Nullable String currencyCodeLocal) { + return setNullable("currency_code_local", Conv.STRING, currencyCodeLocal); + } + + /** + * The submission_date field. + * + * @param submissionDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder submissionDate(@Nullable OffsetDateTime submissionDate) { + return setNullable("submission_date", Conv.DATE_TIME, submissionDate); + } + + /** + * The reporting_person field. + * + * @param reportingPerson the value + * @return this builder + */ + public Builder reportingPerson(Map reportingPerson) { + return setAny("reporting_person", reportingPerson); + } + + /** + * The location field. + * + * @param location the value + * @return this builder + */ + public Builder location(Map location) { + return setAny("location", location); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The action field. + * + * @param action the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder action(@Nullable String action) { + return setNullable("action", Conv.STRING, action); + } + + /** + * The activity field. + * + * @param activity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder activity(@Nullable String activity) { + return setNullable("activity", Conv.STRING, activity); + } + + /** + * The narrative field. + * + * @param narrative the value + * @return this builder + */ + public Builder narrative(RegulatoryReportsUpdateParams.Narrative narrative) { + return set("narrative", Conv.model(RegulatoryReportsUpdateParams.Narrative::fromJson), narrative); + } + + /** + * The report_indicators field. + * + * @param reportIndicators the value + * @return this builder + */ + public Builder reportIndicators(List reportIndicators) { + return set("report_indicators", Conv.list(Conv.STRING), reportIndicators); + } + + /** + * The included_fields field. + * + * @param includedFields the value + * @return this builder + */ + public Builder includedFields(List includedFields) { + return set("included_fields", Conv.list(Conv.STRING), includedFields); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsUpdateParams} + */ + public RegulatoryReportsUpdateParams build() { + return new RegulatoryReportsUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SubmissionCode extends StringEnum { + /** The value {@code "E"}. */ + public static final SubmissionCode E = new SubmissionCode("E"); + + /** The value {@code "M"}. */ + public static final SubmissionCode M = new SubmissionCode("M"); + + private static final List KNOWN_VALUES = List.of(E, M); + + private SubmissionCode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SubmissionCode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SubmissionCode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Narrative extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("who", "what", "when", "where", "why", "how"); + + private Narrative(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Narrative} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Narrative fromJson(JsonNode json) { + return new Narrative(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The who field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional who() { + return Json.optional(json, "who", Conv.STRING); + } + + /** + * The what field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional what() { + return Json.optional(json, "what", Conv.STRING); + } + + /** + * The when field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional when_() { + return Json.optional(json, "when", Conv.STRING); + } + + /** + * The where field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional where() { + return Json.optional(json, "where", Conv.STRING); + } + + /** + * The why field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional why() { + return Json.optional(json, "why", Conv.STRING); + } + + /** + * The how field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional how() { + return Json.optional(json, "how", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Narrative}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Narrative from) { + super(from); + } + + /** + * The who field. + * + * @param who the value + * @return this builder + */ + public Builder who(String who) { + return set("who", Conv.STRING, who); + } + + /** + * The what field. + * + * @param what the value + * @return this builder + */ + public Builder what(String what) { + return set("what", Conv.STRING, what); + } + + /** + * The when field. + * + * @param when_ the value + * @return this builder + */ + public Builder when_(String when_) { + return set("when", Conv.STRING, when_); + } + + /** + * The where field. + * + * @param where the value + * @return this builder + */ + public Builder where(String where) { + return set("where", Conv.STRING, where); + } + + /** + * The why field. + * + * @param why the value + * @return this builder + */ + public Builder why(String why) { + return set("why", Conv.STRING, why); + } + + /** + * The how field. + * + * @param how the value + * @return this builder + */ + public Builder how(String how) { + return set("how", Conv.STRING, how); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Narrative} + */ + public Narrative build() { + return new Narrative(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/RegulatoryReportsValidateResponse.java b/src/main/java/me/didit/types/RegulatoryReportsValidateResponse.java new file mode 100644 index 0000000..b9213bd --- /dev/null +++ b/src/main/java/me/didit/types/RegulatoryReportsValidateResponse.java @@ -0,0 +1,289 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class RegulatoryReportsValidateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "is_valid", "errors"); + + private RegulatoryReportsValidateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegulatoryReportsValidateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegulatoryReportsValidateResponse fromJson(JsonNode json) { + return new RegulatoryReportsValidateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(RegulatoryReportsValidateResponse.Status::of)); + } + + /** + * The is_valid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isValid() { + return Json.optional(json, "is_valid", Conv.BOOLEAN); + } + + /** + * Empty when valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> errors() { + return Json.optional(json, "errors", Conv.list(Conv.model(RegulatoryReportsValidateResponse.Errors::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegulatoryReportsValidateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegulatoryReportsValidateResponse from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(RegulatoryReportsValidateResponse.Status status) { + return set("status", Conv.enumeration(RegulatoryReportsValidateResponse.Status::of), status); + } + + /** + * The is_valid field. + * + * @param isValid the value + * @return this builder + */ + public Builder isValid(boolean isValid) { + return set("is_valid", Conv.BOOLEAN, isValid); + } + + /** + * Empty when valid. + * + * @param errors the value + * @return this builder + */ + public Builder errors(List errors) { + return set("errors", Conv.list(Conv.model(RegulatoryReportsValidateResponse.Errors::fromJson)), errors); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegulatoryReportsValidateResponse} + */ + public RegulatoryReportsValidateResponse build() { + return new RegulatoryReportsValidateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "DRAFT"}. */ + public static final Status DRAFT = new Status("DRAFT"); + + /** The value {@code "VALIDATED"}. */ + public static final Status VALIDATED = new Status("VALIDATED"); + + /** The value {@code "FINALIZED"}. */ + public static final Status FINALIZED = new Status("FINALIZED"); + + private static final List KNOWN_VALUES = List.of(DRAFT, VALIDATED, FINALIZED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Errors extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("field", "message"); + + private Errors(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Errors} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Errors fromJson(JsonNode json) { + return new Errors(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The field field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional field() { + return Json.optional(json, "field", Conv.STRING); + } + + /** + * The message field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional message() { + return Json.optional(json, "message", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Errors}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Errors from) { + super(from); + } + + /** + * The field field. + * + * @param field the value + * @return this builder + */ + public Builder field(String field) { + return set("field", Conv.STRING, field); + } + + /** + * The message field. + * + * @param message the value + * @return this builder + */ + public Builder message(String message) { + return set("message", Conv.STRING, message); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Errors} + */ + public Errors build() { + return new Errors(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/ReportTemplateDetail.java b/src/main/java/me/didit/types/ReportTemplateDetail.java new file mode 100644 index 0000000..906a873 --- /dev/null +++ b/src/main/java/me/didit/types/ReportTemplateDetail.java @@ -0,0 +1,300 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class ReportTemplateDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "jurisdiction", "report_type", "report_type_display", "field_config", "created_at", "updated_at"); + + private ReportTemplateDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReportTemplateDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReportTemplateDetail fromJson(JsonNode json) { + return new ReportTemplateDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * The report_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportType() { + return Json.optional(json, "report_type", Conv.enumeration(ReportTemplateDetail.ReportType::of)); + } + + /** + * The report_type_display field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportTypeDisplay() { + return Json.optional(json, "report_type_display", Conv.STRING); + } + + /** + * Reusable goAML header defaults. Template-level obligatory fields: rentity_id, submission_code, and currency_code_local (3-letter). Optional: enabled_fields (which optional report blocks to include) plus reporting_person, location, reason, and action defaults. Per-filing header fields (action, submission_date, transactions, jurisdiction) are enforced when the report is validated or finalized, not on the template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> fieldConfig() { + return Json.optional(json, "field_config", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReportTemplateDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReportTemplateDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * ISO 3166-1 alpha-2 country code. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * The report_type field. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(ReportTemplateDetail.ReportType reportType) { + return set("report_type", Conv.enumeration(ReportTemplateDetail.ReportType::of), reportType); + } + + /** + * The report_type_display field. + * + * @param reportTypeDisplay the value + * @return this builder + */ + public Builder reportTypeDisplay(String reportTypeDisplay) { + return set("report_type_display", Conv.STRING, reportTypeDisplay); + } + + /** + * Reusable goAML header defaults. Template-level obligatory fields: rentity_id, submission_code, and currency_code_local (3-letter). Optional: enabled_fields (which optional report blocks to include) plus reporting_person, location, reason, and action defaults. Per-filing header fields (action, submission_date, transactions, jurisdiction) are enforced when the report is validated or finalized, not on the template. + * + * @param fieldConfig the value + * @return this builder + */ + public Builder fieldConfig(Map fieldConfig) { + return setAny("field_config", fieldConfig); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReportTemplateDetail} + */ + public ReportTemplateDetail build() { + return new ReportTemplateDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/ReportTemplatesCreateParams.java b/src/main/java/me/didit/types/ReportTemplatesCreateParams.java new file mode 100644 index 0000000..0705417 --- /dev/null +++ b/src/main/java/me/didit/types/ReportTemplatesCreateParams.java @@ -0,0 +1,224 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code report_templates.create}. */ +public final class ReportTemplatesCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "jurisdiction", "report_type", "field_config"); + + private ReportTemplatesCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReportTemplatesCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReportTemplatesCreateParams fromJson(JsonNode json) { + return new ReportTemplatesCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code, upper-cased on save. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String jurisdiction() { + return Json.required(json, "jurisdiction", Conv.STRING); + } + + /** + * The report_type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public ReportTemplatesCreateParams.ReportType reportType() { + return Json.required(json, "report_type", Conv.enumeration(ReportTemplatesCreateParams.ReportType::of)); + } + + /** + * Reusable goAML header defaults. Template-level obligatory fields: rentity_id, submission_code, and currency_code_local (3-letter). Optional: enabled_fields (which optional report blocks to include) plus reporting_person, location, reason, and action defaults. Per-filing header fields (action, submission_date, transactions, jurisdiction) are enforced when the report is validated or finalized, not on the template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> fieldConfig() { + return Json.optional(json, "field_config", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReportTemplatesCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReportTemplatesCreateParams from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * ISO 3166-1 alpha-2 country code, upper-cased on save. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * The report_type field. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(ReportTemplatesCreateParams.ReportType reportType) { + return set("report_type", Conv.enumeration(ReportTemplatesCreateParams.ReportType::of), reportType); + } + + /** + * Reusable goAML header defaults. Template-level obligatory fields: rentity_id, submission_code, and currency_code_local (3-letter). Optional: enabled_fields (which optional report blocks to include) plus reporting_person, location, reason, and action defaults. Per-filing header fields (action, submission_date, transactions, jurisdiction) are enforced when the report is validated or finalized, not on the template. + * + * @param fieldConfig the value + * @return this builder + */ + public Builder fieldConfig(Map fieldConfig) { + return setAny("field_config", fieldConfig); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReportTemplatesCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public ReportTemplatesCreateParams build() { + require("name", false); + require("jurisdiction", false); + require("report_type", false); + return new ReportTemplatesCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/ReportTemplatesListParams.java b/src/main/java/me/didit/types/ReportTemplatesListParams.java new file mode 100644 index 0000000..80354a0 --- /dev/null +++ b/src/main/java/me/didit/types/ReportTemplatesListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code report_templates.list}. */ +public final class ReportTemplatesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private ReportTemplatesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReportTemplatesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReportTemplatesListParams fromJson(JsonNode json) { + return new ReportTemplatesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReportTemplatesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReportTemplatesListParams from) { + super(from); + } + + /** + * Page size. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReportTemplatesListParams} + */ + public ReportTemplatesListParams build() { + return new ReportTemplatesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/ReportTemplatesListResponse.java b/src/main/java/me/didit/types/ReportTemplatesListResponse.java new file mode 100644 index 0000000..b0e3ff5 --- /dev/null +++ b/src/main/java/me/didit/types/ReportTemplatesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class ReportTemplatesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private ReportTemplatesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReportTemplatesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReportTemplatesListResponse fromJson(JsonNode json) { + return new ReportTemplatesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(ReportTemplateDetail::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReportTemplatesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReportTemplatesListResponse from) { + super(from); + } + + /** + * Number of matching rows, capped at 100 for performance. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(ReportTemplateDetail::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReportTemplatesListResponse} + */ + public ReportTemplatesListResponse build() { + return new ReportTemplatesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/ReportTemplatesUpdateParams.java b/src/main/java/me/didit/types/ReportTemplatesUpdateParams.java new file mode 100644 index 0000000..6e8874b --- /dev/null +++ b/src/main/java/me/didit/types/ReportTemplatesUpdateParams.java @@ -0,0 +1,220 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code report_templates.update}. */ +public final class ReportTemplatesUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "jurisdiction", "report_type", "field_config"); + + private ReportTemplatesUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReportTemplatesUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReportTemplatesUpdateParams fromJson(JsonNode json) { + return new ReportTemplatesUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code, upper-cased on save. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * The report_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reportType() { + return Json.optional(json, "report_type", Conv.enumeration(ReportTemplatesUpdateParams.ReportType::of)); + } + + /** + * Reusable goAML header defaults. Template-level obligatory fields: rentity_id, submission_code, and currency_code_local (3-letter). Optional: enabled_fields (which optional report blocks to include) plus reporting_person, location, reason, and action defaults. Per-filing header fields (action, submission_date, transactions, jurisdiction) are enforced when the report is validated or finalized, not on the template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> fieldConfig() { + return Json.optional(json, "field_config", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReportTemplatesUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReportTemplatesUpdateParams from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * ISO 3166-1 alpha-2 country code, upper-cased on save. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * The report_type field. + * + * @param reportType the value + * @return this builder + */ + public Builder reportType(ReportTemplatesUpdateParams.ReportType reportType) { + return set("report_type", Conv.enumeration(ReportTemplatesUpdateParams.ReportType::of), reportType); + } + + /** + * Reusable goAML header defaults. Template-level obligatory fields: rentity_id, submission_code, and currency_code_local (3-letter). Optional: enabled_fields (which optional report blocks to include) plus reporting_person, location, reason, and action defaults. Per-filing header fields (action, submission_date, transactions, jurisdiction) are enforced when the report is validated or finalized, not on the template. + * + * @param fieldConfig the value + * @return this builder + */ + public Builder fieldConfig(Map fieldConfig) { + return setAny("field_config", fieldConfig); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReportTemplatesUpdateParams} + */ + public ReportTemplatesUpdateParams build() { + return new ReportTemplatesUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReportType extends StringEnum { + /** The value {@code "SAR"}. */ + public static final ReportType SAR = new ReportType("SAR"); + + /** The value {@code "STR"}. */ + public static final ReportType STR = new ReportType("STR"); + + /** The value {@code "CTR"}. */ + public static final ReportType CTR = new ReportType("CTR"); + + /** The value {@code "TTR"}. */ + public static final ReportType TTR = new ReportType("TTR"); + + /** The value {@code "UTR"}. */ + public static final ReportType UTR = new ReportType("UTR"); + + /** The value {@code "IFT"}. */ + public static final ReportType IFT = new ReportType("IFT"); + + /** The value {@code "CBR"}. */ + public static final ReportType CBR = new ReportType("CBR"); + + /** The value {@code "TFR"}. */ + public static final ReportType TFR = new ReportType("TFR"); + + private static final List KNOWN_VALUES = List.of(SAR, STR, CTR, TTR, UTR, IFT, CBR, TFR); + + private ReportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/ReviewItem.java b/src/main/java/me/didit/types/ReviewItem.java new file mode 100644 index 0000000..5a71b2b --- /dev/null +++ b/src/main/java/me/didit/types/ReviewItem.java @@ -0,0 +1,620 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * One entry in a session's review / activity feed. Status changes carry previous_status, new_status, previous_value, new_value, and changed_fields; comments carry comment and (for Console comments) mentioned_emails; the remaining fields are null or empty when they do not apply to the activity type. + */ +public final class ReviewItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "activity_type", "actor_display", "actor_email", "actor_type", "new_status", "previous_status", "comment", "mentioned_emails", "previous_value", "new_value", "changed_fields", "metadata", "created_at"); + + private ReviewItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ReviewItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ReviewItem fromJson(JsonNode json) { + return new ReviewItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier of this feed entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * What kind of activity this entry records. STATUS_UPDATED rows come from manual decisions (PATCH /v3/session/{session_id}/update-status/) and from entries added via POST โ€ฆ/reviews/ (which default to this type even when no status is recorded). COMMENT rows come from Console reviewers; Console detail-page views are also stored as COMMENT rows flagged with metadata.system_event = "DETAIL_VIEWED". The remaining types track data edits, file changes, tags, and AML monitoring activity. STATUS_UPDATED rows are also written by system actors (e.g. AML ongoing monitoring with actor_type SYSTEM, and automatic feature-status updates), not only by the update-status endpoint and manual review posts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activityType() { + return Json.optional(json, "activity_type", Conv.enumeration(ReviewItem.ActivityType::of)); + } + + /** + * Human-readable author label, resolved in order: actor's full name โ†’ Console account identifier โ†’ local part of actor_email โ†’ "API Client" (for API_KEY actors) โ†’ "System" (for SYSTEM actors) โ†’ "Unknown". Entries created via POST โ€ฆ/reviews/ always display "Unknown" because that endpoint records no actor attribution. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorDisplay() { + return Json.optional(json, "actor_display", Conv.STRING); + } + + /** + * Email of the Console user who performed the action. null for API-key and system actors. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * Who performed the action: an API key, a Console user, or Didit itself (SYSTEM, e.g. AML ongoing monitoring). Entries created via POST โ€ฆ/reviews/ carry the default CONSOLE_USER regardless of the caller. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorType() { + return Json.optional(json, "actor_type", Conv.enumeration(ReviewItem.ActorType::of)); + } + + /** + * Session status recorded by this entry (for status updates). null for comments and data-change entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.enumeration(ReviewItem.NewStatus::of)); + } + + /** + * Status the session had before the change. Populated on STATUS_UPDATED entries written by the update-status endpoint; null on entries added via POST โ€ฆ/reviews/. Also populated on system-written STATUS_UPDATED rows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previousStatus() { + return Json.optional(json, "previous_status", Conv.enumeration(ReviewItem.PreviousStatus::of)); + } + + /** + * Free-text note attached to the entry, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * Console users @email-mentioned in the comment. Always empty for entries created via this API โ€” mention processing is a Console-only feature. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> mentionedEmails() { + return Json.optional(json, "mentioned_emails", Conv.list(Conv.STRING)); + } + + /** + * Snapshot of the changed data before the action, e.g. {"status": "In Review"} on a status change. null when nothing was changed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> previousValue() { + return Json.optional(json, "previous_value", Conv.OBJECT); + } + + /** + * Snapshot of the changed data after the action, e.g. {"status": "Approved"}. null when nothing was changed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> newValue() { + return Json.optional(json, "new_value", Conv.OBJECT); + } + + /** + * Names of the fields modified by this activity (e.g. ["status"]). Empty for comments and for entries added via POST โ€ฆ/reviews/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> changedFields() { + return Json.optional(json, "changed_fields", Conv.list(Conv.STRING)); + } + + /** + * Extra context for system-generated entries. Console detail-page views carry {"system_event": "DETAIL_VIEWED", "detail_type": "verification"} so they can be filtered out of notification logic. null for ordinary entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * When the entry was written, ISO 8601 UTC. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ReviewItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ReviewItem from) { + super(from); + } + + /** + * Unique identifier of this feed entry. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * What kind of activity this entry records. STATUS_UPDATED rows come from manual decisions (PATCH /v3/session/{session_id}/update-status/) and from entries added via POST โ€ฆ/reviews/ (which default to this type even when no status is recorded). COMMENT rows come from Console reviewers; Console detail-page views are also stored as COMMENT rows flagged with metadata.system_event = "DETAIL_VIEWED". The remaining types track data edits, file changes, tags, and AML monitoring activity. STATUS_UPDATED rows are also written by system actors (e.g. AML ongoing monitoring with actor_type SYSTEM, and automatic feature-status updates), not only by the update-status endpoint and manual review posts. + * + * @param activityType the value + * @return this builder + */ + public Builder activityType(ReviewItem.ActivityType activityType) { + return set("activity_type", Conv.enumeration(ReviewItem.ActivityType::of), activityType); + } + + /** + * Human-readable author label, resolved in order: actor's full name โ†’ Console account identifier โ†’ local part of actor_email โ†’ "API Client" (for API_KEY actors) โ†’ "System" (for SYSTEM actors) โ†’ "Unknown". Entries created via POST โ€ฆ/reviews/ always display "Unknown" because that endpoint records no actor attribution. + * + * @param actorDisplay the value + * @return this builder + */ + public Builder actorDisplay(String actorDisplay) { + return set("actor_display", Conv.STRING, actorDisplay); + } + + /** + * Email of the Console user who performed the action. null for API-key and system actors. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * Who performed the action: an API key, a Console user, or Didit itself (SYSTEM, e.g. AML ongoing monitoring). Entries created via POST โ€ฆ/reviews/ carry the default CONSOLE_USER regardless of the caller. + * + * @param actorType the value + * @return this builder + */ + public Builder actorType(ReviewItem.ActorType actorType) { + return set("actor_type", Conv.enumeration(ReviewItem.ActorType::of), actorType); + } + + /** + * Session status recorded by this entry (for status updates). null for comments and data-change entries. + * + * @param newStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newStatus(ReviewItem.@Nullable NewStatus newStatus) { + return setNullable("new_status", Conv.enumeration(ReviewItem.NewStatus::of), newStatus); + } + + /** + * Status the session had before the change. Populated on STATUS_UPDATED entries written by the update-status endpoint; null on entries added via POST โ€ฆ/reviews/. Also populated on system-written STATUS_UPDATED rows. + * + * @param previousStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previousStatus(ReviewItem.@Nullable PreviousStatus previousStatus) { + return setNullable("previous_status", Conv.enumeration(ReviewItem.PreviousStatus::of), previousStatus); + } + + /** + * Free-text note attached to the entry, or null. + * + * @param comment the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder comment(@Nullable String comment) { + return setNullable("comment", Conv.STRING, comment); + } + + /** + * Console users @email-mentioned in the comment. Always empty for entries created via this API โ€” mention processing is a Console-only feature. + * + * @param mentionedEmails the value + * @return this builder + */ + public Builder mentionedEmails(List mentionedEmails) { + return set("mentioned_emails", Conv.list(Conv.STRING), mentionedEmails); + } + + /** + * Snapshot of the changed data before the action, e.g. {"status": "In Review"} on a status change. null when nothing was changed. + * + * @param previousValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previousValue(@Nullable Map previousValue) { + return setAny("previous_value", previousValue); + } + + /** + * Snapshot of the changed data after the action, e.g. {"status": "Approved"}. null when nothing was changed. + * + * @param newValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newValue(@Nullable Map newValue) { + return setAny("new_value", newValue); + } + + /** + * Names of the fields modified by this activity (e.g. ["status"]). Empty for comments and for entries added via POST โ€ฆ/reviews/. + * + * @param changedFields the value + * @return this builder + */ + public Builder changedFields(List changedFields) { + return set("changed_fields", Conv.list(Conv.STRING), changedFields); + } + + /** + * Extra context for system-generated entries. Console detail-page views carry {"system_event": "DETAIL_VIEWED", "detail_type": "verification"} so they can be filtered out of notification logic. null for ordinary entries. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * When the entry was written, ISO 8601 UTC. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ReviewItem} + */ + public ReviewItem build() { + return new ReviewItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What kind of activity this entry records. STATUS_UPDATED rows come from manual decisions (PATCH /v3/session/{session_id}/update-status/) and from entries added via POST โ€ฆ/reviews/ (which default to this type even when no status is recorded). COMMENT rows come from Console reviewers; Console detail-page views are also stored as COMMENT rows flagged with metadata.system_event = "DETAIL_VIEWED". The remaining types track data edits, file changes, tags, and AML monitoring activity. STATUS_UPDATED rows are also written by system actors (e.g. AML ongoing monitoring with actor_type SYSTEM, and automatic feature-status updates), not only by the update-status endpoint and manual review posts. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ActivityType extends StringEnum { + /** The value {@code "COMMENT"}. */ + public static final ActivityType COMMENT = new ActivityType("COMMENT"); + + /** The value {@code "STATUS_UPDATED"}. */ + public static final ActivityType STATUS_UPDATED = new ActivityType("STATUS_UPDATED"); + + /** The value {@code "KYC_DATA_UPDATED"}. */ + public static final ActivityType KYC_DATA_UPDATED = new ActivityType("KYC_DATA_UPDATED"); + + /** The value {@code "POA_DATA_UPDATED"}. */ + public static final ActivityType POA_DATA_UPDATED = new ActivityType("POA_DATA_UPDATED"); + + /** The value {@code "FILE_ADDED"}. */ + public static final ActivityType FILE_ADDED = new ActivityType("FILE_ADDED"); + + /** The value {@code "FILE_REMOVED"}. */ + public static final ActivityType FILE_REMOVED = new ActivityType("FILE_REMOVED"); + + /** The value {@code "AML_ONGOING_MATCH"}. */ + public static final ActivityType AML_ONGOING_MATCH = new ActivityType("AML_ONGOING_MATCH"); + + /** The value {@code "AML_STATUS_UPDATED"}. */ + public static final ActivityType AML_STATUS_UPDATED = new ActivityType("AML_STATUS_UPDATED"); + + /** The value {@code "AML_HIT_STATUS_UPDATED"}. */ + public static final ActivityType AML_HIT_STATUS_UPDATED = new ActivityType("AML_HIT_STATUS_UPDATED"); + + /** The value {@code "KYB_DATA_UPDATED"}. */ + public static final ActivityType KYB_DATA_UPDATED = new ActivityType("KYB_DATA_UPDATED"); + + /** The value {@code "KYB_DOCUMENT_UPLOADED"}. */ + public static final ActivityType KYB_DOCUMENT_UPLOADED = new ActivityType("KYB_DOCUMENT_UPLOADED"); + + /** The value {@code "TAG_ADDED"}. */ + public static final ActivityType TAG_ADDED = new ActivityType("TAG_ADDED"); + + /** The value {@code "TAG_REMOVED"}. */ + public static final ActivityType TAG_REMOVED = new ActivityType("TAG_REMOVED"); + + private static final List KNOWN_VALUES = List.of(COMMENT, STATUS_UPDATED, KYC_DATA_UPDATED, POA_DATA_UPDATED, FILE_ADDED, FILE_REMOVED, AML_ONGOING_MATCH, AML_STATUS_UPDATED, AML_HIT_STATUS_UPDATED, KYB_DATA_UPDATED, KYB_DOCUMENT_UPLOADED, TAG_ADDED, TAG_REMOVED); + + private ActivityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ActivityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ActivityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Who performed the action: an API key, a Console user, or Didit itself (SYSTEM, e.g. AML ongoing monitoring). Entries created via POST โ€ฆ/reviews/ carry the default CONSOLE_USER regardless of the caller. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ActorType extends StringEnum { + /** The value {@code "API_KEY"}. */ + public static final ActorType API_KEY = new ActorType("API_KEY"); + + /** The value {@code "CONSOLE_USER"}. */ + public static final ActorType CONSOLE_USER = new ActorType("CONSOLE_USER"); + + /** The value {@code "SYSTEM"}. */ + public static final ActorType SYSTEM = new ActorType("SYSTEM"); + + private static final List KNOWN_VALUES = List.of(API_KEY, CONSOLE_USER, SYSTEM); + + private ActorType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ActorType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ActorType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Session status recorded by this entry (for status updates). null for comments and data-change entries. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final NewStatus NOT_STARTED = new NewStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final NewStatus IN_PROGRESS = new NewStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final NewStatus APPROVED = new NewStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final NewStatus DECLINED = new NewStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final NewStatus IN_REVIEW = new NewStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final NewStatus EXPIRED = new NewStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final NewStatus ABANDONED = new NewStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final NewStatus KYC_EXPIRED = new NewStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final NewStatus RESUBMITTED = new NewStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final NewStatus AWAITING_USER = new NewStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status the session had before the change. Populated on STATUS_UPDATED entries written by the update-status endpoint; null on entries added via POST โ€ฆ/reviews/. Also populated on system-written STATUS_UPDATED rows. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PreviousStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final PreviousStatus NOT_STARTED = new PreviousStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final PreviousStatus IN_PROGRESS = new PreviousStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final PreviousStatus APPROVED = new PreviousStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final PreviousStatus DECLINED = new PreviousStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final PreviousStatus IN_REVIEW = new PreviousStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final PreviousStatus EXPIRED = new PreviousStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final PreviousStatus ABANDONED = new PreviousStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final PreviousStatus KYC_EXPIRED = new PreviousStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final PreviousStatus RESUBMITTED = new PreviousStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final PreviousStatus AWAITING_USER = new PreviousStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private PreviousStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PreviousStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PreviousStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/RiskLifecycleEvent.java b/src/main/java/me/didit/types/RiskLifecycleEvent.java new file mode 100644 index 0000000..dd4c632 --- /dev/null +++ b/src/main/java/me/didit/types/RiskLifecycleEvent.java @@ -0,0 +1,165 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RiskLifecycleEvent extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "timestamp", "details", "fee"); + + private RiskLifecycleEvent(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RiskLifecycleEvent} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RiskLifecycleEvent fromJson(JsonNode json) { + return new RiskLifecycleEvent(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Machine-readable event type. New values can be added over time. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String type() { + return Json.required(json, "type", Conv.STRING); + } + + /** + * When the event happened. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime timestamp() { + return Json.required(json, "timestamp", Conv.DATE_TIME); + } + + /** + * Event-specific payload, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.OBJECT); + } + + /** + * USD amount billed for this event. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double fee() { + return Json.required(json, "fee", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RiskLifecycleEvent}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RiskLifecycleEvent from) { + super(from); + } + + /** + * Machine-readable event type. New values can be added over time. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * When the event happened. + * + * @param timestamp the value + * @return this builder + */ + public Builder timestamp(OffsetDateTime timestamp) { + return set("timestamp", Conv.DATE_TIME, timestamp); + } + + /** + * Event-specific payload, or null. + * + * @param details the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder details(@Nullable Map details) { + return setAny("details", details); + } + + /** + * USD amount billed for this event. + * + * @param fee the value + * @return this builder + */ + public Builder fee(double fee) { + return set("fee", Conv.DOUBLE, fee); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RiskLifecycleEvent} + * @throws IllegalStateException when a required field is missing + */ + public RiskLifecycleEvent build() { + require("type", false); + require("timestamp", false); + require("details", true); + require("fee", false); + return new RiskLifecycleEvent(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RiskSignals.java b/src/main/java/me/didit/types/RiskSignals.java new file mode 100644 index 0000000..faed998 --- /dev/null +++ b/src/main/java/me/didit/types/RiskSignals.java @@ -0,0 +1,274 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** + * Optional device and network context observed by your application. All fields are optional. Passing them feeds cross-session match detection in Networks. + */ +public final class RiskSignals extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip", "device_id", "device_platform", "device_model", "os_version", "app_version", "user_agent"); + + private RiskSignals(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RiskSignals} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RiskSignals fromJson(JsonNode json) { + return new RiskSignals(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * IPv4 or IPv6 address observed for the end user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ip() { + return Json.optional(json, "ip", Conv.STRING); + } + + /** + * Stable device identifier collected by your application (Android ANDROID_ID, iOS identifierForVendor). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceId() { + return Json.optional(json, "device_id", Conv.STRING); + } + + /** + * Platform of the end user's device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional devicePlatform() { + return Json.optional(json, "device_platform", Conv.enumeration(RiskSignals.DevicePlatform::of)); + } + + /** + * Device model reported by your application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceModel() { + return Json.optional(json, "device_model", Conv.STRING); + } + + /** + * Operating-system version. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osVersion() { + return Json.optional(json, "os_version", Conv.STRING); + } + + /** + * Version of your application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appVersion() { + return Json.optional(json, "app_version", Conv.STRING); + } + + /** + * Browser or app user agent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RiskSignals}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RiskSignals from) { + super(from); + } + + /** + * IPv4 or IPv6 address observed for the end user. + * + * @param ip the value + * @return this builder + */ + public Builder ip(String ip) { + return set("ip", Conv.STRING, ip); + } + + /** + * Stable device identifier collected by your application (Android ANDROID_ID, iOS identifierForVendor). + * + * @param deviceId the value + * @return this builder + */ + public Builder deviceId(String deviceId) { + return set("device_id", Conv.STRING, deviceId); + } + + /** + * Platform of the end user's device. + * + * @param devicePlatform the value + * @return this builder + */ + public Builder devicePlatform(RiskSignals.DevicePlatform devicePlatform) { + return set("device_platform", Conv.enumeration(RiskSignals.DevicePlatform::of), devicePlatform); + } + + /** + * Device model reported by your application. + * + * @param deviceModel the value + * @return this builder + */ + public Builder deviceModel(String deviceModel) { + return set("device_model", Conv.STRING, deviceModel); + } + + /** + * Operating-system version. + * + * @param osVersion the value + * @return this builder + */ + public Builder osVersion(String osVersion) { + return set("os_version", Conv.STRING, osVersion); + } + + /** + * Version of your application. + * + * @param appVersion the value + * @return this builder + */ + public Builder appVersion(String appVersion) { + return set("app_version", Conv.STRING, appVersion); + } + + /** + * Browser or app user agent. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RiskSignals} + */ + public RiskSignals build() { + return new RiskSignals(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Platform of the end user's device. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DevicePlatform extends StringEnum { + /** The value {@code "android"}. */ + public static final DevicePlatform ANDROID = new DevicePlatform("android"); + + /** The value {@code "ios"}. */ + public static final DevicePlatform IOS = new DevicePlatform("ios"); + + /** The value {@code "ipados"}. */ + public static final DevicePlatform IPADOS = new DevicePlatform("ipados"); + + /** The value {@code "tvos"}. */ + public static final DevicePlatform TVOS = new DevicePlatform("tvos"); + + /** The value {@code "web"}. */ + public static final DevicePlatform WEB = new DevicePlatform("web"); + + private static final List KNOWN_VALUES = List.of(ANDROID, IOS, IPADOS, TVOS, WEB); + + private DevicePlatform(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DevicePlatform of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DevicePlatform::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/RiskWarning.java b/src/main/java/me/didit/types/RiskWarning.java new file mode 100644 index 0000000..2b3fd6b --- /dev/null +++ b/src/main/java/me/didit/types/RiskWarning.java @@ -0,0 +1,252 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class RiskWarning extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description"); + + private RiskWarning(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RiskWarning} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RiskWarning fromJson(JsonNode json) { + return new RiskWarning(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature that produced the warning. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String feature() { + return Json.required(json, "feature", Conv.STRING); + } + + /** + * Machine-readable risk code. New values can be added over time. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String risk() { + return Json.required(json, "risk", Conv.STRING); + } + + /** + * Risk-specific context, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Severity used by the decision rules. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public RiskWarning.LogType logType() { + return Json.required(json, "log_type", Conv.enumeration(RiskWarning.LogType::of)); + } + + /** + * Human-readable one-line summary. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String shortDescription() { + return Json.required(json, "short_description", Conv.STRING); + } + + /** + * Human-readable explanation. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String longDescription() { + return Json.required(json, "long_description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RiskWarning}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RiskWarning from) { + super(from); + } + + /** + * Feature that produced the warning. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Machine-readable risk code. New values can be added over time. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Risk-specific context, or null. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Severity used by the decision rules. + * + * @param logType the value + * @return this builder + */ + public Builder logType(RiskWarning.LogType logType) { + return set("log_type", Conv.enumeration(RiskWarning.LogType::of), logType); + } + + /** + * Human-readable one-line summary. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * Human-readable explanation. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RiskWarning} + * @throws IllegalStateException when a required field is missing + */ + public RiskWarning build() { + require("feature", false); + require("risk", false); + require("log_type", false); + require("short_description", false); + require("long_description", false); + return new RiskWarning(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Severity used by the decision rules. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LogType extends StringEnum { + /** The value {@code "error"}. */ + public static final LogType ERROR = new LogType("error"); + + /** The value {@code "warning"}. */ + public static final LogType WARNING = new LogType("warning"); + + /** The value {@code "information"}. */ + public static final LogType INFORMATION = new LogType("information"); + + private static final List KNOWN_VALUES = List.of(ERROR, WARNING, INFORMATION); + + private LogType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LogType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LogType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationCaseRoutingRule.java b/src/main/java/me/didit/types/RoutingPublicationCaseRoutingRule.java new file mode 100644 index 0000000..2b841e0 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationCaseRoutingRule.java @@ -0,0 +1,370 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationCaseRoutingRule extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "description", "priority", "conditions", "required_skills", "blueprint", "blueprint_name", "team", "team_name", "is_active", "version", "created_at", "updated_at"); + + private RoutingPublicationCaseRoutingRule(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationCaseRoutingRule} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationCaseRoutingRule fromJson(JsonNode json) { + return new RoutingPublicationCaseRoutingRule(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String name() { + return Json.required(json, "name", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The priority field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional priority() { + return Json.optional(json, "priority", Conv.LONG); + } + + /** + * The conditions field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List conditions() { + return Json.required(json, "conditions", Conv.list(Conv.model(RoutingPublicationRoutingCondition::fromJson))); + } + + /** + * The required_skills field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> requiredSkills() { + return Json.optional(json, "required_skills", Conv.list(Conv.STRING)); + } + + /** + * The blueprint field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String blueprint() { + return Json.required(json, "blueprint", Conv.STRING); + } + + /** + * The blueprint_name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String blueprintName() { + return Json.required(json, "blueprint_name", Conv.STRING); + } + + /** + * The team field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional team() { + return Json.optional(json, "team", Conv.STRING); + } + + /** + * The team_name field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String teamName() { + return Json.required(json, "team_name", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long version() { + return Json.required(json, "version", Conv.LONG); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime updatedAt() { + return Json.required(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationCaseRoutingRule}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationCaseRoutingRule from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The priority field. + * + * @param priority the value + * @return this builder + */ + public Builder priority(long priority) { + return set("priority", Conv.LONG, priority); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(RoutingPublicationRoutingCondition::fromJson)), conditions); + } + + /** + * The required_skills field. + * + * @param requiredSkills the value + * @return this builder + */ + public Builder requiredSkills(List requiredSkills) { + return set("required_skills", Conv.list(Conv.STRING), requiredSkills); + } + + /** + * The blueprint field. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * The blueprint_name field. + * + * @param blueprintName the value + * @return this builder + */ + public Builder blueprintName(String blueprintName) { + return set("blueprint_name", Conv.STRING, blueprintName); + } + + /** + * The team field. + * + * @param team the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder team(@Nullable String team) { + return setNullable("team", Conv.STRING, team); + } + + /** + * The team_name field. + * + * @param teamName the value + * @return this builder + */ + public Builder teamName(String teamName) { + return set("team_name", Conv.STRING, teamName); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationCaseRoutingRule} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationCaseRoutingRule build() { + require("uuid", false); + require("name", false); + require("conditions", false); + require("blueprint", false); + require("blueprint_name", false); + require("team_name", false); + require("version", false); + require("created_at", false); + require("updated_at", false); + return new RoutingPublicationCaseRoutingRule(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationFieldEnum.java b/src/main/java/me/didit/types/RoutingPublicationFieldEnum.java new file mode 100644 index 0000000..f5d1f01 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationFieldEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - source - source + * - priority - priority + * - tags - tags + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class RoutingPublicationFieldEnum extends StringEnum { + /** The value {@code "source"}. */ + public static final RoutingPublicationFieldEnum SOURCE = new RoutingPublicationFieldEnum("source"); + + /** The value {@code "priority"}. */ + public static final RoutingPublicationFieldEnum PRIORITY = new RoutingPublicationFieldEnum("priority"); + + /** The value {@code "tags"}. */ + public static final RoutingPublicationFieldEnum TAGS = new RoutingPublicationFieldEnum("tags"); + + private static final List KNOWN_VALUES = List.of(SOURCE, PRIORITY, TAGS); + + private RoutingPublicationFieldEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RoutingPublicationFieldEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RoutingPublicationFieldEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationOperatorEnum.java b/src/main/java/me/didit/types/RoutingPublicationOperatorEnum.java new file mode 100644 index 0000000..f42ef0a --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationOperatorEnum.java @@ -0,0 +1,53 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * - equals - equals + * - in - in + * - contains - contains + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class RoutingPublicationOperatorEnum extends StringEnum { + /** The value {@code "equals"}. */ + public static final RoutingPublicationOperatorEnum EQUALS = new RoutingPublicationOperatorEnum("equals"); + + /** The value {@code "in"}. */ + public static final RoutingPublicationOperatorEnum IN = new RoutingPublicationOperatorEnum("in"); + + /** The value {@code "contains"}. */ + public static final RoutingPublicationOperatorEnum CONTAINS = new RoutingPublicationOperatorEnum("contains"); + + private static final List KNOWN_VALUES = List.of(EQUALS, IN, CONTAINS); + + private RoutingPublicationOperatorEnum(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RoutingPublicationOperatorEnum of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RoutingPublicationOperatorEnum::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationPaginatedPolicyRevisionList.java b/src/main/java/me/didit/types/RoutingPublicationPaginatedPolicyRevisionList.java new file mode 100644 index 0000000..beb3009 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationPaginatedPolicyRevisionList.java @@ -0,0 +1,162 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationPaginatedPolicyRevisionList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private RoutingPublicationPaginatedPolicyRevisionList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationPaginatedPolicyRevisionList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationPaginatedPolicyRevisionList fromJson(JsonNode json) { + return new RoutingPublicationPaginatedPolicyRevisionList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(RoutingPublicationPolicyRevision::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationPaginatedPolicyRevisionList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationPaginatedPolicyRevisionList from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(RoutingPublicationPolicyRevision::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationPaginatedPolicyRevisionList} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationPaginatedPolicyRevisionList build() { + require("count", false); + require("results", false); + return new RoutingPublicationPaginatedPolicyRevisionList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationPolicyDraft.java b/src/main/java/me/didit/types/RoutingPublicationPolicyDraft.java new file mode 100644 index 0000000..2047b03 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationPolicyDraft.java @@ -0,0 +1,183 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationPolicyDraft extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("revision", "base_version", "changes", "actor_email", "updated_at"); + + private RoutingPublicationPolicyDraft(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationPolicyDraft} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationPolicyDraft fromJson(JsonNode json) { + return new RoutingPublicationPolicyDraft(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The revision field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional revision() { + return Json.optional(json, "revision", Conv.STRING); + } + + /** + * The base_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long baseVersion() { + return Json.required(json, "base_version", Conv.LONG); + } + + /** + * The changes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional changes() { + return Json.optional(json, "changes", Conv.ANY); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The updated_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime updatedAt() { + return Json.required(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationPolicyDraft}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationPolicyDraft from) { + super(from); + } + + /** + * The revision field. + * + * @param revision the value + * @return this builder + */ + public Builder revision(String revision) { + return set("revision", Conv.STRING, revision); + } + + /** + * The base_version field. + * + * @param baseVersion the value + * @return this builder + */ + public Builder baseVersion(long baseVersion) { + return set("base_version", Conv.LONG, baseVersion); + } + + /** + * The changes field. + * + * @param changes the value + * @return this builder + */ + public Builder changes(@Nullable Object changes) { + return setAny("changes", changes); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationPolicyDraft} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationPolicyDraft build() { + require("base_version", false); + require("updated_at", false); + return new RoutingPublicationPolicyDraft(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationPolicyDraftPreconditionRequest.java b/src/main/java/me/didit/types/RoutingPublicationPolicyDraftPreconditionRequest.java new file mode 100644 index 0000000..965fb41 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationPolicyDraftPreconditionRequest.java @@ -0,0 +1,122 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationPolicyDraftPreconditionRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("expected_version", "expected_revision"); + + private RoutingPublicationPolicyDraftPreconditionRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationPolicyDraftPreconditionRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationPolicyDraftPreconditionRequest fromJson(JsonNode json) { + return new RoutingPublicationPolicyDraftPreconditionRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The expected_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long expectedVersion() { + return Json.required(json, "expected_version", Conv.LONG); + } + + /** + * The expected_revision field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedRevision() { + return Json.optional(json, "expected_revision", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationPolicyDraftPreconditionRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationPolicyDraftPreconditionRequest from) { + super(from); + } + + /** + * The expected_version field. + * + * @param expectedVersion the value + * @return this builder + */ + public Builder expectedVersion(long expectedVersion) { + return set("expected_version", Conv.LONG, expectedVersion); + } + + /** + * The expected_revision field. + * + * @param expectedRevision the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedRevision(@Nullable String expectedRevision) { + return setNullable("expected_revision", Conv.STRING, expectedRevision); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationPolicyDraftPreconditionRequest} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationPolicyDraftPreconditionRequest build() { + require("expected_version", false); + require("expected_revision", true); + return new RoutingPublicationPolicyDraftPreconditionRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationPolicyDraftResponse.java b/src/main/java/me/didit/types/RoutingPublicationPolicyDraftResponse.java new file mode 100644 index 0000000..8ff0e79 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationPolicyDraftResponse.java @@ -0,0 +1,101 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationPolicyDraftResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("draft"); + + private RoutingPublicationPolicyDraftResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationPolicyDraftResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationPolicyDraftResponse fromJson(JsonNode json) { + return new RoutingPublicationPolicyDraftResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The draft field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional draft() { + return Json.optional(json, "draft", Conv.model(RoutingPublicationPolicyDraft::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationPolicyDraftResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationPolicyDraftResponse from) { + super(from); + } + + /** + * The draft field. + * + * @param draft the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder draft(@Nullable RoutingPublicationPolicyDraft draft) { + return setNullable("draft", Conv.model(RoutingPublicationPolicyDraft::fromJson), draft); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationPolicyDraftResponse} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationPolicyDraftResponse build() { + require("draft", true); + return new RoutingPublicationPolicyDraftResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationPolicyDraftWriteRequest.java b/src/main/java/me/didit/types/RoutingPublicationPolicyDraftWriteRequest.java new file mode 100644 index 0000000..04bfa77 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationPolicyDraftWriteRequest.java @@ -0,0 +1,143 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationPolicyDraftWriteRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("expected_version", "expected_revision", "changes"); + + private RoutingPublicationPolicyDraftWriteRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationPolicyDraftWriteRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationPolicyDraftWriteRequest fromJson(JsonNode json) { + return new RoutingPublicationPolicyDraftWriteRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The expected_version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long expectedVersion() { + return Json.required(json, "expected_version", Conv.LONG); + } + + /** + * The expected_revision field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedRevision() { + return Json.optional(json, "expected_revision", Conv.STRING); + } + + /** + * The changes field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map changes() { + return Json.required(json, "changes", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationPolicyDraftWriteRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationPolicyDraftWriteRequest from) { + super(from); + } + + /** + * The expected_version field. + * + * @param expectedVersion the value + * @return this builder + */ + public Builder expectedVersion(long expectedVersion) { + return set("expected_version", Conv.LONG, expectedVersion); + } + + /** + * The expected_revision field. + * + * @param expectedRevision the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedRevision(@Nullable String expectedRevision) { + return setNullable("expected_revision", Conv.STRING, expectedRevision); + } + + /** + * The changes field. + * + * @param changes the value + * @return this builder + */ + public Builder changes(Map changes) { + return setAny("changes", changes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationPolicyDraftWriteRequest} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationPolicyDraftWriteRequest build() { + require("expected_version", false); + require("expected_revision", true); + require("changes", false); + return new RoutingPublicationPolicyDraftWriteRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationPolicyRevision.java b/src/main/java/me/didit/types/RoutingPublicationPolicyRevision.java new file mode 100644 index 0000000..9c1bbdf --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationPolicyRevision.java @@ -0,0 +1,164 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationPolicyRevision extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("version", "snapshot", "actor_email", "published_at"); + + private RoutingPublicationPolicyRevision(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationPolicyRevision} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationPolicyRevision fromJson(JsonNode json) { + return new RoutingPublicationPolicyRevision(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The version field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long version() { + return Json.required(json, "version", Conv.LONG); + } + + /** + * The snapshot field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public JsonNode snapshot() { + return Json.required(json, "snapshot", Conv.ANY); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The published_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime publishedAt() { + return Json.required(json, "published_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationPolicyRevision}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationPolicyRevision from) { + super(from); + } + + /** + * The version field. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * The snapshot field. + * + * @param snapshot the value + * @return this builder + */ + public Builder snapshot(@Nullable Object snapshot) { + return setAny("snapshot", snapshot); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The published_at field. + * + * @param publishedAt the value + * @return this builder + */ + public Builder publishedAt(OffsetDateTime publishedAt) { + return set("published_at", Conv.DATE_TIME, publishedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationPolicyRevision} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationPolicyRevision build() { + require("version", false); + require("snapshot", false); + require("published_at", false); + return new RoutingPublicationPolicyRevision(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/RoutingPublicationRoutingCondition.java b/src/main/java/me/didit/types/RoutingPublicationRoutingCondition.java new file mode 100644 index 0000000..3fdc425 --- /dev/null +++ b/src/main/java/me/didit/types/RoutingPublicationRoutingCondition.java @@ -0,0 +1,150 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class RoutingPublicationRoutingCondition extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("field", "operator", "value"); + + private RoutingPublicationRoutingCondition(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RoutingPublicationRoutingCondition} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RoutingPublicationRoutingCondition fromJson(JsonNode json) { + return new RoutingPublicationRoutingCondition(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * - source - source + * - priority - priority + * - tags - tags + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public RoutingPublicationFieldEnum field() { + return Json.required(json, "field", Conv.enumeration(RoutingPublicationFieldEnum::of)); + } + + /** + * - equals - equals + * - in - in + * - contains - contains + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public RoutingPublicationOperatorEnum operator() { + return Json.required(json, "operator", Conv.enumeration(RoutingPublicationOperatorEnum::of)); + } + + /** + * The value field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public JsonNode value() { + return Json.required(json, "value", Conv.ANY); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RoutingPublicationRoutingCondition}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RoutingPublicationRoutingCondition from) { + super(from); + } + + /** + * - source - source + * - priority - priority + * - tags - tags + * + * @param field the value + * @return this builder + */ + public Builder field(RoutingPublicationFieldEnum field) { + return set("field", Conv.enumeration(RoutingPublicationFieldEnum::of), field); + } + + /** + * - equals - equals + * - in - in + * - contains - contains + * + * @param operator the value + * @return this builder + */ + public Builder operator(RoutingPublicationOperatorEnum operator) { + return set("operator", Conv.enumeration(RoutingPublicationOperatorEnum::of), operator); + } + + /** + * The value field. + * + * @param value the value + * @return this builder + */ + public Builder value(@Nullable Object value) { + return setAny("value", value); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RoutingPublicationRoutingCondition} + * @throws IllegalStateException when a required field is missing + */ + public RoutingPublicationRoutingCondition build() { + require("field", false); + require("operator", false); + require("value", false); + return new RoutingPublicationRoutingCondition(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionImportError.java b/src/main/java/me/didit/types/SessionImportError.java new file mode 100644 index 0000000..2bf5aec --- /dev/null +++ b/src/main/java/me/didit/types/SessionImportError.java @@ -0,0 +1,205 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class SessionImportError extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "row_number", "external_id", "error", "raw_row", "created_at"); + + private SessionImportError(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionImportError} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionImportError fromJson(JsonNode json) { + return new SessionImportError(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The row_number field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long rowNumber() { + return Json.required(json, "row_number", Conv.LONG); + } + + /** + * The external_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional externalId() { + return Json.optional(json, "external_id", Conv.STRING); + } + + /** + * The error field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String error() { + return Json.required(json, "error", Conv.STRING); + } + + /** + * The raw_row field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map rawRow() { + return Json.required(json, "raw_row", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionImportError}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionImportError from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The row_number field. + * + * @param rowNumber the value + * @return this builder + */ + public Builder rowNumber(long rowNumber) { + return set("row_number", Conv.LONG, rowNumber); + } + + /** + * The external_id field. + * + * @param externalId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder externalId(@Nullable String externalId) { + return setNullable("external_id", Conv.STRING, externalId); + } + + /** + * The error field. + * + * @param error the value + * @return this builder + */ + public Builder error(String error) { + return set("error", Conv.STRING, error); + } + + /** + * The raw_row field. + * + * @param rawRow the value + * @return this builder + */ + public Builder rawRow(Map rawRow) { + return setAny("raw_row", rawRow); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionImportError} + * @throws IllegalStateException when a required field is missing + */ + public SessionImportError build() { + require("uuid", false); + require("row_number", false); + require("error", false); + require("raw_row", false); + return new SessionImportError(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionImportJob.java b/src/main/java/me/didit/types/SessionImportJob.java new file mode 100644 index 0000000..e20a1fa --- /dev/null +++ b/src/main/java/me/didit/types/SessionImportJob.java @@ -0,0 +1,597 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionImportJob extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "status", "import_type", "source_format", "source_filename", "total_rows", "processed_rows", "checkpoint_row", "created_count", "updated_count", "skipped_count", "failed_count", "total_media_bytes", "last_error", "created_at", "updated_at", "started_at", "completed_at"); + + private SessionImportJob(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionImportJob} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionImportJob fromJson(JsonNode json) { + return new SessionImportJob(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Import job id. Use this value to poll progress and fetch row errors. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * The status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionImportJob.Status status() { + return Json.required(json, "status", Conv.enumeration(SessionImportJob.Status::of)); + } + + /** + * The import_type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionImportJob.ImportType importType() { + return Json.required(json, "import_type", Conv.enumeration(SessionImportJob.ImportType::of)); + } + + /** + * The source_format field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionImportJob.SourceFormat sourceFormat() { + return Json.required(json, "source_format", Conv.enumeration(SessionImportJob.SourceFormat::of)); + } + + /** + * The source_filename field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sourceFilename() { + return Json.required(json, "source_filename", Conv.STRING); + } + + /** + * The total_rows field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long totalRows() { + return Json.required(json, "total_rows", Conv.LONG); + } + + /** + * The processed_rows field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long processedRows() { + return Json.required(json, "processed_rows", Conv.LONG); + } + + /** + * The checkpoint_row field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional checkpointRow() { + return Json.optional(json, "checkpoint_row", Conv.LONG); + } + + /** + * The created_count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long createdCount() { + return Json.required(json, "created_count", Conv.LONG); + } + + /** + * The updated_count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long updatedCount() { + return Json.required(json, "updated_count", Conv.LONG); + } + + /** + * The skipped_count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long skippedCount() { + return Json.required(json, "skipped_count", Conv.LONG); + } + + /** + * The failed_count field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long failedCount() { + return Json.required(json, "failed_count", Conv.LONG); + } + + /** + * The total_media_bytes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalMediaBytes() { + return Json.optional(json, "total_media_bytes", Conv.LONG); + } + + /** + * The last_error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastError() { + return Json.optional(json, "last_error", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * The started_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional startedAt() { + return Json.optional(json, "started_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionImportJob}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionImportJob from) { + super(from); + } + + /** + * Import job id. Use this value to poll progress and fetch row errors. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionImportJob.Status status) { + return set("status", Conv.enumeration(SessionImportJob.Status::of), status); + } + + /** + * The import_type field. + * + * @param importType the value + * @return this builder + */ + public Builder importType(SessionImportJob.ImportType importType) { + return set("import_type", Conv.enumeration(SessionImportJob.ImportType::of), importType); + } + + /** + * The source_format field. + * + * @param sourceFormat the value + * @return this builder + */ + public Builder sourceFormat(SessionImportJob.SourceFormat sourceFormat) { + return set("source_format", Conv.enumeration(SessionImportJob.SourceFormat::of), sourceFormat); + } + + /** + * The source_filename field. + * + * @param sourceFilename the value + * @return this builder + */ + public Builder sourceFilename(String sourceFilename) { + return set("source_filename", Conv.STRING, sourceFilename); + } + + /** + * The total_rows field. + * + * @param totalRows the value + * @return this builder + */ + public Builder totalRows(long totalRows) { + return set("total_rows", Conv.LONG, totalRows); + } + + /** + * The processed_rows field. + * + * @param processedRows the value + * @return this builder + */ + public Builder processedRows(long processedRows) { + return set("processed_rows", Conv.LONG, processedRows); + } + + /** + * The checkpoint_row field. + * + * @param checkpointRow the value + * @return this builder + */ + public Builder checkpointRow(long checkpointRow) { + return set("checkpoint_row", Conv.LONG, checkpointRow); + } + + /** + * The created_count field. + * + * @param createdCount the value + * @return this builder + */ + public Builder createdCount(long createdCount) { + return set("created_count", Conv.LONG, createdCount); + } + + /** + * The updated_count field. + * + * @param updatedCount the value + * @return this builder + */ + public Builder updatedCount(long updatedCount) { + return set("updated_count", Conv.LONG, updatedCount); + } + + /** + * The skipped_count field. + * + * @param skippedCount the value + * @return this builder + */ + public Builder skippedCount(long skippedCount) { + return set("skipped_count", Conv.LONG, skippedCount); + } + + /** + * The failed_count field. + * + * @param failedCount the value + * @return this builder + */ + public Builder failedCount(long failedCount) { + return set("failed_count", Conv.LONG, failedCount); + } + + /** + * The total_media_bytes field. + * + * @param totalMediaBytes the value + * @return this builder + */ + public Builder totalMediaBytes(long totalMediaBytes) { + return set("total_media_bytes", Conv.LONG, totalMediaBytes); + } + + /** + * The last_error field. + * + * @param lastError the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastError(@Nullable String lastError) { + return setNullable("last_error", Conv.STRING, lastError); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * The started_at field. + * + * @param startedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder startedAt(@Nullable OffsetDateTime startedAt) { + return setNullable("started_at", Conv.DATE_TIME, startedAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionImportJob} + * @throws IllegalStateException when a required field is missing + */ + public SessionImportJob build() { + require("uuid", false); + require("status", false); + require("import_type", false); + require("source_format", false); + require("source_filename", false); + require("total_rows", false); + require("processed_rows", false); + require("created_count", false); + require("updated_count", false); + require("skipped_count", false); + require("failed_count", false); + return new SessionImportJob(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + /** The value {@code "PAUSED"}. */ + public static final Status PAUSED = new Status("PAUSED"); + + /** The value {@code "CANCELLED"}. */ + public static final Status CANCELLED = new Status("CANCELLED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED, PAUSED, CANCELLED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ImportType extends StringEnum { + /** The value {@code "user_verification"}. */ + public static final ImportType USER_VERIFICATION = new ImportType("user_verification"); + + /** The value {@code "business_verification"}. */ + public static final ImportType BUSINESS_VERIFICATION = new ImportType("business_verification"); + + /** The value {@code "status_rules"}. */ + public static final ImportType STATUS_RULES = new ImportType("status_rules"); + + /** The value {@code "transactions"}. */ + public static final ImportType TRANSACTIONS = new ImportType("transactions"); + + private static final List KNOWN_VALUES = List.of(USER_VERIFICATION, BUSINESS_VERIFICATION, STATUS_RULES, TRANSACTIONS); + + private ImportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ImportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ImportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceFormat extends StringEnum { + /** The value {@code "csv"}. */ + public static final SourceFormat CSV = new SourceFormat("csv"); + + /** The value {@code "ndjson"}. */ + public static final SourceFormat NDJSON = new SourceFormat("ndjson"); + + private static final List KNOWN_VALUES = List.of(CSV, NDJSON); + + private SourceFormat(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceFormat of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceFormat::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsBatchDeleteParams.java b/src/main/java/me/didit/types/SessionsBatchDeleteParams.java new file mode 100644 index 0000000..437ea3c --- /dev/null +++ b/src/main/java/me/didit/types/SessionsBatchDeleteParams.java @@ -0,0 +1,265 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.batch_delete}. */ +public final class SessionsBatchDeleteParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_numbers", "delete_all", "retain_face_embeddings", "face_retention_days", "face_retention_deadline", "deletion_instruction", "instruction_id"); + + private SessionsBatchDeleteParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsBatchDeleteParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsBatchDeleteParams fromJson(JsonNode json) { + return new SessionsBatchDeleteParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Numeric session_number values of the KYC sessions to delete, as digit-only strings (JSON numbers are also accepted and coerced). Required unless delete_all is true; an empty list returns 400. Any non-digit entry rejects the whole request with 400 (unless delete_all is true, in which case validation is skipped and the entries are ignored). Numbers that do not match a live session in your application are silently skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sessionNumbers() { + return Json.optional(json, "session_numbers", Conv.list(Conv.STRING)); + } + + /** + * When true, every remaining KYC session in the calling application is deleted and session_numbers is ignored. More than 20 matching sessions run as a deletion job (202) that covers only the sessions created before the request. Defaults to false. Irreversible; there is no confirmation step. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteAll() { + return Json.optional(json, "delete_all", Conv.BOOLEAN); + } + + /** + * Override the application's face_retention_policy for this deletion. true keeps one image-free face biometric template anchored to the session's User after the session is deleted; false deletes the face embedding with the session; omit or null to follow the application policy. Ignored for KYB sessions and for sessions without a face embedding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainFaceEmbeddings() { + return Json.optional(json, "retain_face_embeddings", Conv.BOOLEAN); + } + + /** + * Finite retention duration, in days, for a retained template. Required when a template is retained unless the application already sets face_retention_days. The template's expires_at is the earliest of this duration, the application's general data-retention window, and face_retention_deadline. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceRetentionDays() { + return Json.optional(json, "face_retention_days", Conv.LONG); + } + + /** + * Optional hard expiry for a retained template. Must be in the future. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceRetentionDeadline() { + return Json.optional(json, "face_retention_deadline", Conv.DATE_TIME); + } + + /** + * The class of instruction you are giving. operational_session_delete deletes the session and retains a template only when the policy or retain_face_embeddings says so. privacy_erasure purges every retained biometric template anchored to the session's User before deleting the session, cannot be overridden by the application policy, and cannot be combined with retain_face_embeddings: true (400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deletionInstruction() { + return Json.optional(json, "deletion_instruction", Conv.enumeration(SessionsBatchDeleteParams.DeletionInstruction::of)); + } + + /** + * Your durable reference for this deletion instruction (for example an erasure-ticket id). Recorded on the audit trail and on any retained template. Generated by Didit when omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionId() { + return Json.optional(json, "instruction_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsBatchDeleteParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsBatchDeleteParams from) { + super(from); + } + + /** + * Numeric session_number values of the KYC sessions to delete, as digit-only strings (JSON numbers are also accepted and coerced). Required unless delete_all is true; an empty list returns 400. Any non-digit entry rejects the whole request with 400 (unless delete_all is true, in which case validation is skipped and the entries are ignored). Numbers that do not match a live session in your application are silently skipped. + * + * @param sessionNumbers the value + * @return this builder + */ + public Builder sessionNumbers(List sessionNumbers) { + return set("session_numbers", Conv.list(Conv.STRING), sessionNumbers); + } + + /** + * When true, every remaining KYC session in the calling application is deleted and session_numbers is ignored. More than 20 matching sessions run as a deletion job (202) that covers only the sessions created before the request. Defaults to false. Irreversible; there is no confirmation step. + * + * @param deleteAll the value + * @return this builder + */ + public Builder deleteAll(boolean deleteAll) { + return set("delete_all", Conv.BOOLEAN, deleteAll); + } + + /** + * Override the application's face_retention_policy for this deletion. true keeps one image-free face biometric template anchored to the session's User after the session is deleted; false deletes the face embedding with the session; omit or null to follow the application policy. Ignored for KYB sessions and for sessions without a face embedding. + * + * @param retainFaceEmbeddings the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retainFaceEmbeddings(@Nullable Boolean retainFaceEmbeddings) { + return setNullable("retain_face_embeddings", Conv.BOOLEAN, retainFaceEmbeddings); + } + + /** + * Finite retention duration, in days, for a retained template. Required when a template is retained unless the application already sets face_retention_days. The template's expires_at is the earliest of this duration, the application's general data-retention window, and face_retention_deadline. + * + * @param faceRetentionDays the value + * @return this builder + */ + public Builder faceRetentionDays(long faceRetentionDays) { + return set("face_retention_days", Conv.LONG, faceRetentionDays); + } + + /** + * Optional hard expiry for a retained template. Must be in the future. + * + * @param faceRetentionDeadline the value + * @return this builder + */ + public Builder faceRetentionDeadline(OffsetDateTime faceRetentionDeadline) { + return set("face_retention_deadline", Conv.DATE_TIME, faceRetentionDeadline); + } + + /** + * The class of instruction you are giving. operational_session_delete deletes the session and retains a template only when the policy or retain_face_embeddings says so. privacy_erasure purges every retained biometric template anchored to the session's User before deleting the session, cannot be overridden by the application policy, and cannot be combined with retain_face_embeddings: true (400). + * + * @param deletionInstruction the value + * @return this builder + */ + public Builder deletionInstruction(SessionsBatchDeleteParams.DeletionInstruction deletionInstruction) { + return set("deletion_instruction", Conv.enumeration(SessionsBatchDeleteParams.DeletionInstruction::of), deletionInstruction); + } + + /** + * Your durable reference for this deletion instruction (for example an erasure-ticket id). Recorded on the audit trail and on any retained template. Generated by Didit when omitted. + * + * @param instructionId the value + * @return this builder + */ + public Builder instructionId(String instructionId) { + return set("instruction_id", Conv.STRING, instructionId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsBatchDeleteParams} + */ + public SessionsBatchDeleteParams build() { + return new SessionsBatchDeleteParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The class of instruction you are giving. operational_session_delete deletes the session and retains a template only when the policy or retain_face_embeddings says so. privacy_erasure purges every retained biometric template anchored to the session's User before deleting the session, cannot be overridden by the application policy, and cannot be combined with retain_face_embeddings: true (400). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DeletionInstruction extends StringEnum { + /** The value {@code "operational_session_delete"}. */ + public static final DeletionInstruction OPERATIONAL_SESSION_DELETE = new DeletionInstruction("operational_session_delete"); + + /** The value {@code "privacy_erasure"}. */ + public static final DeletionInstruction PRIVACY_ERASURE = new DeletionInstruction("privacy_erasure"); + + private static final List KNOWN_VALUES = List.of(OPERATIONAL_SESSION_DELETE, PRIVACY_ERASURE); + + private DeletionInstruction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DeletionInstruction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DeletionInstruction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsBatchDeleteResponse.java b/src/main/java/me/didit/types/SessionsBatchDeleteResponse.java new file mode 100644 index 0000000..9206c50 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsBatchDeleteResponse.java @@ -0,0 +1,876 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Response of {@code sessions.batch_delete}; the shape depends on the HTTP status. */ +public final class SessionsBatchDeleteResponse extends MultiStatusResponse { + private SessionsBatchDeleteResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static SessionsBatchDeleteResponse fromResponse(int statusCode, JsonNode json) { + return new SessionsBatchDeleteResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.model(SessionsBatchDeleteResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 202. + * + * @return true for status 202 + */ + public boolean isAccepted() { + return statusCode() == 202; + } + + /** + * The body of a 202 response. + * + * @return the body, or empty for another status + */ + public Optional asAccepted() { + return isAccepted() ? Optional.of(Conv.model(SessionsBatchDeleteResponse.Accepted::fromJson).read(json)) : Optional.empty(); + } + + public static final class Ok extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private Ok(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Ok} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Ok fromJson(JsonNode json) { + return new Ok(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(SessionsBatchDeleteResponse.Ok.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Ok}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Ok from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(SessionsBatchDeleteResponse.Ok.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Ok} + */ + public Ok build() { + return new Ok(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "face_retention_outcome", "biometric_template_uuid", "biometric_template_expires_at", "deleted_child_verifications"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The deleted session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The deleted session's number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * What happened to the session's face biometric data. deleted: the face embedding was deleted with the session (default). retained_with_user: the session is deleted and one image-free biometric template stays anchored to the User; see biometric_template_uuid. none: the session had no face embedding (for example a document-only KYC session without a liveness selfie; KYB sessions are never selected by this endpoint). ineligible_no_vendor_user: retention was requested but the session has no linked User, so the embedding was deleted with the session. failed_retryable (batch endpoint only): the group this session was deleted with could not be deleted (a storage service, a biometric store, or a monitoring provider was unavailable); this session is still in place, repeat the request for it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceRetentionOutcome() { + return Json.optional(json, "face_retention_outcome", Conv.enumeration(SessionsBatchDeleteResponse.Ok.Results.FaceRetentionOutcome::of)); + } + + /** + * Id of the retained biometric template when face_retention_outcome is retained_with_user; null otherwise. Manage it through /v3/biometric-templates/{template_uuid}/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateUuid() { + return Json.optional(json, "biometric_template_uuid", Conv.STRING); + } + + /** + * When the retained biometric template is deleted, when face_retention_outcome is retained_with_user; null when no template is retained. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateExpiresAt() { + return Json.optional(json, "biometric_template_expires_at", Conv.DATE_TIME); + } + + /** + * Always 0 on this endpoint, which deletes KYC sessions only. Deleting a Business Verification (KYB) session with DELETE /v3/session/{sessionId}/delete/ reports the verifications it created that were deleted with it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deletedChildVerifications() { + return Json.optional(json, "deleted_child_verifications", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * The deleted session. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * The deleted session's number. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * What happened to the session's face biometric data. deleted: the face embedding was deleted with the session (default). retained_with_user: the session is deleted and one image-free biometric template stays anchored to the User; see biometric_template_uuid. none: the session had no face embedding (for example a document-only KYC session without a liveness selfie; KYB sessions are never selected by this endpoint). ineligible_no_vendor_user: retention was requested but the session has no linked User, so the embedding was deleted with the session. failed_retryable (batch endpoint only): the group this session was deleted with could not be deleted (a storage service, a biometric store, or a monitoring provider was unavailable); this session is still in place, repeat the request for it. + * + * @param faceRetentionOutcome the value + * @return this builder + */ + public Builder faceRetentionOutcome(SessionsBatchDeleteResponse.Ok.Results.FaceRetentionOutcome faceRetentionOutcome) { + return set("face_retention_outcome", Conv.enumeration(SessionsBatchDeleteResponse.Ok.Results.FaceRetentionOutcome::of), faceRetentionOutcome); + } + + /** + * Id of the retained biometric template when face_retention_outcome is retained_with_user; null otherwise. Manage it through /v3/biometric-templates/{template_uuid}/. + * + * @param biometricTemplateUuid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateUuid(@Nullable String biometricTemplateUuid) { + return setNullable("biometric_template_uuid", Conv.STRING, biometricTemplateUuid); + } + + /** + * When the retained biometric template is deleted, when face_retention_outcome is retained_with_user; null when no template is retained. + * + * @param biometricTemplateExpiresAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateExpiresAt(@Nullable OffsetDateTime biometricTemplateExpiresAt) { + return setNullable("biometric_template_expires_at", Conv.DATE_TIME, biometricTemplateExpiresAt); + } + + /** + * Always 0 on this endpoint, which deletes KYC sessions only. Deleting a Business Verification (KYB) session with DELETE /v3/session/{sessionId}/delete/ reports the verifications it created that were deleted with it. + * + * @param deletedChildVerifications the value + * @return this builder + */ + public Builder deletedChildVerifications(long deletedChildVerifications) { + return set("deleted_child_verifications", Conv.LONG, deletedChildVerifications); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What happened to the session's face biometric data. deleted: the face embedding was deleted with the session (default). retained_with_user: the session is deleted and one image-free biometric template stays anchored to the User; see biometric_template_uuid. none: the session had no face embedding (for example a document-only KYC session without a liveness selfie; KYB sessions are never selected by this endpoint). ineligible_no_vendor_user: retention was requested but the session has no linked User, so the embedding was deleted with the session. failed_retryable (batch endpoint only): the group this session was deleted with could not be deleted (a storage service, a biometric store, or a monitoring provider was unavailable); this session is still in place, repeat the request for it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class FaceRetentionOutcome extends StringEnum { + /** The value {@code "retained_with_user"}. */ + public static final FaceRetentionOutcome RETAINED_WITH_USER = new FaceRetentionOutcome("retained_with_user"); + + /** The value {@code "deleted"}. */ + public static final FaceRetentionOutcome DELETED = new FaceRetentionOutcome("deleted"); + + /** The value {@code "none"}. */ + public static final FaceRetentionOutcome NONE = new FaceRetentionOutcome("none"); + + /** The value {@code "ineligible_no_vendor_user"}. */ + public static final FaceRetentionOutcome INELIGIBLE_NO_VENDOR_USER = new FaceRetentionOutcome("ineligible_no_vendor_user"); + + /** The value {@code "failed_retryable"}. */ + public static final FaceRetentionOutcome FAILED_RETRYABLE = new FaceRetentionOutcome("failed_retryable"); + + private static final List KNOWN_VALUES = List.of(RETAINED_WITH_USER, DELETED, NONE, INELIGIBLE_NO_VENDOR_USER, FAILED_RETRYABLE); + + private FaceRetentionOutcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FaceRetentionOutcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FaceRetentionOutcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + /** + * A bulk session deletion running in the background: progress and counts per outcome, never which sessions it deleted. + */ + public static final class Accepted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "total", "processed", "outcomes", "deleted_child_verifications", "error", "created_at", "completed_at"); + + private Accepted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Accepted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Accepted fromJson(JsonNode json) { + return new Accepted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Poll GET /v3/sessions/delete/{job_id}/ with this id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * PENDING: accepted, not started yet. PROCESSING: deleting; processed and outcomes are updating. COMPLETED: every selected session is accounted for. FAILED: the job stopped early; see error. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsBatchDeleteResponse.Accepted.Status::of)); + } + + /** + * Sessions selected when the deletion was requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * Sessions the job has finished with so far. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * How many sessions ended in each outcome. Every key is always present. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(SessionsBatchDeleteResponse.Accepted.Outcomes::fromJson)); + } + + /** + * Verifications that the deleted business verifications created, deleted with them. Always 0 for a job started by POST /v3/sessions/delete/, which deletes KYC sessions only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deletedChildVerifications() { + return Json.optional(json, "deleted_child_verifications", Conv.LONG); + } + + /** + * null unless status is FAILED; then why the deletion stopped. The sessions the job had not reached are still in place: repeat the request to delete them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * When the deletion was requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * When the job finished; null while it runs. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Accepted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Accepted from) { + super(from); + } + + /** + * Poll GET /v3/sessions/delete/{job_id}/ with this id. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * PENDING: accepted, not started yet. PROCESSING: deleting; processed and outcomes are updating. COMPLETED: every selected session is accounted for. FAILED: the job stopped early; see error. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsBatchDeleteResponse.Accepted.Status status) { + return set("status", Conv.enumeration(SessionsBatchDeleteResponse.Accepted.Status::of), status); + } + + /** + * Sessions selected when the deletion was requested. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Sessions the job has finished with so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * How many sessions ended in each outcome. Every key is always present. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(SessionsBatchDeleteResponse.Accepted.Outcomes outcomes) { + return set("outcomes", Conv.model(SessionsBatchDeleteResponse.Accepted.Outcomes::fromJson), outcomes); + } + + /** + * Verifications that the deleted business verifications created, deleted with them. Always 0 for a job started by POST /v3/sessions/delete/, which deletes KYC sessions only. + * + * @param deletedChildVerifications the value + * @return this builder + */ + public Builder deletedChildVerifications(long deletedChildVerifications) { + return set("deleted_child_verifications", Conv.LONG, deletedChildVerifications); + } + + /** + * null unless status is FAILED; then why the deletion stopped. The sessions the job had not reached are still in place: repeat the request to delete them. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * When the deletion was requested. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * When the job finished; null while it runs. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Accepted} + */ + public Accepted build() { + return new Accepted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * PENDING: accepted, not started yet. PROCESSING: deleting; processed and outcomes are updating. COMPLETED: every selected session is accounted for. FAILED: the job stopped early; see error. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** How many sessions ended in each outcome. Every key is always present. */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("deleted", "none", "retained_with_user", "ineligible_no_vendor_user", "failed_retryable", "already_deleted"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Sessions deleted together with their face embedding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleted() { + return Json.optional(json, "deleted", Conv.LONG); + } + + /** + * Sessions deleted that had no face embedding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional none() { + return Json.optional(json, "none", Conv.LONG); + } + + /** + * Sessions deleted while one image-free biometric template was retained for their User, as the request or the application policy asked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedWithUser() { + return Json.optional(json, "retained_with_user", Conv.LONG); + } + + /** + * Sessions deleted, with their face embedding, because retention was requested but they had no linked User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ineligibleNoVendorUser() { + return Json.optional(json, "ineligible_no_vendor_user", Conv.LONG); + } + + /** + * Sessions reported as not deleted. A job retries a group it could not delete by itself instead of counting it here. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedRetryable() { + return Json.optional(json, "failed_retryable", Conv.LONG); + } + + /** + * Selected sessions that were already deleted, for example by another request, when the job reached them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyDeleted() { + return Json.optional(json, "already_deleted", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Sessions deleted together with their face embedding. + * + * @param deleted the value + * @return this builder + */ + public Builder deleted(long deleted) { + return set("deleted", Conv.LONG, deleted); + } + + /** + * Sessions deleted that had no face embedding. + * + * @param none the value + * @return this builder + */ + public Builder none(long none) { + return set("none", Conv.LONG, none); + } + + /** + * Sessions deleted while one image-free biometric template was retained for their User, as the request or the application policy asked. + * + * @param retainedWithUser the value + * @return this builder + */ + public Builder retainedWithUser(long retainedWithUser) { + return set("retained_with_user", Conv.LONG, retainedWithUser); + } + + /** + * Sessions deleted, with their face embedding, because retention was requested but they had no linked User. + * + * @param ineligibleNoVendorUser the value + * @return this builder + */ + public Builder ineligibleNoVendorUser(long ineligibleNoVendorUser) { + return set("ineligible_no_vendor_user", Conv.LONG, ineligibleNoVendorUser); + } + + /** + * Sessions reported as not deleted. A job retries a group it could not delete by itself instead of counting it here. + * + * @param failedRetryable the value + * @return this builder + */ + public Builder failedRetryable(long failedRetryable) { + return set("failed_retryable", Conv.LONG, failedRetryable); + } + + /** + * Selected sessions that were already deleted, for example by another request, when the job reached them. + * + * @param alreadyDeleted the value + * @return this builder + */ + public Builder alreadyDeleted(long alreadyDeleted) { + return set("already_deleted", Conv.LONG, alreadyDeleted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsBulkUpdateAmlHitStatusParams.java b/src/main/java/me/didit/types/SessionsBulkUpdateAmlHitStatusParams.java new file mode 100644 index 0000000..de268a6 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsBulkUpdateAmlHitStatusParams.java @@ -0,0 +1,298 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.bulk_update_aml_hit_status}. */ +public final class SessionsBulkUpdateAmlHitStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id_query", "hit_updates", "node_id"); + + private SessionsBulkUpdateAmlHitStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsBulkUpdateAmlHitStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsBulkUpdateAmlHitStatusParams fromJson(JsonNode json) { + return new SessionsBulkUpdateAmlHitStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node ID. Required only when the session has multiple AML checks (one per node); omit it for single-AML sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeIdQuery() { + return Json.optional(json, "node_id_query", Conv.STRING); + } + + /** + * Non-empty list of hit updates. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List hitUpdates() { + return Json.required(json, "hit_updates", Conv.list(Conv.model(SessionsBulkUpdateAmlHitStatusParams.HitUpdates::fromJson))); + } + + /** + * Optional graph node ID. Use it (here or as a query parameter) when the session has multiple AML checks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsBulkUpdateAmlHitStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsBulkUpdateAmlHitStatusParams from) { + super(from); + } + + /** + * Workflow graph node ID. Required only when the session has multiple AML checks (one per node); omit it for single-AML sessions. + * + * @param nodeIdQuery the value + * @return this builder + */ + public Builder nodeIdQuery(String nodeIdQuery) { + return set("node_id_query", Conv.STRING, nodeIdQuery); + } + + /** + * Non-empty list of hit updates. + * + * @param hitUpdates the value + * @return this builder + */ + public Builder hitUpdates(List hitUpdates) { + return set("hit_updates", Conv.list(Conv.model(SessionsBulkUpdateAmlHitStatusParams.HitUpdates::fromJson)), hitUpdates); + } + + /** + * Optional graph node ID. Use it (here or as a query parameter) when the session has multiple AML checks. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsBulkUpdateAmlHitStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsBulkUpdateAmlHitStatusParams build() { + require("hit_updates", false); + return new SessionsBulkUpdateAmlHitStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class HitUpdates extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("hit_id", "review_status"); + + private HitUpdates(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code HitUpdates} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static HitUpdates fromJson(JsonNode json) { + return new HitUpdates(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The hit_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String hitId() { + return Json.required(json, "hit_id", Conv.STRING); + } + + /** + * The review_status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsBulkUpdateAmlHitStatusParams.HitUpdates.ReviewStatus reviewStatus() { + return Json.required(json, "review_status", Conv.enumeration(SessionsBulkUpdateAmlHitStatusParams.HitUpdates.ReviewStatus::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link HitUpdates}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(HitUpdates from) { + super(from); + } + + /** + * The hit_id field. + * + * @param hitId the value + * @return this builder + */ + public Builder hitId(String hitId) { + return set("hit_id", Conv.STRING, hitId); + } + + /** + * The review_status field. + * + * @param reviewStatus the value + * @return this builder + */ + public Builder reviewStatus(SessionsBulkUpdateAmlHitStatusParams.HitUpdates.ReviewStatus reviewStatus) { + return set("review_status", Conv.enumeration(SessionsBulkUpdateAmlHitStatusParams.HitUpdates.ReviewStatus::of), reviewStatus); + } + + /** + * Builds the value. + * + * @return a new immutable {@code HitUpdates} + * @throws IllegalStateException when a required field is missing + */ + public HitUpdates build() { + require("hit_id", false); + require("review_status", false); + return new HitUpdates(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReviewStatus extends StringEnum { + /** The value {@code "Unreviewed"}. */ + public static final ReviewStatus UNREVIEWED = new ReviewStatus("Unreviewed"); + + /** The value {@code "Confirmed Match"}. */ + public static final ReviewStatus CONFIRMED_MATCH = new ReviewStatus("Confirmed Match"); + + /** The value {@code "False Positive"}. */ + public static final ReviewStatus FALSE_POSITIVE = new ReviewStatus("False Positive"); + + /** The value {@code "Inconclusive"}. */ + public static final ReviewStatus INCONCLUSIVE = new ReviewStatus("Inconclusive"); + + private static final List KNOWN_VALUES = List.of(UNREVIEWED, CONFIRMED_MATCH, FALSE_POSITIVE, INCONCLUSIVE); + + private ReviewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReviewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReviewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsCreateParams.java b/src/main/java/me/didit/types/SessionsCreateParams.java new file mode 100644 index 0000000..5269030 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsCreateParams.java @@ -0,0 +1,1344 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.create}. */ +public final class SessionsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("workflow_id", "vendor_data", "callback", "callback_method", "metadata", "language", "contact_details", "expected_details", "portrait_image", "sandbox_scenario"); + + private SessionsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsCreateParams fromJson(JsonNode json) { + return new SessionsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable identifier of the workflow that defines which verification steps the session will run. Workflows are created and managed in the [Workflows](/console/workflows) page of the Console. The workflow_id also implicitly selects whether the session is KYC or KYB. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String workflowId() { + return Json.required(json, "workflow_id", Conv.STRING); + } + + /** + * A unique identifier for the user being verified, such as a UUID, email, or internal user ID. This field is used for: (1) User grouping โ€” sessions with the same vendor_data are linked to the same user profile in the Users tab. (2) Cross-session duplicate detection โ€” when checking for duplicated faces, documents, phone numbers, emails, IP addresses, or device fingerprints, sessions with the same vendor_data are treated as the same user and excluded from matches. Without vendor_data, every session is treated as a unique user and all potential duplicates are surfaced. We strongly recommend always providing a vendor_data to reduce noise in duplicate detection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * URL to redirect the user to after verification completes. Didit automatically appends verificationSessionId and status (Approved, Declined, In Review) as query parameters. Custom URL schemes (e.g. myapp://) are supported for mobile callbacks. If omitted, the workflow's default callback_url is used. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callback() { + return Json.optional(json, "callback", Conv.STRING); + } + + /** + * Determines which device should handle the redirect to the provided callback URL. Use initiator to redirect only the device that started the flow, completer for the device that finishes it, or both to allow either device to trigger the callback. If you ever notice the callback not triggering reliably, we recommend setting this value to both. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callbackMethod() { + return Json.optional(json, "callback_method", Conv.enumeration(SessionsCreateParams.CallbackMethod::of)); + } + + /** + * Arbitrary JSON stored with the session and echoed back in the response and webhooks. Any JSON value is accepted (object, string, number, array), but a JSON object of key/value pairs is recommended. Not shown to the end user. Use it to pass your own correlation ids, A/B variants, or business context. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional metadata() { + return Json.optional(json, "metadata", Conv.ANY); + } + + /** + * Language code (ISO 639-1) for the verification process interface. Controls the language displayed to the end user during verification. If not provided, the browser's language will be automatically detected and used. Check all the supported languages [here](/integration/supported-languages). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional language() { + return Json.optional(json, "language", Conv.enumeration(SessionsCreateParams.Language::of)); + } + + /** + * User contact information that can be used for notifications, prefilling verification forms, and phone verification. This includes email address, preferred language for communications, and phone number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contactDetails() { + return Json.optional(json, "contact_details", Conv.model(SessionsCreateParams.ContactDetails::fromJson)); + } + + /** + * Expected user details used to cross-validate against the data extracted from the user's ID document, Proof of Address, and other verification steps. Mismatches are surfaced as warnings on the decision; some fields (e.g. id_country, expected_document_types) also alter the user-facing flow. For Business Verification (KYB) workflows only the business fields (company_name, registry_country, registration_number) are used โ€” they pre-fill the company registry search for the user โ€” and all person-level fields are ignored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedDetails() { + return Json.optional(json, "expected_details", Conv.model(SessionsCreateParams.ExpectedDetails::fromJson)); + } + + /** + * Base64-encoded portrait image of the end user's face (max 2MB; JPEG, PNG, WebP, or TIFF). Used as the reference image to match against the liveness capture when the workflow is a Biometric Authentication workflow with Face Match enabled, or any graph workflow where Face Match runs before ID Verification (OCR). Optional when the vendor_data user already has a stored face image: Didit reuses it automatically, resolved in priority order: approved liveness face, ePassport chip photo, ID document portrait, manually enrolled profile face (only faces from approved sessions or faces you enrolled yourself are reused). When provided, portrait_image always takes precedence over the stored face. If omitted and no stored face exists (or vendor_data is not sent), session creation fails with 400. Ignored for other workflow types. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImage() { + return Json.optional(json, "portrait_image", Conv.STRING); + } + + /** + * Sandbox-only scenario slug. Only accepted when the API key belongs to a sandbox-mode application; rejected on live applications. When set, the create flow expands the scenario's bundled magic values onto the session's input fields (contact_details, expected_details) so the mocked providers reproduce the scenario's outcome through the real workflow pipeline. See the scenario catalog at GET /v1/sandbox/scenarios/ or [Sandbox & Test Data](/integration/sandbox-testing). You can also arm (or re-arm) a scenario after create via POST /v3/session/{sessionId}/sandbox/arm/, as long as the session is still Not Started. For non-doc lookup, use lookup_partial_match, lookup_no_match, or lookup_provider_error to test the configured attempt budget and fallback. For identity wallets, use wallet_cancelled, wallet_timeout, or wallet_provider_error; approve simulates a verified wallet. All catalog wallets can be tested in sandbox, including schemes unavailable on live applications. Simulated attempts are not charged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sandboxScenario() { + return Json.optional(json, "sandbox_scenario", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsCreateParams from) { + super(from); + } + + /** + * Stable identifier of the workflow that defines which verification steps the session will run. Workflows are created and managed in the [Workflows](/console/workflows) page of the Console. The workflow_id also implicitly selects whether the session is KYC or KYB. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * A unique identifier for the user being verified, such as a UUID, email, or internal user ID. This field is used for: (1) User grouping โ€” sessions with the same vendor_data are linked to the same user profile in the Users tab. (2) Cross-session duplicate detection โ€” when checking for duplicated faces, documents, phone numbers, emails, IP addresses, or device fingerprints, sessions with the same vendor_data are treated as the same user and excluded from matches. Without vendor_data, every session is treated as a unique user and all potential duplicates are surfaced. We strongly recommend always providing a vendor_data to reduce noise in duplicate detection. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * URL to redirect the user to after verification completes. Didit automatically appends verificationSessionId and status (Approved, Declined, In Review) as query parameters. Custom URL schemes (e.g. myapp://) are supported for mobile callbacks. If omitted, the workflow's default callback_url is used. + * + * @param callback the value + * @return this builder + */ + public Builder callback(String callback) { + return set("callback", Conv.STRING, callback); + } + + /** + * Determines which device should handle the redirect to the provided callback URL. Use initiator to redirect only the device that started the flow, completer for the device that finishes it, or both to allow either device to trigger the callback. If you ever notice the callback not triggering reliably, we recommend setting this value to both. + * + * @param callbackMethod the value + * @return this builder + */ + public Builder callbackMethod(SessionsCreateParams.CallbackMethod callbackMethod) { + return set("callback_method", Conv.enumeration(SessionsCreateParams.CallbackMethod::of), callbackMethod); + } + + /** + * Arbitrary JSON stored with the session and echoed back in the response and webhooks. Any JSON value is accepted (object, string, number, array), but a JSON object of key/value pairs is recommended. Not shown to the end user. Use it to pass your own correlation ids, A/B variants, or business context. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(@Nullable Object metadata) { + return setAny("metadata", metadata); + } + + /** + * Language code (ISO 639-1) for the verification process interface. Controls the language displayed to the end user during verification. If not provided, the browser's language will be automatically detected and used. Check all the supported languages [here](/integration/supported-languages). + * + * @param language the value + * @return this builder + */ + public Builder language(SessionsCreateParams.Language language) { + return set("language", Conv.enumeration(SessionsCreateParams.Language::of), language); + } + + /** + * User contact information that can be used for notifications, prefilling verification forms, and phone verification. This includes email address, preferred language for communications, and phone number. + * + * @param contactDetails the value + * @return this builder + */ + public Builder contactDetails(SessionsCreateParams.ContactDetails contactDetails) { + return set("contact_details", Conv.model(SessionsCreateParams.ContactDetails::fromJson), contactDetails); + } + + /** + * Expected user details used to cross-validate against the data extracted from the user's ID document, Proof of Address, and other verification steps. Mismatches are surfaced as warnings on the decision; some fields (e.g. id_country, expected_document_types) also alter the user-facing flow. For Business Verification (KYB) workflows only the business fields (company_name, registry_country, registration_number) are used โ€” they pre-fill the company registry search for the user โ€” and all person-level fields are ignored. + * + * @param expectedDetails the value + * @return this builder + */ + public Builder expectedDetails(SessionsCreateParams.ExpectedDetails expectedDetails) { + return set("expected_details", Conv.model(SessionsCreateParams.ExpectedDetails::fromJson), expectedDetails); + } + + /** + * Base64-encoded portrait image of the end user's face (max 2MB; JPEG, PNG, WebP, or TIFF). Used as the reference image to match against the liveness capture when the workflow is a Biometric Authentication workflow with Face Match enabled, or any graph workflow where Face Match runs before ID Verification (OCR). Optional when the vendor_data user already has a stored face image: Didit reuses it automatically, resolved in priority order: approved liveness face, ePassport chip photo, ID document portrait, manually enrolled profile face (only faces from approved sessions or faces you enrolled yourself are reused). When provided, portrait_image always takes precedence over the stored face. If omitted and no stored face exists (or vendor_data is not sent), session creation fails with 400. Ignored for other workflow types. + * + * @param portraitImage the value + * @return this builder + */ + public Builder portraitImage(String portraitImage) { + return set("portrait_image", Conv.STRING, portraitImage); + } + + /** + * Sandbox-only scenario slug. Only accepted when the API key belongs to a sandbox-mode application; rejected on live applications. When set, the create flow expands the scenario's bundled magic values onto the session's input fields (contact_details, expected_details) so the mocked providers reproduce the scenario's outcome through the real workflow pipeline. See the scenario catalog at GET /v1/sandbox/scenarios/ or [Sandbox & Test Data](/integration/sandbox-testing). You can also arm (or re-arm) a scenario after create via POST /v3/session/{sessionId}/sandbox/arm/, as long as the session is still Not Started. For non-doc lookup, use lookup_partial_match, lookup_no_match, or lookup_provider_error to test the configured attempt budget and fallback. For identity wallets, use wallet_cancelled, wallet_timeout, or wallet_provider_error; approve simulates a verified wallet. All catalog wallets can be tested in sandbox, including schemes unavailable on live applications. Simulated attempts are not charged. + * + * @param sandboxScenario the value + * @return this builder + */ + public Builder sandboxScenario(String sandboxScenario) { + return set("sandbox_scenario", Conv.STRING, sandboxScenario); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsCreateParams build() { + require("workflow_id", false); + return new SessionsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Determines which device should handle the redirect to the provided callback URL. Use initiator to redirect only the device that started the flow, completer for the device that finishes it, or both to allow either device to trigger the callback. If you ever notice the callback not triggering reliably, we recommend setting this value to both. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class CallbackMethod extends StringEnum { + /** The value {@code "initiator"}. */ + public static final CallbackMethod INITIATOR = new CallbackMethod("initiator"); + + /** The value {@code "completer"}. */ + public static final CallbackMethod COMPLETER = new CallbackMethod("completer"); + + /** The value {@code "both"}. */ + public static final CallbackMethod BOTH = new CallbackMethod("both"); + + private static final List KNOWN_VALUES = List.of(INITIATOR, COMPLETER, BOTH); + + private CallbackMethod(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CallbackMethod of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CallbackMethod::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Language code (ISO 639-1) for the verification process interface. Controls the language displayed to the end user during verification. If not provided, the browser's language will be automatically detected and used. Check all the supported languages [here](/integration/supported-languages). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Language extends StringEnum { + /** The value {@code "en"}. */ + public static final Language EN = new Language("en"); + + /** The value {@code "ar"}. */ + public static final Language AR = new Language("ar"); + + /** The value {@code "bg"}. */ + public static final Language BG = new Language("bg"); + + /** The value {@code "bn"}. */ + public static final Language BN = new Language("bn"); + + /** The value {@code "bs"}. */ + public static final Language BS = new Language("bs"); + + /** The value {@code "ca"}. */ + public static final Language CA = new Language("ca"); + + /** The value {@code "cnr"}. */ + public static final Language CNR = new Language("cnr"); + + /** The value {@code "cs"}. */ + public static final Language CS = new Language("cs"); + + /** The value {@code "da"}. */ + public static final Language DA = new Language("da"); + + /** The value {@code "de"}. */ + public static final Language DE = new Language("de"); + + /** The value {@code "el"}. */ + public static final Language EL = new Language("el"); + + /** The value {@code "es"}. */ + public static final Language ES = new Language("es"); + + /** The value {@code "et"}. */ + public static final Language ET = new Language("et"); + + /** The value {@code "fa"}. */ + public static final Language FA = new Language("fa"); + + /** The value {@code "fi"}. */ + public static final Language FI = new Language("fi"); + + /** The value {@code "fr"}. */ + public static final Language FR = new Language("fr"); + + /** The value {@code "he"}. */ + public static final Language HE = new Language("he"); + + /** The value {@code "hi"}. */ + public static final Language HI = new Language("hi"); + + /** The value {@code "hr"}. */ + public static final Language HR = new Language("hr"); + + /** The value {@code "hu"}. */ + public static final Language HU = new Language("hu"); + + /** The value {@code "hy"}. */ + public static final Language HY = new Language("hy"); + + /** The value {@code "id"}. */ + public static final Language ID = new Language("id"); + + /** The value {@code "it"}. */ + public static final Language IT = new Language("it"); + + /** The value {@code "ja"}. */ + public static final Language JA = new Language("ja"); + + /** The value {@code "ka"}. */ + public static final Language KA = new Language("ka"); + + /** The value {@code "kk"}. */ + public static final Language KK = new Language("kk"); + + /** The value {@code "ko"}. */ + public static final Language KO = new Language("ko"); + + /** The value {@code "ky"}. */ + public static final Language KY = new Language("ky"); + + /** The value {@code "lt"}. */ + public static final Language LT = new Language("lt"); + + /** The value {@code "lv"}. */ + public static final Language LV = new Language("lv"); + + /** The value {@code "mk"}. */ + public static final Language MK = new Language("mk"); + + /** The value {@code "mn"}. */ + public static final Language MN = new Language("mn"); + + /** The value {@code "ms"}. */ + public static final Language MS = new Language("ms"); + + /** The value {@code "nl"}. */ + public static final Language NL = new Language("nl"); + + /** The value {@code "no"}. */ + public static final Language NO = new Language("no"); + + /** The value {@code "pl"}. */ + public static final Language PL = new Language("pl"); + + /** The value {@code "pt-BR"}. */ + public static final Language PT_BR = new Language("pt-BR"); + + /** The value {@code "pt"}. */ + public static final Language PT = new Language("pt"); + + /** The value {@code "ro"}. */ + public static final Language RO = new Language("ro"); + + /** The value {@code "ru"}. */ + public static final Language RU = new Language("ru"); + + /** The value {@code "sk"}. */ + public static final Language SK = new Language("sk"); + + /** The value {@code "sl"}. */ + public static final Language SL = new Language("sl"); + + /** The value {@code "so"}. */ + public static final Language SO = new Language("so"); + + /** The value {@code "sq"}. */ + public static final Language SQ = new Language("sq"); + + /** The value {@code "sr"}. */ + public static final Language SR = new Language("sr"); + + /** The value {@code "sv"}. */ + public static final Language SV = new Language("sv"); + + /** The value {@code "th"}. */ + public static final Language TH = new Language("th"); + + /** The value {@code "tr"}. */ + public static final Language TR = new Language("tr"); + + /** The value {@code "uk"}. */ + public static final Language UK = new Language("uk"); + + /** The value {@code "uz"}. */ + public static final Language UZ = new Language("uz"); + + /** The value {@code "vi"}. */ + public static final Language VI = new Language("vi"); + + /** The value {@code "zh-CN"}. */ + public static final Language ZH_CN = new Language("zh-CN"); + + /** The value {@code "zh-TW"}. */ + public static final Language ZH_TW = new Language("zh-TW"); + + /** The value {@code "zh"}. */ + public static final Language ZH = new Language("zh"); + + private static final List KNOWN_VALUES = List.of(EN, AR, BG, BN, BS, CA, CNR, CS, DA, DE, EL, ES, ET, FA, FI, FR, HE, HI, HR, HU, HY, ID, IT, JA, KA, KK, KO, KY, LT, LV, MK, MN, MS, NL, NO, PL, PT_BR, PT, RO, RU, SK, SL, SO, SQ, SR, SV, TH, TR, UK, UZ, VI, ZH_CN, ZH_TW, ZH); + + private Language(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Language of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Language::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * User contact information that can be used for notifications, prefilling verification forms, and phone verification. This includes email address, preferred language for communications, and phone number. + */ + public static final class ContactDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "send_notification_emails", "email_lang", "phone"); + + private ContactDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ContactDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ContactDetails fromJson(JsonNode json) { + return new ContactDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Email address of the user (e.g., "john.doe@example.com") that will be used during the [Email Verification](/core-technology/email-verification/overview) step. If not provided, the user must provide it during the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * If true and an email is provided, Didit sends the initial "Verify your identity" email asynchronously when the User Verification (KYC) or Business Verification (KYB) session is created. Didit also sends verification status notifications for sessions requiring manual review to the provided email address (e.g., from 'In Review' to 'Approved' or 'Declined'). This helps users return to your application once their verification is complete. If you have white-label activated for the session, the email sent will be white-labeled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sendNotificationEmails() { + return Json.optional(json, "send_notification_emails", Conv.BOOLEAN); + } + + /** + * Language code (ISO 639-1) for email notifications. Controls the language of all email communications (e.g., "en", "es", "fr"). There is no stored default โ€” when omitted, the verification invite email simply falls back to English (en) at send time. The enum below is a snapshot; the live source of truth for accepted values is the [supported languages](/integration/supported-languages) doc โ€” always consult it before relying on a specific code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailLang() { + return Json.optional(json, "email_lang", Conv.enumeration(SessionsCreateParams.ContactDetails.EmailLang::of)); + } + + /** + * Phone number in E.164 format (e.g., "+14155552671") that will be used during the [Phone Verification](/core-technology/phone-verification/overview) step. If not provided, the user must provide it during the verification flow. Ignored for Business Verification (KYB) workflows. Important: This phone number is only enforced if it is a valid E.164 phone number. If the provided number is invalid or cannot be parsed, it will be ignored and the user will be able to input any valid phone number during the Phone Verification step. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ContactDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ContactDetails from) { + super(from); + } + + /** + * Email address of the user (e.g., "john.doe@example.com") that will be used during the [Email Verification](/core-technology/email-verification/overview) step. If not provided, the user must provide it during the verification flow. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * If true and an email is provided, Didit sends the initial "Verify your identity" email asynchronously when the User Verification (KYC) or Business Verification (KYB) session is created. Didit also sends verification status notifications for sessions requiring manual review to the provided email address (e.g., from 'In Review' to 'Approved' or 'Declined'). This helps users return to your application once their verification is complete. If you have white-label activated for the session, the email sent will be white-labeled. + * + * @param sendNotificationEmails the value + * @return this builder + */ + public Builder sendNotificationEmails(boolean sendNotificationEmails) { + return set("send_notification_emails", Conv.BOOLEAN, sendNotificationEmails); + } + + /** + * Language code (ISO 639-1) for email notifications. Controls the language of all email communications (e.g., "en", "es", "fr"). There is no stored default โ€” when omitted, the verification invite email simply falls back to English (en) at send time. The enum below is a snapshot; the live source of truth for accepted values is the [supported languages](/integration/supported-languages) doc โ€” always consult it before relying on a specific code. + * + * @param emailLang the value + * @return this builder + */ + public Builder emailLang(SessionsCreateParams.ContactDetails.EmailLang emailLang) { + return set("email_lang", Conv.enumeration(SessionsCreateParams.ContactDetails.EmailLang::of), emailLang); + } + + /** + * Phone number in E.164 format (e.g., "+14155552671") that will be used during the [Phone Verification](/core-technology/phone-verification/overview) step. If not provided, the user must provide it during the verification flow. Ignored for Business Verification (KYB) workflows. Important: This phone number is only enforced if it is a valid E.164 phone number. If the provided number is invalid or cannot be parsed, it will be ignored and the user will be able to input any valid phone number during the Phone Verification step. + * + * @param phone the value + * @return this builder + */ + public Builder phone(String phone) { + return set("phone", Conv.STRING, phone); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ContactDetails} + */ + public ContactDetails build() { + return new ContactDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Language code (ISO 639-1) for email notifications. Controls the language of all email communications (e.g., "en", "es", "fr"). There is no stored default โ€” when omitted, the verification invite email simply falls back to English (en) at send time. The enum below is a snapshot; the live source of truth for accepted values is the [supported languages](/integration/supported-languages) doc โ€” always consult it before relying on a specific code. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EmailLang extends StringEnum { + /** The value {@code "en"}. */ + public static final EmailLang EN = new EmailLang("en"); + + /** The value {@code "ar"}. */ + public static final EmailLang AR = new EmailLang("ar"); + + /** The value {@code "bg"}. */ + public static final EmailLang BG = new EmailLang("bg"); + + /** The value {@code "bn"}. */ + public static final EmailLang BN = new EmailLang("bn"); + + /** The value {@code "bs"}. */ + public static final EmailLang BS = new EmailLang("bs"); + + /** The value {@code "ca"}. */ + public static final EmailLang CA = new EmailLang("ca"); + + /** The value {@code "cnr"}. */ + public static final EmailLang CNR = new EmailLang("cnr"); + + /** The value {@code "cs"}. */ + public static final EmailLang CS = new EmailLang("cs"); + + /** The value {@code "da"}. */ + public static final EmailLang DA = new EmailLang("da"); + + /** The value {@code "de"}. */ + public static final EmailLang DE = new EmailLang("de"); + + /** The value {@code "el"}. */ + public static final EmailLang EL = new EmailLang("el"); + + /** The value {@code "es"}. */ + public static final EmailLang ES = new EmailLang("es"); + + /** The value {@code "et"}. */ + public static final EmailLang ET = new EmailLang("et"); + + /** The value {@code "fa"}. */ + public static final EmailLang FA = new EmailLang("fa"); + + /** The value {@code "fi"}. */ + public static final EmailLang FI = new EmailLang("fi"); + + /** The value {@code "fr"}. */ + public static final EmailLang FR = new EmailLang("fr"); + + /** The value {@code "he"}. */ + public static final EmailLang HE = new EmailLang("he"); + + /** The value {@code "hi"}. */ + public static final EmailLang HI = new EmailLang("hi"); + + /** The value {@code "hr"}. */ + public static final EmailLang HR = new EmailLang("hr"); + + /** The value {@code "hu"}. */ + public static final EmailLang HU = new EmailLang("hu"); + + /** The value {@code "hy"}. */ + public static final EmailLang HY = new EmailLang("hy"); + + /** The value {@code "id"}. */ + public static final EmailLang ID = new EmailLang("id"); + + /** The value {@code "it"}. */ + public static final EmailLang IT = new EmailLang("it"); + + /** The value {@code "ja"}. */ + public static final EmailLang JA = new EmailLang("ja"); + + /** The value {@code "ka"}. */ + public static final EmailLang KA = new EmailLang("ka"); + + /** The value {@code "kk"}. */ + public static final EmailLang KK = new EmailLang("kk"); + + /** The value {@code "ko"}. */ + public static final EmailLang KO = new EmailLang("ko"); + + /** The value {@code "ky"}. */ + public static final EmailLang KY = new EmailLang("ky"); + + /** The value {@code "lt"}. */ + public static final EmailLang LT = new EmailLang("lt"); + + /** The value {@code "lv"}. */ + public static final EmailLang LV = new EmailLang("lv"); + + /** The value {@code "mk"}. */ + public static final EmailLang MK = new EmailLang("mk"); + + /** The value {@code "mn"}. */ + public static final EmailLang MN = new EmailLang("mn"); + + /** The value {@code "ms"}. */ + public static final EmailLang MS = new EmailLang("ms"); + + /** The value {@code "nl"}. */ + public static final EmailLang NL = new EmailLang("nl"); + + /** The value {@code "no"}. */ + public static final EmailLang NO = new EmailLang("no"); + + /** The value {@code "pl"}. */ + public static final EmailLang PL = new EmailLang("pl"); + + /** The value {@code "pt-BR"}. */ + public static final EmailLang PT_BR = new EmailLang("pt-BR"); + + /** The value {@code "pt"}. */ + public static final EmailLang PT = new EmailLang("pt"); + + /** The value {@code "ro"}. */ + public static final EmailLang RO = new EmailLang("ro"); + + /** The value {@code "ru"}. */ + public static final EmailLang RU = new EmailLang("ru"); + + /** The value {@code "sk"}. */ + public static final EmailLang SK = new EmailLang("sk"); + + /** The value {@code "sl"}. */ + public static final EmailLang SL = new EmailLang("sl"); + + /** The value {@code "so"}. */ + public static final EmailLang SO = new EmailLang("so"); + + /** The value {@code "sq"}. */ + public static final EmailLang SQ = new EmailLang("sq"); + + /** The value {@code "sr"}. */ + public static final EmailLang SR = new EmailLang("sr"); + + /** The value {@code "sv"}. */ + public static final EmailLang SV = new EmailLang("sv"); + + /** The value {@code "th"}. */ + public static final EmailLang TH = new EmailLang("th"); + + /** The value {@code "tr"}. */ + public static final EmailLang TR = new EmailLang("tr"); + + /** The value {@code "uk"}. */ + public static final EmailLang UK = new EmailLang("uk"); + + /** The value {@code "uz"}. */ + public static final EmailLang UZ = new EmailLang("uz"); + + /** The value {@code "vi"}. */ + public static final EmailLang VI = new EmailLang("vi"); + + /** The value {@code "zh-CN"}. */ + public static final EmailLang ZH_CN = new EmailLang("zh-CN"); + + /** The value {@code "zh-TW"}. */ + public static final EmailLang ZH_TW = new EmailLang("zh-TW"); + + /** The value {@code "zh"}. */ + public static final EmailLang ZH = new EmailLang("zh"); + + private static final List KNOWN_VALUES = List.of(EN, AR, BG, BN, BS, CA, CNR, CS, DA, DE, EL, ES, ET, FA, FI, FR, HE, HI, HR, HU, HY, ID, IT, JA, KA, KK, KO, KY, LT, LV, MK, MN, MS, NL, NO, PL, PT_BR, PT, RO, RU, SK, SL, SO, SQ, SR, SV, TH, TR, UK, UZ, VI, ZH_CN, ZH_TW, ZH); + + private EmailLang(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EmailLang of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EmailLang::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Expected user details used to cross-validate against the data extracted from the user's ID document, Proof of Address, and other verification steps. Mismatches are surfaced as warnings on the decision; some fields (e.g. id_country, expected_document_types) also alter the user-facing flow. For Business Verification (KYB) workflows only the business fields (company_name, registry_country, registration_number) are used โ€” they pre-fill the company registry search for the user โ€” and all person-level fields are ignored. + */ + public static final class ExpectedDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("first_name", "last_name", "date_of_birth", "gender", "nationality", "country", "id_country", "poa_country", "address", "identification_number", "ip_address", "expected_document_types", "company_name", "registry_country", "registration_number"); + + private ExpectedDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ExpectedDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ExpectedDetails fromJson(JsonNode json) { + return new ExpectedDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * User's first name. For example, John. The matching uses fuzzy comparison, and you can tune the strictness by configuring the name match score threshold in the Console for both ID Document and Proof of Address workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * User's last name. For example, Doe. The matching uses fuzzy comparison, and you can tune the strictness by configuring the name match score threshold in the Console for both ID Document and Proof of Address workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * User's date of birth with format: YYYY-MM-DD. For example, 1990-05-15. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * User's gender. Must be either 'M', 'F', or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.enumeration(SessionsCreateParams.ExpectedDetails.Gender::of)); + } + + /** + * ISO 3166-1 alpha-3 country code representing the applicant's country of origin. For example, USA. See the full list of supported country codes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country code used as a fallback for both ID Verification and Proof of Address country-mismatch checks. Required when address is provided and neither id_country nor poa_country is set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country code representing the expected country of the applicant's ID document, which may differ from nationality. For example, GBR. Takes priority over country for ID verification country mismatch checks. See the full list of supported country codes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional idCountry() { + return Json.optional(json, "id_country", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country code representing the expected country of the Proof of Address document. For example, USA. Takes priority over country for POA country mismatch checks. See the full list of supported country codes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaCountry() { + return Json.optional(json, "poa_country", Conv.STRING); + } + + /** + * The address in a human readable format, including as much information as possible. For example, 123 Main St, San Francisco, CA 94105, USA. When provided, you must also pass country or poa_country, otherwise the request fails with 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * The user's document number, personal number, or tax number. For example, 123456789. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identificationNumber() { + return Json.optional(json, "identification_number", Conv.STRING); + } + + /** + * Expected IP address for the session, in IPv4 or IPv6 format. If the actual IP address differs from this value, a warning will be logged. For example, 192.168.1.100 or 2001:db8::1. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Restricts the document types the user can present during the ID verification (OCR) step. When set, the document selection screen only shows the requested types and the returned documents_allowed is filtered accordingly. Values are case-insensitive and deduplicated; unknown values are rejected with 400. Allowed codes: P (passport), ID (national ID), DL (driver's license), RP (residence permit), HIC (health insurance card), TC (tax card), SSC (social security card). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> expectedDocumentTypes() { + return Json.optional(json, "expected_document_types", Conv.list(Conv.enumeration(SessionsCreateParams.ExpectedDetails.ExpectedDocumentTypes::of))); + } + + /** + * Expected legal name of the business being verified. For example, Tesco PLC. Pre-fills the company-name field of the registry search in Business Verification (KYB) workflows; when registration_number is also provided, the registry lookup combines both identifiers. Ignored for KYC workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 code of the country whose company registry the business is registered in. For example, GB. Where company registries operate at state or province level, append the ISO 3166-2 subdivision code as XX-YY: US-CA targets the California registry. Same format as country_code on the KYB Registry Search API. Pre-selects the registry country in Business Verification (KYB) workflows; ignored for KYC workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryCountry() { + return Json.optional(json, "registry_country", Conv.STRING); + } + + /** + * Expected registration number of the business in the company registry. For example, 00445790. Pre-fills the registration-number field of the registry search in Business Verification (KYB) workflows; when company_name is also provided, the registry lookup combines both identifiers. Ignored for KYC workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ExpectedDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ExpectedDetails from) { + super(from); + } + + /** + * User's first name. For example, John. The matching uses fuzzy comparison, and you can tune the strictness by configuring the name match score threshold in the Console for both ID Document and Proof of Address workflows. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * User's last name. For example, Doe. The matching uses fuzzy comparison, and you can tune the strictness by configuring the name match score threshold in the Console for both ID Document and Proof of Address workflows. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * User's date of birth with format: YYYY-MM-DD. For example, 1990-05-15. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * User's gender. Must be either 'M', 'F', or null. + * + * @param gender the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder gender(SessionsCreateParams.ExpectedDetails.@Nullable Gender gender) { + return setNullable("gender", Conv.enumeration(SessionsCreateParams.ExpectedDetails.Gender::of), gender); + } + + /** + * ISO 3166-1 alpha-3 country code representing the applicant's country of origin. For example, USA. See the full list of supported country codes. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * ISO 3166-1 alpha-3 country code used as a fallback for both ID Verification and Proof of Address country-mismatch checks. Required when address is provided and neither id_country nor poa_country is set. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * ISO 3166-1 alpha-3 country code representing the expected country of the applicant's ID document, which may differ from nationality. For example, GBR. Takes priority over country for ID verification country mismatch checks. See the full list of supported country codes. + * + * @param idCountry the value + * @return this builder + */ + public Builder idCountry(String idCountry) { + return set("id_country", Conv.STRING, idCountry); + } + + /** + * ISO 3166-1 alpha-3 country code representing the expected country of the Proof of Address document. For example, USA. Takes priority over country for POA country mismatch checks. See the full list of supported country codes. + * + * @param poaCountry the value + * @return this builder + */ + public Builder poaCountry(String poaCountry) { + return set("poa_country", Conv.STRING, poaCountry); + } + + /** + * The address in a human readable format, including as much information as possible. For example, 123 Main St, San Francisco, CA 94105, USA. When provided, you must also pass country or poa_country, otherwise the request fails with 400. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * The user's document number, personal number, or tax number. For example, 123456789. + * + * @param identificationNumber the value + * @return this builder + */ + public Builder identificationNumber(String identificationNumber) { + return set("identification_number", Conv.STRING, identificationNumber); + } + + /** + * Expected IP address for the session, in IPv4 or IPv6 format. If the actual IP address differs from this value, a warning will be logged. For example, 192.168.1.100 or 2001:db8::1. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Restricts the document types the user can present during the ID verification (OCR) step. When set, the document selection screen only shows the requested types and the returned documents_allowed is filtered accordingly. Values are case-insensitive and deduplicated; unknown values are rejected with 400. Allowed codes: P (passport), ID (national ID), DL (driver's license), RP (residence permit), HIC (health insurance card), TC (tax card), SSC (social security card). + * + * @param expectedDocumentTypes the value + * @return this builder + */ + public Builder expectedDocumentTypes(List expectedDocumentTypes) { + return set("expected_document_types", Conv.list(Conv.enumeration(SessionsCreateParams.ExpectedDetails.ExpectedDocumentTypes::of)), expectedDocumentTypes); + } + + /** + * Expected legal name of the business being verified. For example, Tesco PLC. Pre-fills the company-name field of the registry search in Business Verification (KYB) workflows; when registration_number is also provided, the registry lookup combines both identifiers. Ignored for KYC workflows. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * ISO 3166-1 alpha-2 code of the country whose company registry the business is registered in. For example, GB. Where company registries operate at state or province level, append the ISO 3166-2 subdivision code as XX-YY: US-CA targets the California registry. Same format as country_code on the KYB Registry Search API. Pre-selects the registry country in Business Verification (KYB) workflows; ignored for KYC workflows. + * + * @param registryCountry the value + * @return this builder + */ + public Builder registryCountry(String registryCountry) { + return set("registry_country", Conv.STRING, registryCountry); + } + + /** + * Expected registration number of the business in the company registry. For example, 00445790. Pre-fills the registration-number field of the registry search in Business Verification (KYB) workflows; when company_name is also provided, the registry lookup combines both identifiers. Ignored for KYC workflows. + * + * @param registrationNumber the value + * @return this builder + */ + public Builder registrationNumber(String registrationNumber) { + return set("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ExpectedDetails} + */ + public ExpectedDetails build() { + return new ExpectedDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * User's gender. Must be either 'M', 'F', or null. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Gender extends StringEnum { + /** The value {@code "M"}. */ + public static final Gender M = new Gender("M"); + + /** The value {@code "F"}. */ + public static final Gender F = new Gender("F"); + + private static final List KNOWN_VALUES = List.of(M, F); + + private Gender(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Gender of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Gender::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExpectedDocumentTypes extends StringEnum { + /** The value {@code "P"}. */ + public static final ExpectedDocumentTypes P = new ExpectedDocumentTypes("P"); + + /** The value {@code "ID"}. */ + public static final ExpectedDocumentTypes ID = new ExpectedDocumentTypes("ID"); + + /** The value {@code "DL"}. */ + public static final ExpectedDocumentTypes DL = new ExpectedDocumentTypes("DL"); + + /** The value {@code "RP"}. */ + public static final ExpectedDocumentTypes RP = new ExpectedDocumentTypes("RP"); + + /** The value {@code "HIC"}. */ + public static final ExpectedDocumentTypes HIC = new ExpectedDocumentTypes("HIC"); + + /** The value {@code "TC"}. */ + public static final ExpectedDocumentTypes TC = new ExpectedDocumentTypes("TC"); + + /** The value {@code "SSC"}. */ + public static final ExpectedDocumentTypes SSC = new ExpectedDocumentTypes("SSC"); + + private static final List KNOWN_VALUES = List.of(P, ID, DL, RP, HIC, TC, SSC); + + private ExpectedDocumentTypes(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExpectedDocumentTypes of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExpectedDocumentTypes::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsCreateResponse.java b/src/main/java/me/didit/types/SessionsCreateResponse.java new file mode 100644 index 0000000..4ded12a --- /dev/null +++ b/src/main/java/me/didit/types/SessionsCreateResponse.java @@ -0,0 +1,358 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsCreateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "session_token", "url", "vendor_data", "metadata", "status", "callback", "workflow_id", "workflow_version"); + + private SessionsCreateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsCreateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsCreateResponse fromJson(JsonNode json) { + return new SessionsCreateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier of the verification session. Use this id when calling GET /v3/session/{sessionId}/decision/. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sessionId() { + return Json.required(json, "session_id", Conv.STRING); + } + + /** + * Sequential, human-friendly number assigned to the session inside your application. Useful for support and dashboards. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long sessionNumber() { + return Json.required(json, "session_number", Conv.LONG); + } + + /** + * 12-character URL-safe token that authorizes the end user to access the hosted verification flow at url. Valid until the session expires. Treat it as a secret โ€” anyone holding it can open the verification flow for this session. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sessionToken() { + return Json.required(json, "session_token", Conv.STRING); + } + + /** + * Hosted verification URL to redirect the end user to. The URL embeds the session_token and, if configured, uses your white-label domain. When the request includes language, the URL contains a language path segment โ€” https://verify.didit.me/{language}/session/{session_token} (e.g. /es/session/...); without language, the segment is omitted. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String url() { + return Json.required(json, "url", Conv.STRING); + } + + /** + * Identifier you passed in the request to link the session to a user or business in your own system. Echoed back verbatim. Null when not provided. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Arbitrary JSON payload you stored with the session at creation time. Echoed back verbatim โ€” whatever JSON value you sent (object, string, number, array) is returned as-is, though a JSON object is recommended. Not shown to the end user. Always present in responses; null when not provided at creation time. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public JsonNode metadata() { + return Json.required(json, "metadata", Conv.ANY); + } + + /** + * Current status of the session. Newly created sessions return Not Started. If a non-finished session already existed for the same vendor_data on the workflow's latest published version, the returned status reflects that existing session. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsCreateResponse.Status status() { + return Json.required(json, "status", Conv.enumeration(SessionsCreateResponse.Status::of)); + } + + /** + * Final redirect URL the user is sent to after completing the flow. Didit appends ?verificationSessionId={session_id}&status={status} to this URL. Falls back to the workflow's configured callback URL when not provided in the request; null when neither is set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callback() { + return Json.optional(json, "callback", Conv.STRING); + } + + /** + * Stable identifier of the workflow this session runs on. Always the workflow's stable group identifier โ€” even if you referenced a specific workflow version UUID in the request (backward-compatible lookup), the response carries the stable workflow_id. Use it to correlate the session with the workflow you configured in the Console. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String workflowId() { + return Json.required(json, "workflow_id", Conv.STRING); + } + + /** + * Version number of the published workflow version the session was pinned to at creation. Didit resolves workflow_id to the workflow's latest published version when the session is created, and the session keeps running that version even if the workflow is republished later. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long workflowVersion() { + return Json.required(json, "workflow_version", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsCreateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsCreateResponse from) { + super(from); + } + + /** + * Unique identifier of the verification session. Use this id when calling GET /v3/session/{sessionId}/decision/. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Sequential, human-friendly number assigned to the session inside your application. Useful for support and dashboards. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * 12-character URL-safe token that authorizes the end user to access the hosted verification flow at url. Valid until the session expires. Treat it as a secret โ€” anyone holding it can open the verification flow for this session. + * + * @param sessionToken the value + * @return this builder + */ + public Builder sessionToken(String sessionToken) { + return set("session_token", Conv.STRING, sessionToken); + } + + /** + * Hosted verification URL to redirect the end user to. The URL embeds the session_token and, if configured, uses your white-label domain. When the request includes language, the URL contains a language path segment โ€” https://verify.didit.me/{language}/session/{session_token} (e.g. /es/session/...); without language, the segment is omitted. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Identifier you passed in the request to link the session to a user or business in your own system. Echoed back verbatim. Null when not provided. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Arbitrary JSON payload you stored with the session at creation time. Echoed back verbatim โ€” whatever JSON value you sent (object, string, number, array) is returned as-is, though a JSON object is recommended. Not shown to the end user. Always present in responses; null when not provided at creation time. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(@Nullable Object metadata) { + return setAny("metadata", metadata); + } + + /** + * Current status of the session. Newly created sessions return Not Started. If a non-finished session already existed for the same vendor_data on the workflow's latest published version, the returned status reflects that existing session. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsCreateResponse.Status status) { + return set("status", Conv.enumeration(SessionsCreateResponse.Status::of), status); + } + + /** + * Final redirect URL the user is sent to after completing the flow. Didit appends ?verificationSessionId={session_id}&status={status} to this URL. Falls back to the workflow's configured callback URL when not provided in the request; null when neither is set. + * + * @param callback the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder callback(@Nullable String callback) { + return setNullable("callback", Conv.STRING, callback); + } + + /** + * Stable identifier of the workflow this session runs on. Always the workflow's stable group identifier โ€” even if you referenced a specific workflow version UUID in the request (backward-compatible lookup), the response carries the stable workflow_id. Use it to correlate the session with the workflow you configured in the Console. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * Version number of the published workflow version the session was pinned to at creation. Didit resolves workflow_id to the workflow's latest published version when the session is created, and the session keeps running that version even if the workflow is republished later. + * + * @param workflowVersion the value + * @return this builder + */ + public Builder workflowVersion(long workflowVersion) { + return set("workflow_version", Conv.LONG, workflowVersion); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsCreateResponse} + * @throws IllegalStateException when a required field is missing + */ + public SessionsCreateResponse build() { + require("session_id", false); + require("session_number", false); + require("session_token", false); + require("url", false); + require("vendor_data", true); + require("metadata", false); + require("status", false); + require("callback", true); + require("workflow_id", false); + require("workflow_version", false); + return new SessionsCreateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Current status of the session. Newly created sessions return Not Started. If a non-finished session already existed for the same vendor_data on the workflow's latest published version, the returned status reflects that existing session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final Status NOT_STARTED = new Status("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final Status IN_PROGRESS = new Status("In Progress"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final Status ABANDONED = new Status("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final Status KYC_EXPIRED = new Status("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final Status RESUBMITTED = new Status("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final Status AWAITING_USER = new Status("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsDeleteParams.java b/src/main/java/me/didit/types/SessionsDeleteParams.java new file mode 100644 index 0000000..165097e --- /dev/null +++ b/src/main/java/me/didit/types/SessionsDeleteParams.java @@ -0,0 +1,225 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.delete}. */ +public final class SessionsDeleteParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("retain_face_embeddings", "face_retention_days", "face_retention_deadline", "deletion_instruction", "instruction_id"); + + private SessionsDeleteParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsDeleteParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsDeleteParams fromJson(JsonNode json) { + return new SessionsDeleteParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Override the application's face_retention_policy for this deletion. true keeps one image-free face biometric template anchored to the session's User after the session is deleted; false deletes the face embedding with the session; omit or null to follow the application policy. Ignored for KYB sessions and for sessions without a face embedding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainFaceEmbeddings() { + return Json.optional(json, "retain_face_embeddings", Conv.BOOLEAN); + } + + /** + * Finite retention duration, in days, for a retained template. Required when a template is retained unless the application already sets face_retention_days. The template's expires_at is the earliest of this duration, the application's general data-retention window, and face_retention_deadline. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceRetentionDays() { + return Json.optional(json, "face_retention_days", Conv.LONG); + } + + /** + * Optional hard expiry for a retained template. Must be in the future. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceRetentionDeadline() { + return Json.optional(json, "face_retention_deadline", Conv.DATE_TIME); + } + + /** + * The class of instruction you are giving. operational_session_delete deletes the session and retains a template only when the policy or retain_face_embeddings says so. privacy_erasure purges every retained biometric template anchored to the session's User before deleting the session, cannot be overridden by the application policy, and cannot be combined with retain_face_embeddings: true (400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deletionInstruction() { + return Json.optional(json, "deletion_instruction", Conv.enumeration(SessionsDeleteParams.DeletionInstruction::of)); + } + + /** + * Your durable reference for this deletion instruction (for example an erasure-ticket id). Recorded on the audit trail and on any retained template. Generated by Didit when omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instructionId() { + return Json.optional(json, "instruction_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsDeleteParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsDeleteParams from) { + super(from); + } + + /** + * Override the application's face_retention_policy for this deletion. true keeps one image-free face biometric template anchored to the session's User after the session is deleted; false deletes the face embedding with the session; omit or null to follow the application policy. Ignored for KYB sessions and for sessions without a face embedding. + * + * @param retainFaceEmbeddings the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retainFaceEmbeddings(@Nullable Boolean retainFaceEmbeddings) { + return setNullable("retain_face_embeddings", Conv.BOOLEAN, retainFaceEmbeddings); + } + + /** + * Finite retention duration, in days, for a retained template. Required when a template is retained unless the application already sets face_retention_days. The template's expires_at is the earliest of this duration, the application's general data-retention window, and face_retention_deadline. + * + * @param faceRetentionDays the value + * @return this builder + */ + public Builder faceRetentionDays(long faceRetentionDays) { + return set("face_retention_days", Conv.LONG, faceRetentionDays); + } + + /** + * Optional hard expiry for a retained template. Must be in the future. + * + * @param faceRetentionDeadline the value + * @return this builder + */ + public Builder faceRetentionDeadline(OffsetDateTime faceRetentionDeadline) { + return set("face_retention_deadline", Conv.DATE_TIME, faceRetentionDeadline); + } + + /** + * The class of instruction you are giving. operational_session_delete deletes the session and retains a template only when the policy or retain_face_embeddings says so. privacy_erasure purges every retained biometric template anchored to the session's User before deleting the session, cannot be overridden by the application policy, and cannot be combined with retain_face_embeddings: true (400). + * + * @param deletionInstruction the value + * @return this builder + */ + public Builder deletionInstruction(SessionsDeleteParams.DeletionInstruction deletionInstruction) { + return set("deletion_instruction", Conv.enumeration(SessionsDeleteParams.DeletionInstruction::of), deletionInstruction); + } + + /** + * Your durable reference for this deletion instruction (for example an erasure-ticket id). Recorded on the audit trail and on any retained template. Generated by Didit when omitted. + * + * @param instructionId the value + * @return this builder + */ + public Builder instructionId(String instructionId) { + return set("instruction_id", Conv.STRING, instructionId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsDeleteParams} + */ + public SessionsDeleteParams build() { + return new SessionsDeleteParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The class of instruction you are giving. operational_session_delete deletes the session and retains a template only when the policy or retain_face_embeddings says so. privacy_erasure purges every retained biometric template anchored to the session's User before deleting the session, cannot be overridden by the application policy, and cannot be combined with retain_face_embeddings: true (400). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DeletionInstruction extends StringEnum { + /** The value {@code "operational_session_delete"}. */ + public static final DeletionInstruction OPERATIONAL_SESSION_DELETE = new DeletionInstruction("operational_session_delete"); + + /** The value {@code "privacy_erasure"}. */ + public static final DeletionInstruction PRIVACY_ERASURE = new DeletionInstruction("privacy_erasure"); + + private static final List KNOWN_VALUES = List.of(OPERATIONAL_SESSION_DELETE, PRIVACY_ERASURE); + + private DeletionInstruction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DeletionInstruction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DeletionInstruction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsDeleteResponse.java b/src/main/java/me/didit/types/SessionsDeleteResponse.java new file mode 100644 index 0000000..e54387b --- /dev/null +++ b/src/main/java/me/didit/types/SessionsDeleteResponse.java @@ -0,0 +1,250 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsDeleteResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "face_retention_outcome", "biometric_template_uuid", "biometric_template_expires_at", "deleted_child_verifications"); + + private SessionsDeleteResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsDeleteResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsDeleteResponse fromJson(JsonNode json) { + return new SessionsDeleteResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The deleted session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The deleted session's number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * What happened to the session's face biometric data. deleted: the face embedding was deleted with the session (default). retained_with_user: the session is deleted and one image-free biometric template stays anchored to the User; see biometric_template_uuid. none: the session had no face embedding (for example a KYB session, or a KYC session without a liveness selfie). ineligible_no_vendor_user: retention was requested but the session has no linked User, so the embedding was deleted with the session. A biometric-store failure is never reported through this field on this endpoint: it returns 503 and the session is not deleted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceRetentionOutcome() { + return Json.optional(json, "face_retention_outcome", Conv.enumeration(SessionsDeleteResponse.FaceRetentionOutcome::of)); + } + + /** + * Id of the retained biometric template when face_retention_outcome is retained_with_user; null otherwise. Manage it through /v3/biometric-templates/{template_uuid}/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateUuid() { + return Json.optional(json, "biometric_template_uuid", Conv.STRING); + } + + /** + * When the retained biometric template is deleted, when face_retention_outcome is retained_with_user; null when no template is retained. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateExpiresAt() { + return Json.optional(json, "biometric_template_expires_at", Conv.DATE_TIME); + } + + /** + * For a Business Verification (KYB) session: how many verifications it created (its key people's KYC sessions and its corporate owners' KYB sessions, recursively) were deleted with it. Always 0 for a KYC session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deletedChildVerifications() { + return Json.optional(json, "deleted_child_verifications", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsDeleteResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsDeleteResponse from) { + super(from); + } + + /** + * The deleted session. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * The deleted session's number. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * What happened to the session's face biometric data. deleted: the face embedding was deleted with the session (default). retained_with_user: the session is deleted and one image-free biometric template stays anchored to the User; see biometric_template_uuid. none: the session had no face embedding (for example a KYB session, or a KYC session without a liveness selfie). ineligible_no_vendor_user: retention was requested but the session has no linked User, so the embedding was deleted with the session. A biometric-store failure is never reported through this field on this endpoint: it returns 503 and the session is not deleted. + * + * @param faceRetentionOutcome the value + * @return this builder + */ + public Builder faceRetentionOutcome(SessionsDeleteResponse.FaceRetentionOutcome faceRetentionOutcome) { + return set("face_retention_outcome", Conv.enumeration(SessionsDeleteResponse.FaceRetentionOutcome::of), faceRetentionOutcome); + } + + /** + * Id of the retained biometric template when face_retention_outcome is retained_with_user; null otherwise. Manage it through /v3/biometric-templates/{template_uuid}/. + * + * @param biometricTemplateUuid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateUuid(@Nullable String biometricTemplateUuid) { + return setNullable("biometric_template_uuid", Conv.STRING, biometricTemplateUuid); + } + + /** + * When the retained biometric template is deleted, when face_retention_outcome is retained_with_user; null when no template is retained. + * + * @param biometricTemplateExpiresAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateExpiresAt(@Nullable OffsetDateTime biometricTemplateExpiresAt) { + return setNullable("biometric_template_expires_at", Conv.DATE_TIME, biometricTemplateExpiresAt); + } + + /** + * For a Business Verification (KYB) session: how many verifications it created (its key people's KYC sessions and its corporate owners' KYB sessions, recursively) were deleted with it. Always 0 for a KYC session. + * + * @param deletedChildVerifications the value + * @return this builder + */ + public Builder deletedChildVerifications(long deletedChildVerifications) { + return set("deleted_child_verifications", Conv.LONG, deletedChildVerifications); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsDeleteResponse} + */ + public SessionsDeleteResponse build() { + return new SessionsDeleteResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What happened to the session's face biometric data. deleted: the face embedding was deleted with the session (default). retained_with_user: the session is deleted and one image-free biometric template stays anchored to the User; see biometric_template_uuid. none: the session had no face embedding (for example a KYB session, or a KYC session without a liveness selfie). ineligible_no_vendor_user: retention was requested but the session has no linked User, so the embedding was deleted with the session. A biometric-store failure is never reported through this field on this endpoint: it returns 503 and the session is not deleted. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class FaceRetentionOutcome extends StringEnum { + /** The value {@code "retained_with_user"}. */ + public static final FaceRetentionOutcome RETAINED_WITH_USER = new FaceRetentionOutcome("retained_with_user"); + + /** The value {@code "deleted"}. */ + public static final FaceRetentionOutcome DELETED = new FaceRetentionOutcome("deleted"); + + /** The value {@code "none"}. */ + public static final FaceRetentionOutcome NONE = new FaceRetentionOutcome("none"); + + /** The value {@code "ineligible_no_vendor_user"}. */ + public static final FaceRetentionOutcome INELIGIBLE_NO_VENDOR_USER = new FaceRetentionOutcome("ineligible_no_vendor_user"); + + private static final List KNOWN_VALUES = List.of(RETAINED_WITH_USER, DELETED, NONE, INELIGIBLE_NO_VENDOR_USER); + + private FaceRetentionOutcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static FaceRetentionOutcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, FaceRetentionOutcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsImportSharedParams.java b/src/main/java/me/didit/types/SessionsImportSharedParams.java new file mode 100644 index 0000000..d0c9862 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsImportSharedParams.java @@ -0,0 +1,164 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.import_shared}. */ +public final class SessionsImportSharedParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("share_token", "trust_review", "workflow_id", "vendor_data"); + + private SessionsImportSharedParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsImportSharedParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsImportSharedParams fromJson(JsonNode json) { + return new SessionsImportSharedParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * JWT share token issued by [POST /v3/session/{sessionId}/share/](/sessions-api/share-session). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String shareToken() { + return Json.required(json, "share_token", Conv.STRING); + } + + /** + * If true, the cloned session keeps the source's final status. If false, it is forced into In Review. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean trustReview() { + return Json.required(json, "trust_review", Conv.BOOLEAN); + } + + /** + * UUID of a workflow in the calling application. Cross-application IDs are rejected with 404. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String workflowId() { + return Json.required(json, "workflow_id", Conv.STRING); + } + + /** + * Optional override for the cloned session's vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsImportSharedParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsImportSharedParams from) { + super(from); + } + + /** + * JWT share token issued by [POST /v3/session/{sessionId}/share/](/sessions-api/share-session). + * + * @param shareToken the value + * @return this builder + */ + public Builder shareToken(String shareToken) { + return set("share_token", Conv.STRING, shareToken); + } + + /** + * If true, the cloned session keeps the source's final status. If false, it is forced into In Review. + * + * @param trustReview the value + * @return this builder + */ + public Builder trustReview(boolean trustReview) { + return set("trust_review", Conv.BOOLEAN, trustReview); + } + + /** + * UUID of a workflow in the calling application. Cross-application IDs are rejected with 404. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * Optional override for the cloned session's vendor_data. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsImportSharedParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsImportSharedParams build() { + require("share_token", false); + require("trust_review", false); + require("workflow_id", false); + return new SessionsImportSharedParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsImportsCreateParams.java b/src/main/java/me/didit/types/SessionsImportsCreateParams.java new file mode 100644 index 0000000..79fadcd --- /dev/null +++ b/src/main/java/me/didit/types/SessionsImportsCreateParams.java @@ -0,0 +1,282 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.imports.create}. */ +public final class SessionsImportsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("import_type", "workflow_id", "source_format", "file", "source_file_url"); + + private SessionsImportsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsImportsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsImportsCreateParams fromJson(JsonNode json) { + return new SessionsImportsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * What to import: historical User Verification sessions, historical Business Verification sessions, workflow custom status rules, or historical transaction monitoring records. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional importType() { + return Json.optional(json, "import_type", Conv.enumeration(SessionsImportsCreateParams.ImportType::of)); + } + + /** + * Workflow UUID that imported sessions or status rules should be attached to. Required for user_verification, business_verification, and status_rules. Omit for transactions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowId() { + return Json.optional(json, "workflow_id", Conv.STRING); + } + + /** + * Optional. Inferred from the uploaded file extension when omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceFormat() { + return Json.optional(json, "source_format", Conv.enumeration(SessionsImportsCreateParams.SourceFormat::of)); + } + + /** + * Canonical CSV or NDJSON file. Use NDJSON for large imports. Maximum upload size 25 MB (use source_file_url for bigger files). Mutually exclusive with source_file_url. + * + * @return the file to upload, if set + */ + public Optional file() { + return file("file"); + } + + /** + * Alternative to file upload. Must be an HTTPS URL resolving to a public address (private/loopback networks are rejected). Mutually exclusive with file. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceFileUrl() { + return Json.optional(json, "source_file_url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsImportsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsImportsCreateParams from) { + super(from); + } + + /** + * What to import: historical User Verification sessions, historical Business Verification sessions, workflow custom status rules, or historical transaction monitoring records. + * + * @param importType the value + * @return this builder + */ + public Builder importType(SessionsImportsCreateParams.ImportType importType) { + return set("import_type", Conv.enumeration(SessionsImportsCreateParams.ImportType::of), importType); + } + + /** + * Workflow UUID that imported sessions or status rules should be attached to. Required for user_verification, business_verification, and status_rules. Omit for transactions. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * Optional. Inferred from the uploaded file extension when omitted. + * + * @param sourceFormat the value + * @return this builder + */ + public Builder sourceFormat(SessionsImportsCreateParams.SourceFormat sourceFormat) { + return set("source_format", Conv.enumeration(SessionsImportsCreateParams.SourceFormat::of), sourceFormat); + } + + /** + * Canonical CSV or NDJSON file. Use NDJSON for large imports. Maximum upload size 25 MB (use source_file_url for bigger files). Mutually exclusive with source_file_url. + * + * @param file the value + * @return this builder + */ + public Builder file(FileUpload file) { + return setFile("file", file); + } + + /** + * Uploads the file at {@code path} as {@code file}. + * + * @param path the file to read when the request is sent + * @return this builder + */ + public Builder file(Path path) { + return setFile("file", FileUpload.of(path)); + } + + /** + * Alternative to file upload. Must be an HTTPS URL resolving to a public address (private/loopback networks are rejected). Mutually exclusive with file. + * + * @param sourceFileUrl the value + * @return this builder + */ + public Builder sourceFileUrl(String sourceFileUrl) { + return set("source_file_url", Conv.STRING, sourceFileUrl); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsImportsCreateParams} + */ + public SessionsImportsCreateParams build() { + return new SessionsImportsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What to import: historical User Verification sessions, historical Business Verification sessions, workflow custom status rules, or historical transaction monitoring records. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ImportType extends StringEnum { + /** The value {@code "user_verification"}. */ + public static final ImportType USER_VERIFICATION = new ImportType("user_verification"); + + /** The value {@code "business_verification"}. */ + public static final ImportType BUSINESS_VERIFICATION = new ImportType("business_verification"); + + /** The value {@code "status_rules"}. */ + public static final ImportType STATUS_RULES = new ImportType("status_rules"); + + /** The value {@code "transactions"}. */ + public static final ImportType TRANSACTIONS = new ImportType("transactions"); + + private static final List KNOWN_VALUES = List.of(USER_VERIFICATION, BUSINESS_VERIFICATION, STATUS_RULES, TRANSACTIONS); + + private ImportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ImportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ImportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Optional. Inferred from the uploaded file extension when omitted. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SourceFormat extends StringEnum { + /** The value {@code "csv"}. */ + public static final SourceFormat CSV = new SourceFormat("csv"); + + /** The value {@code "ndjson"}. */ + public static final SourceFormat NDJSON = new SourceFormat("ndjson"); + + private static final List KNOWN_VALUES = List.of(CSV, NDJSON); + + private SourceFormat(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SourceFormat of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SourceFormat::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsImportsListErrorsParams.java b/src/main/java/me/didit/types/SessionsImportsListErrorsParams.java new file mode 100644 index 0000000..5a304bf --- /dev/null +++ b/src/main/java/me/didit/types/SessionsImportsListErrorsParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code sessions.imports.list_errors}. */ +public final class SessionsImportsListErrorsParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private SessionsImportsListErrorsParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsImportsListErrorsParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsImportsListErrorsParams fromJson(JsonNode json) { + return new SessionsImportsListErrorsParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. Defaults to 50 when omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset of the first record to return. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsImportsListErrorsParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsImportsListErrorsParams from) { + super(from); + } + + /** + * Page size. Defaults to 50 when omitted. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset of the first record to return. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsImportsListErrorsParams} + */ + public SessionsImportsListErrorsParams build() { + return new SessionsImportsListErrorsParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsImportsListErrorsResponse.java b/src/main/java/me/didit/types/SessionsImportsListErrorsResponse.java new file mode 100644 index 0000000..4e4affb --- /dev/null +++ b/src/main/java/me/didit/types/SessionsImportsListErrorsResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class SessionsImportsListErrorsResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private SessionsImportsListErrorsResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsImportsListErrorsResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsImportsListErrorsResponse fromJson(JsonNode json) { + return new SessionsImportsListErrorsResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of error rows โ€” exact up to 100, capped at 100 beyond that. Rely on next being null to detect the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(SessionImportError::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsImportsListErrorsResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsImportsListErrorsResponse from) { + super(from); + } + + /** + * Number of error rows โ€” exact up to 100, capped at 100 beyond that. Rely on next being null to detect the last page. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(SessionImportError::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsImportsListErrorsResponse} + */ + public SessionsImportsListErrorsResponse build() { + return new SessionsImportsListErrorsResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsImportsRetrieveTemplateParams.java b/src/main/java/me/didit/types/SessionsImportsRetrieveTemplateParams.java new file mode 100644 index 0000000..34247db --- /dev/null +++ b/src/main/java/me/didit/types/SessionsImportsRetrieveTemplateParams.java @@ -0,0 +1,148 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.imports.retrieve_template}. */ +public final class SessionsImportsRetrieveTemplateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("import_type"); + + private SessionsImportsRetrieveTemplateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsImportsRetrieveTemplateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsImportsRetrieveTemplateParams fromJson(JsonNode json) { + return new SessionsImportsRetrieveTemplateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The import_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional importType() { + return Json.optional(json, "import_type", Conv.enumeration(SessionsImportsRetrieveTemplateParams.ImportType::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsImportsRetrieveTemplateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsImportsRetrieveTemplateParams from) { + super(from); + } + + /** + * The import_type field. + * + * @param importType the value + * @return this builder + */ + public Builder importType(SessionsImportsRetrieveTemplateParams.ImportType importType) { + return set("import_type", Conv.enumeration(SessionsImportsRetrieveTemplateParams.ImportType::of), importType); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsImportsRetrieveTemplateParams} + */ + public SessionsImportsRetrieveTemplateParams build() { + return new SessionsImportsRetrieveTemplateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ImportType extends StringEnum { + /** The value {@code "user_verification"}. */ + public static final ImportType USER_VERIFICATION = new ImportType("user_verification"); + + /** The value {@code "business_verification"}. */ + public static final ImportType BUSINESS_VERIFICATION = new ImportType("business_verification"); + + /** The value {@code "status_rules"}. */ + public static final ImportType STATUS_RULES = new ImportType("status_rules"); + + /** The value {@code "transactions"}. */ + public static final ImportType TRANSACTIONS = new ImportType("transactions"); + + private static final List KNOWN_VALUES = List.of(USER_VERIFICATION, BUSINESS_VERIFICATION, STATUS_RULES, TRANSACTIONS); + + private ImportType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ImportType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ImportType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsListNetworksResponse.java b/src/main/java/me/didit/types/SessionsListNetworksResponse.java new file mode 100644 index 0000000..1fbdc46 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsListNetworksResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class SessionsListNetworksResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private SessionsListNetworksResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsListNetworksResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsListNetworksResponse fromJson(JsonNode json) { + return new SessionsListNetworksResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(EntityNetworkMembership::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsListNetworksResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsListNetworksResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(EntityNetworkMembership::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsListNetworksResponse} + */ + public SessionsListNetworksResponse build() { + return new SessionsListNetworksResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsListParams.java b/src/main/java/me/didit/types/SessionsListParams.java new file mode 100644 index 0000000..b2e5ba6 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsListParams.java @@ -0,0 +1,635 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.list}. */ +public final class SessionsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_kind", "limit", "offset", "status", "vendor_data", "search", "workflow_id", "date_from", "date_to", "country", "document_type", "document_name", "region", "didit_internal_id", "session_type", "api_service", "screened_full_name", "warning", "status_initialized_as_in_review", "is_kyc_to_be_reviewed", "euuid", "organization_name"); + + private SessionsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsListParams fromJson(JsonNode json) { + return new SessionsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Which kind of sessions to list: user (KYC only, default), business (KYB only), or all (both, concatenated - see the description for merged-pagination semantics). Matching is case-insensitive (BUSINESS works); any value other than a case variant of user/business/all returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionKind() { + return Json.optional(json, "session_kind", Conv.enumeration(SessionsListParams.SessionKind::of)); + } + + /** + * Maximum number of rows per page (per kind when session_kind=all). Defaults to 50. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Number of rows to skip before the first returned row. Defaults to 0. Prefer following the next/previous URLs from the response. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + /** + * Comma-separated list of session statuses to include, e.g. Approved,In Review. Values are case-sensitive; see [Verification Statuses](/integration/verification-statuses). Unknown values match nothing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Exact-match filter on the vendor_data you sent at session creation (your own user/business identifier). For partial matches use search instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Smart free-text search. A full UUID matches session_id; numeric input matches session-number prefix, document/personal numbers, phone prefix, or vendor_data; input containing @ matches email prefixes; other text matches names (accent-insensitive) and vendor_data. Free text containing digits additionally matches document/personal-number search fields and session-number prefixes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional search() { + return Json.optional(json, "search", Conv.STRING); + } + + /** + * Comma-separated workflow UUIDs (find them on the Workflows page in the Console). Malformed UUIDs in the list are ignored; if none are valid the result is empty. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowId() { + return Json.optional(json, "workflow_id", Conv.STRING); + } + + /** + * Only sessions created on or after this date (UTC), format YYYY-MM-DD. Malformed dates return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateFrom() { + return Json.optional(json, "date_from", Conv.DATE); + } + + /** + * Only sessions created up to this date (UTC), format YYYY-MM-DD. For KYC rows the entire day is included; for KYB rows the comparison is created_at <= date_to (midnight), so use the next day's date to include a full day of KYB sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateTo() { + return Json.optional(json, "date_to", Conv.DATE); + } + + /** + * Comma-separated country filter. For KYC rows: ISO 3166-1 alpha-3 codes of the ID document's issuing state (e.g. ESP,USA), which may differ from nationality. For KYB rows: the registry company's country code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Comma-separated ID-document type codes verified in the session (KYC rows only): P (Passport), ID (Identity Card), DL (Driver's License), RP (Residence Permit), SSC (Social Security Card), HIC (Health Insurance Card), WP (Work Permit), TC (Tax Card), VISA, PSC (Public Service Card), BC (Birth Certificate), OTHER. Note the response field document_type contains the display name, not the code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * Exact document names; multiple names can be passed comma-separated, but the value is only split on commas when it contains more than one - separator (a lone name with an embedded comma is matched whole). Names are as recognized by document verification (front or back side), e.g. Spain - Id Card (2021). KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentName() { + return Json.optional(json, "document_name", Conv.STRING); + } + + /** + * Comma-separated document region/state values (for documents issued per region, such as US driver's licenses). KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * Filter by Didit's internal user identifier (the didit_internal_id response field) to list all sessions of one verified user. Must be a valid UUID; malformed values return 400. KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Comma-separated session creation channels: API, HOSTED, MIGRATED. The special value ALL (or omitting the parameter) disables the filter. KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionType() { + return Json.optional(json, "session_type", Conv.STRING); + } + + /** + * Filter standalone API sessions by service. Invalid values return 400. KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.enumeration(SessionsListParams.ApiService::of)); + } + + /** + * Accent-insensitive name search inside AML and database-validation screened data. When combined with api_service=AML or api_service=DATABASE_VALIDATION, the search is restricted to that feature's screened data. KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedFullName() { + return Json.optional(json, "screened_full_name", Conv.STRING); + } + + /** + * Comma-separated warning risk codes; returns sessions that raised any of them (e.g. POSSIBLE_FRAUD). Risk codes are listed per feature in the [warnings documentation](/integration/webhooks). Applies to KYC rows and, with business warning codes, to KYB rows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional warning() { + return Json.optional(json, "warning", Conv.STRING); + } + + /** + * When true, only sessions whose decision initially landed in In Review (useful to audit manual-review volume). KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional statusInitializedAsInReview() { + return Json.optional(json, "status_initialized_as_in_review", Conv.BOOLEAN); + } + + /** + * true returns sessions whose document verification is flagged for manual review; false returns sessions with document verification explicitly not flagged. Omit to disable. KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isKycToBeReviewed() { + return Json.optional(json, "is_kyc_to_be_reviewed", Conv.BOOLEAN); + } + + /** + * Filter by the end user's euuid (UUID assigned to the verifying user, used by Console deep links). Must be a valid UUID; malformed values return a 400 field error. KYC rows only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional euuid() { + return Json.optional(json, "euuid", Conv.STRING); + } + + /** + * Comma-separated organization names. Console-oriented; with an API key (already scoped to one application) it only matches your own organization's name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organizationName() { + return Json.optional(json, "organization_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsListParams from) { + super(from); + } + + /** + * Which kind of sessions to list: user (KYC only, default), business (KYB only), or all (both, concatenated - see the description for merged-pagination semantics). Matching is case-insensitive (BUSINESS works); any value other than a case variant of user/business/all returns 400. + * + * @param sessionKind the value + * @return this builder + */ + public Builder sessionKind(SessionsListParams.SessionKind sessionKind) { + return set("session_kind", Conv.enumeration(SessionsListParams.SessionKind::of), sessionKind); + } + + /** + * Maximum number of rows per page (per kind when session_kind=all). Defaults to 50. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Number of rows to skip before the first returned row. Defaults to 0. Prefer following the next/previous URLs from the response. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Comma-separated list of session statuses to include, e.g. Approved,In Review. Values are case-sensitive; see [Verification Statuses](/integration/verification-statuses). Unknown values match nothing. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Exact-match filter on the vendor_data you sent at session creation (your own user/business identifier). For partial matches use search instead. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Smart free-text search. A full UUID matches session_id; numeric input matches session-number prefix, document/personal numbers, phone prefix, or vendor_data; input containing @ matches email prefixes; other text matches names (accent-insensitive) and vendor_data. Free text containing digits additionally matches document/personal-number search fields and session-number prefixes. + * + * @param search the value + * @return this builder + */ + public Builder search(String search) { + return set("search", Conv.STRING, search); + } + + /** + * Comma-separated workflow UUIDs (find them on the Workflows page in the Console). Malformed UUIDs in the list are ignored; if none are valid the result is empty. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * Only sessions created on or after this date (UTC), format YYYY-MM-DD. Malformed dates return 400. + * + * @param dateFrom the value + * @return this builder + */ + public Builder dateFrom(LocalDate dateFrom) { + return set("date_from", Conv.DATE, dateFrom); + } + + /** + * Only sessions created up to this date (UTC), format YYYY-MM-DD. For KYC rows the entire day is included; for KYB rows the comparison is created_at <= date_to (midnight), so use the next day's date to include a full day of KYB sessions. + * + * @param dateTo the value + * @return this builder + */ + public Builder dateTo(LocalDate dateTo) { + return set("date_to", Conv.DATE, dateTo); + } + + /** + * Comma-separated country filter. For KYC rows: ISO 3166-1 alpha-3 codes of the ID document's issuing state (e.g. ESP,USA), which may differ from nationality. For KYB rows: the registry company's country code. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Comma-separated ID-document type codes verified in the session (KYC rows only): P (Passport), ID (Identity Card), DL (Driver's License), RP (Residence Permit), SSC (Social Security Card), HIC (Health Insurance Card), WP (Work Permit), TC (Tax Card), VISA, PSC (Public Service Card), BC (Birth Certificate), OTHER. Note the response field document_type contains the display name, not the code. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * Exact document names; multiple names can be passed comma-separated, but the value is only split on commas when it contains more than one - separator (a lone name with an embedded comma is matched whole). Names are as recognized by document verification (front or back side), e.g. Spain - Id Card (2021). KYC rows only. + * + * @param documentName the value + * @return this builder + */ + public Builder documentName(String documentName) { + return set("document_name", Conv.STRING, documentName); + } + + /** + * Comma-separated document region/state values (for documents issued per region, such as US driver's licenses). KYC rows only. + * + * @param region the value + * @return this builder + */ + public Builder region(String region) { + return set("region", Conv.STRING, region); + } + + /** + * Filter by Didit's internal user identifier (the didit_internal_id response field) to list all sessions of one verified user. Must be a valid UUID; malformed values return 400. KYC rows only. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Comma-separated session creation channels: API, HOSTED, MIGRATED. The special value ALL (or omitting the parameter) disables the filter. KYC rows only. + * + * @param sessionType the value + * @return this builder + */ + public Builder sessionType(String sessionType) { + return set("session_type", Conv.STRING, sessionType); + } + + /** + * Filter standalone API sessions by service. Invalid values return 400. KYC rows only. + * + * @param apiService the value + * @return this builder + */ + public Builder apiService(SessionsListParams.ApiService apiService) { + return set("api_service", Conv.enumeration(SessionsListParams.ApiService::of), apiService); + } + + /** + * Accent-insensitive name search inside AML and database-validation screened data. When combined with api_service=AML or api_service=DATABASE_VALIDATION, the search is restricted to that feature's screened data. KYC rows only. + * + * @param screenedFullName the value + * @return this builder + */ + public Builder screenedFullName(String screenedFullName) { + return set("screened_full_name", Conv.STRING, screenedFullName); + } + + /** + * Comma-separated warning risk codes; returns sessions that raised any of them (e.g. POSSIBLE_FRAUD). Risk codes are listed per feature in the [warnings documentation](/integration/webhooks). Applies to KYC rows and, with business warning codes, to KYB rows. + * + * @param warning the value + * @return this builder + */ + public Builder warning(String warning) { + return set("warning", Conv.STRING, warning); + } + + /** + * When true, only sessions whose decision initially landed in In Review (useful to audit manual-review volume). KYC rows only. + * + * @param statusInitializedAsInReview the value + * @return this builder + */ + public Builder statusInitializedAsInReview(boolean statusInitializedAsInReview) { + return set("status_initialized_as_in_review", Conv.BOOLEAN, statusInitializedAsInReview); + } + + /** + * true returns sessions whose document verification is flagged for manual review; false returns sessions with document verification explicitly not flagged. Omit to disable. KYC rows only. + * + * @param isKycToBeReviewed the value + * @return this builder + */ + public Builder isKycToBeReviewed(boolean isKycToBeReviewed) { + return set("is_kyc_to_be_reviewed", Conv.BOOLEAN, isKycToBeReviewed); + } + + /** + * Filter by the end user's euuid (UUID assigned to the verifying user, used by Console deep links). Must be a valid UUID; malformed values return a 400 field error. KYC rows only. + * + * @param euuid the value + * @return this builder + */ + public Builder euuid(String euuid) { + return set("euuid", Conv.STRING, euuid); + } + + /** + * Comma-separated organization names. Console-oriented; with an API key (already scoped to one application) it only matches your own organization's name. + * + * @param organizationName the value + * @return this builder + */ + public Builder organizationName(String organizationName) { + return set("organization_name", Conv.STRING, organizationName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsListParams} + */ + public SessionsListParams build() { + return new SessionsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SessionKind extends StringEnum { + /** The value {@code "user"}. */ + public static final SessionKind USER = new SessionKind("user"); + + /** The value {@code "business"}. */ + public static final SessionKind BUSINESS = new SessionKind("business"); + + /** The value {@code "all"}. */ + public static final SessionKind ALL = new SessionKind("all"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS, ALL); + + private SessionKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SessionKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SessionKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ApiService extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final ApiService ID_VERIFICATION = new ApiService("ID_VERIFICATION"); + + /** The value {@code "FACE_MATCH"}. */ + public static final ApiService FACE_MATCH = new ApiService("FACE_MATCH"); + + /** The value {@code "AGE_ESTIMATION"}. */ + public static final ApiService AGE_ESTIMATION = new ApiService("AGE_ESTIMATION"); + + /** The value {@code "FACE_SEARCH"}. */ + public static final ApiService FACE_SEARCH = new ApiService("FACE_SEARCH"); + + /** The value {@code "POA"}. */ + public static final ApiService POA = new ApiService("POA"); + + /** The value {@code "AML"}. */ + public static final ApiService AML = new ApiService("AML"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final ApiService KYB_REGISTRY = new ApiService("KYB_REGISTRY"); + + /** The value {@code "PASSIVE_LIVENESS"}. */ + public static final ApiService PASSIVE_LIVENESS = new ApiService("PASSIVE_LIVENESS"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final ApiService DATABASE_VALIDATION = new ApiService("DATABASE_VALIDATION"); + + /** The value {@code "PHONE_VERIFICATION"}. */ + public static final ApiService PHONE_VERIFICATION = new ApiService("PHONE_VERIFICATION"); + + /** The value {@code "EMAIL_VERIFICATION"}. */ + public static final ApiService EMAIL_VERIFICATION = new ApiService("EMAIL_VERIFICATION"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, FACE_MATCH, AGE_ESTIMATION, FACE_SEARCH, POA, AML, KYB_REGISTRY, PASSIVE_LIVENESS, DATABASE_VALIDATION, PHONE_VERIFICATION, EMAIL_VERIFICATION); + + private ApiService(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ApiService of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ApiService::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsListResponse.java b/src/main/java/me/didit/types/SessionsListResponse.java new file mode 100644 index 0000000..41c577d --- /dev/null +++ b/src/main/java/me/didit/types/SessionsListResponse.java @@ -0,0 +1,3044 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private SessionsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsListResponse fromJson(JsonNode json) { + return new SessionsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of sessions matching the filters. Exact for KYC rows; for KYB rows it is capped at 100 (use next to know whether more pages exist). For session_kind=all it is the sum of both kinds. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long count() { + return Json.required(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * Session rows, newest first. With session_kind=all, KYC rows come first, then KYB rows. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.union(SessionsListResponse.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsListResponse from) { + super(from); + } + + /** + * Number of sessions matching the filters. Exact for KYC rows; for KYB rows it is capped at 100 (use next to know whether more pages exist). For session_kind=all it is the sum of both kinds. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * Session rows, newest first. With session_kind=all, KYC rows come first, then KYB rows. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.union(SessionsListResponse.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsListResponse} + * @throws IllegalStateException when a required field is missing + */ + public SessionsListResponse build() { + require("count", false); + require("next", true); + require("previous", true); + require("results", false); + return new SessionsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

One of: {@code User}, {@code Business}. Check with the {@code is...} + * methods and read with the {@code as...} methods; the fields every variant has are readable directly. + */ + public static final class Results extends JsonUnion { + private Results(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Results} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Results fromJson(JsonNode json) { + return new Results(json.deepCopy()); + } + + /** + * Unique identifier of the verification session. Use it with GET /v3/session/{sessionId}/decision/ to fetch the full decision payload. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sessionId() { + return Json.required(json, "session_id", Conv.STRING); + } + + /** + * Row discriminator. Always "user" for KYC rows; Business Verification (KYB) rows have "business" and a different shape. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sessionKind() { + return Json.required(json, "session_kind", Conv.STRING); + } + + /** + * Human-friendly sequential number of the session within your application. Also matched by the search parameter. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long sessionNumber() { + return Json.required(json, "session_number", Conv.LONG); + } + + /** + * ISO 3166-1 alpha-3 country associated with the session, resolved in order: ID document issuing state, database-validation issuing state, proof-of-address issuing state, expected details, then the verified phone's country. May differ from nationality. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page for the lifecycle. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String status() { + return Json.required(json, "status", Conv.STRING); + } + + /** + * Your own identifier for the end user, echoed back exactly as sent at session creation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * UTC timestamp when the session was created. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * Wraps a {@code User} value. + * + * @param value the value + * @return the union + */ + public static Results ofUser(SessionsListResponse.Results.User value) { + return new Results(Conv.model(SessionsListResponse.Results.User::fromJson).write(value)); + } + + /** + * Whether this value is a {@code User}. + * + * Summary row for a User Verification (KYC) session. Identity fields (full_name, country, document_type, portrait_image, contact fields) are populated progressively as the user completes verification steps, and are null until the relevant step finishes. Fields restricted by the workflow's response-attributes configuration are also returned as null. + * + * @return true when it matches + */ + public boolean isUser() { + return Json.hasValue(json, "session_kind", "user"); + } + + /** + * Reads this value as a {@code User}. + * + * @return the value, or empty when {@link #isUser()} is false + */ + public Optional asUser() { + return isUser() ? Optional.of(Conv.model(SessionsListResponse.Results.User::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Business} value. + * + * @param value the value + * @return the union + */ + public static Results ofBusiness(SessionsListResponse.Results.Business value) { + return new Results(Conv.model(SessionsListResponse.Results.Business::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Business}. + * + * Summary row for a Business Verification (KYB) session. Returned only when session_kind is business or all. + * + * @return true when it matches + */ + public boolean isBusiness() { + return Json.hasValue(json, "session_kind", "business"); + } + + /** + * Reads this value as a {@code Business}. + * + * @return the value, or empty when {@link #isBusiness()} is false + */ + public Optional asBusiness() { + return isBusiness() ? Optional.of(Conv.model(SessionsListResponse.Results.Business::fromJson).read(json)) : Optional.empty(); + } + + /** + * Summary row for a User Verification (KYC) session. Identity fields (full_name, country, document_type, portrait_image, contact fields) are populated progressively as the user completes verification steps, and are null until the relevant step finishes. Fields restricted by the workflow's response-attributes configuration are also returned as null. + */ + public static final class User extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_kind", "session_number", "session_url", "portrait_image", "document_type", "full_name", "country", "status", "vendor_data", "didit_internal_id", "created_at", "features", "phone_number", "email_address", "additional_details"); + + private User(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code User} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static User fromJson(JsonNode json) { + return new User(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier of the verification session. Use it with GET /v3/session/{sessionId}/decision/ to fetch the full decision payload. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sessionId() { + return Json.required(json, "session_id", Conv.STRING); + } + + /** + * Row discriminator. Always "user" for KYC rows; Business Verification (KYB) rows have "business" and a different shape. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsListResponse.Results.User.SessionKind sessionKind() { + return Json.required(json, "session_kind", Conv.enumeration(SessionsListResponse.Results.User.SessionKind::of)); + } + + /** + * Human-friendly sequential number of the session within your application. Also matched by the search parameter. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long sessionNumber() { + return Json.required(json, "session_number", Conv.LONG); + } + + /** + * Hosted verification URL the end user opens to complete the flow. null when the session has no hosted URL. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionUrl() { + return Json.optional(json, "session_url", Conv.STRING); + } + + /** + * Expiring (presigned) URL of the best available portrait: the NFC chip photo when available, otherwise the ID document portrait, otherwise the liveness reference image. null until one of those exists. Download promptly; the link expires. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImage() { + return Json.optional(json, "portrait_image", Conv.STRING); + } + + /** + * Human-readable type of the verified ID document. null before document verification completes, and also null after completion when the verified code has no display mapping (SSC, WP, VISA, PSC, BC, OTHER). Note: the document_type query parameter filters by short codes (P, ID, DL, RP, ...), not by these display values. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(SessionsListResponse.Results.User.DocumentType::of)); + } + + /** + * Best available full name for the session, resolved in order: ID document OCR, AML screened data, database-validation screened data, proof-of-address document, then the expected details provided at session creation. null when none is available yet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country associated with the session, resolved in order: ID document issuing state, database-validation issuing state, proof-of-address issuing state, expected details, then the verified phone's country. May differ from nationality. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page for the lifecycle. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsListResponse.Results.User.Status status() { + return Json.required(json, "status", Conv.enumeration(SessionsListResponse.Results.User.Status::of)); + } + + /** + * Your own identifier for the end user, echoed back exactly as sent at session creation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Didit's internal identifier for the verified user profile behind this session. Stable across multiple sessions of the same user; filterable via the didit_internal_id query parameter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * UTC timestamp when the session was created. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * Per-feature status for every verification step configured in the session's workflow, in workflow order. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List features() { + return Json.required(json, "features", Conv.list(Conv.model(SessionsListResponse.Results.User.Features::fromJson))); + } + + /** + * Phone associated with the session: the verified phone when phone verification ran, otherwise the contact phone provided at session creation. null when neither exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.model(SessionsListResponse.Results.User.PhoneNumber::fromJson)); + } + + /** + * Email associated with the session: the verified email when email verification ran, otherwise the contact email provided at session creation. null when neither exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailAddress() { + return Json.optional(json, "email_address", Conv.model(SessionsListResponse.Results.User.EmailAddress::fromJson)); + } + + /** + * Compact per-feature extras. Only features that produced data appear as keys; null when no feature produced extras. Fields excluded by the workflow's response-attributes configuration are omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional additionalDetails() { + return Json.optional(json, "additional_details", Conv.model(SessionsListResponse.Results.User.AdditionalDetails::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link User}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(User from) { + super(from); + } + + /** + * Unique identifier of the verification session. Use it with GET /v3/session/{sessionId}/decision/ to fetch the full decision payload. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Row discriminator. Always "user" for KYC rows; Business Verification (KYB) rows have "business" and a different shape. + * + * @param sessionKind the value + * @return this builder + */ + public Builder sessionKind(SessionsListResponse.Results.User.SessionKind sessionKind) { + return set("session_kind", Conv.enumeration(SessionsListResponse.Results.User.SessionKind::of), sessionKind); + } + + /** + * Human-friendly sequential number of the session within your application. Also matched by the search parameter. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * Hosted verification URL the end user opens to complete the flow. null when the session has no hosted URL. + * + * @param sessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionUrl(@Nullable String sessionUrl) { + return setNullable("session_url", Conv.STRING, sessionUrl); + } + + /** + * Expiring (presigned) URL of the best available portrait: the NFC chip photo when available, otherwise the ID document portrait, otherwise the liveness reference image. null until one of those exists. Download promptly; the link expires. + * + * @param portraitImage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder portraitImage(@Nullable String portraitImage) { + return setNullable("portrait_image", Conv.STRING, portraitImage); + } + + /** + * Human-readable type of the verified ID document. null before document verification completes, and also null after completion when the verified code has no display mapping (SSC, WP, VISA, PSC, BC, OTHER). Note: the document_type query parameter filters by short codes (P, ID, DL, RP, ...), not by these display values. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(SessionsListResponse.Results.User.@Nullable DocumentType documentType) { + return setNullable("document_type", Conv.enumeration(SessionsListResponse.Results.User.DocumentType::of), documentType); + } + + /** + * Best available full name for the session, resolved in order: ID document OCR, AML screened data, database-validation screened data, proof-of-address document, then the expected details provided at session creation. null when none is available yet. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * ISO 3166-1 alpha-3 country associated with the session, resolved in order: ID document issuing state, database-validation issuing state, proof-of-address issuing state, expected details, then the verified phone's country. May differ from nationality. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page for the lifecycle. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsListResponse.Results.User.Status status) { + return set("status", Conv.enumeration(SessionsListResponse.Results.User.Status::of), status); + } + + /** + * Your own identifier for the end user, echoed back exactly as sent at session creation. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Didit's internal identifier for the verified user profile behind this session. Stable across multiple sessions of the same user; filterable via the didit_internal_id query parameter. + * + * @param diditInternalId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder diditInternalId(@Nullable String diditInternalId) { + return setNullable("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * UTC timestamp when the session was created. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Per-feature status for every verification step configured in the session's workflow, in workflow order. + * + * @param features the value + * @return this builder + */ + public Builder features(List features) { + return set("features", Conv.list(Conv.model(SessionsListResponse.Results.User.Features::fromJson)), features); + } + + /** + * Phone associated with the session: the verified phone when phone verification ran, otherwise the contact phone provided at session creation. null when neither exists. + * + * @param phoneNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneNumber(SessionsListResponse.Results.User.@Nullable PhoneNumber phoneNumber) { + return setNullable("phone_number", Conv.model(SessionsListResponse.Results.User.PhoneNumber::fromJson), phoneNumber); + } + + /** + * Email associated with the session: the verified email when email verification ran, otherwise the contact email provided at session creation. null when neither exists. + * + * @param emailAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder emailAddress(SessionsListResponse.Results.User.@Nullable EmailAddress emailAddress) { + return setNullable("email_address", Conv.model(SessionsListResponse.Results.User.EmailAddress::fromJson), emailAddress); + } + + /** + * Compact per-feature extras. Only features that produced data appear as keys; null when no feature produced extras. Fields excluded by the workflow's response-attributes configuration are omitted. + * + * @param additionalDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalDetails(SessionsListResponse.Results.User.@Nullable AdditionalDetails additionalDetails) { + return setNullable("additional_details", Conv.model(SessionsListResponse.Results.User.AdditionalDetails::fromJson), additionalDetails); + } + + /** + * Builds the value. + * + * @return a new immutable {@code User} + * @throws IllegalStateException when a required field is missing + */ + public User build() { + require("session_id", false); + require("session_kind", false); + require("session_number", false); + require("session_url", true); + require("portrait_image", true); + require("document_type", true); + require("full_name", true); + require("country", true); + require("status", false); + require("vendor_data", true); + require("didit_internal_id", true); + require("created_at", false); + require("features", false); + require("phone_number", true); + require("email_address", true); + require("additional_details", true); + return new User(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Row discriminator. Always "user" for KYC rows; Business Verification (KYB) rows have "business" and a different shape. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SessionKind extends StringEnum { + /** The value {@code "user"}. */ + public static final SessionKind USER = new SessionKind("user"); + + private static final List KNOWN_VALUES = List.of(USER); + + private SessionKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SessionKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SessionKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Human-readable type of the verified ID document. null before document verification completes, and also null after completion when the verified code has no display mapping (SSC, WP, VISA, PSC, BC, OTHER). Note: the document_type query parameter filters by short codes (P, ID, DL, RP, ...), not by these display values. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "Passport"}. */ + public static final DocumentType PASSPORT = new DocumentType("Passport"); + + /** The value {@code "Identity Card"}. */ + public static final DocumentType IDENTITY_CARD = new DocumentType("Identity Card"); + + /** The value {@code "Driver's License"}. */ + public static final DocumentType DRIVER_S_LICENSE = new DocumentType("Driver's License"); + + /** The value {@code "Residence Permit"}. */ + public static final DocumentType RESIDENCE_PERMIT = new DocumentType("Residence Permit"); + + /** The value {@code "Health Insurance Card"}. */ + public static final DocumentType HEALTH_INSURANCE_CARD = new DocumentType("Health Insurance Card"); + + /** The value {@code "Tax Card"}. */ + public static final DocumentType TAX_CARD = new DocumentType("Tax Card"); + + private static final List KNOWN_VALUES = List.of(PASSPORT, IDENTITY_CARD, DRIVER_S_LICENSE, RESIDENCE_PERMIT, HEALTH_INSURANCE_CARD, TAX_CARD); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page for the lifecycle. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final Status NOT_STARTED = new Status("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final Status IN_PROGRESS = new Status("In Progress"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final Status ABANDONED = new Status("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final Status KYC_EXPIRED = new Status("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final Status RESUBMITTED = new Status("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final Status AWAITING_USER = new Status("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Features extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "status"); + + private Features(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Features} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Features fromJson(JsonNode json) { + return new Features(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Verification feature identifier. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsListResponse.Results.User.Features.Feature feature() { + return Json.required(json, "feature", Conv.enumeration(SessionsListResponse.Results.User.Features.Feature::of)); + } + + /** + * Status of this feature. Not Finished until the step completes. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsListResponse.Results.User.Features.Status status() { + return Json.required(json, "status", Conv.enumeration(SessionsListResponse.Results.User.Features.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Features}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Features from) { + super(from); + } + + /** + * Verification feature identifier. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsListResponse.Results.User.Features.Feature feature) { + return set("feature", Conv.enumeration(SessionsListResponse.Results.User.Features.Feature::of), feature); + } + + /** + * Status of this feature. Not Finished until the step completes. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsListResponse.Results.User.Features.Status status) { + return set("status", Conv.enumeration(SessionsListResponse.Results.User.Features.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Features} + * @throws IllegalStateException when a required field is missing + */ + public Features build() { + require("feature", false); + require("status", false); + return new Features(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Verification feature identifier. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACE_MATCH"}. */ + public static final Feature FACE_MATCH = new Feature("FACE_MATCH"); + + /** The value {@code "POA"}. */ + public static final Feature POA = new Feature("POA"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "EMAIL_VERIFICATION"}. */ + public static final Feature EMAIL_VERIFICATION = new Feature("EMAIL_VERIFICATION"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "IP_ANALYSIS"}. */ + public static final Feature IP_ANALYSIS = new Feature("IP_ANALYSIS"); + + /** The value {@code "AGE_ESTIMATION"}. */ + public static final Feature AGE_ESTIMATION = new Feature("AGE_ESTIMATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, QUESTIONNAIRE, EMAIL_VERIFICATION, PHONE, AML, IP_ANALYSIS, AGE_ESTIMATION, DATABASE_VALIDATION); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status of this feature. Not Finished until the step completes. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Phone associated with the session: the verified phone when phone verification ran, otherwise the contact phone provided at session creation. null when neither exists. + */ + public static final class PhoneNumber extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("number", "is_verified"); + + private PhoneNumber(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneNumber} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneNumber fromJson(JsonNode json) { + return new PhoneNumber(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Phone number in E.164 format. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String number() { + return Json.required(json, "number", Conv.STRING); + } + + /** + * true only when the phone-verification feature approved this number. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isVerified() { + return Json.required(json, "is_verified", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneNumber}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneNumber from) { + super(from); + } + + /** + * Phone number in E.164 format. + * + * @param number the value + * @return this builder + */ + public Builder number(String number) { + return set("number", Conv.STRING, number); + } + + /** + * true only when the phone-verification feature approved this number. + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneNumber} + * @throws IllegalStateException when a required field is missing + */ + public PhoneNumber build() { + require("number", false); + require("is_verified", false); + return new PhoneNumber(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Email associated with the session: the verified email when email verification ran, otherwise the contact email provided at session creation. null when neither exists. + */ + public static final class EmailAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "is_verified"); + + private EmailAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailAddress fromJson(JsonNode json) { + return new EmailAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The email field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * true only when the email-verification feature approved this address. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isVerified() { + return Json.required(json, "is_verified", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailAddress from) { + super(from); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * true only when the email-verification feature approved this address. + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailAddress} + * @throws IllegalStateException when a required field is missing + */ + public EmailAddress build() { + require("email", false); + require("is_verified", false); + return new EmailAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Compact per-feature extras. Only features that produced data appear as keys; null when no feature produced extras. Fields excluded by the workflow's response-attributes configuration are omitted. + */ + public static final class AdditionalDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("aml", "database_validation", "poa", "liveness", "face_match", "phone_verification", "email_verification"); + + private AdditionalDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AdditionalDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AdditionalDetails fromJson(JsonNode json) { + return new AdditionalDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Present when AML screening ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional aml() { + return Json.optional(json, "aml", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Aml::fromJson)); + } + + /** + * Present when database validation ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional databaseValidation() { + return Json.optional(json, "database_validation", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.DatabaseValidation::fromJson)); + } + + /** + * Present when proof of address ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poa() { + return Json.optional(json, "poa", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Poa::fromJson)); + } + + /** + * Present when a liveness check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional liveness() { + return Json.optional(json, "liveness", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Liveness::fromJson)); + } + + /** + * Present when face match ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatch() { + return Json.optional(json, "face_match", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.FaceMatch::fromJson)); + } + + /** + * Present when phone verification ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneVerification() { + return Json.optional(json, "phone_verification", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.PhoneVerification::fromJson)); + } + + /** + * Present when email verification ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailVerification() { + return Json.optional(json, "email_verification", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.EmailVerification::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AdditionalDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AdditionalDetails from) { + super(from); + } + + /** + * Present when AML screening ran. + * + * @param aml the value + * @return this builder + */ + public Builder aml(SessionsListResponse.Results.User.AdditionalDetails.Aml aml) { + return set("aml", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Aml::fromJson), aml); + } + + /** + * Present when database validation ran. + * + * @param databaseValidation the value + * @return this builder + */ + public Builder databaseValidation(SessionsListResponse.Results.User.AdditionalDetails.DatabaseValidation databaseValidation) { + return set("database_validation", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.DatabaseValidation::fromJson), databaseValidation); + } + + /** + * Present when proof of address ran. + * + * @param poa the value + * @return this builder + */ + public Builder poa(SessionsListResponse.Results.User.AdditionalDetails.Poa poa) { + return set("poa", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Poa::fromJson), poa); + } + + /** + * Present when a liveness check ran. + * + * @param liveness the value + * @return this builder + */ + public Builder liveness(SessionsListResponse.Results.User.AdditionalDetails.Liveness liveness) { + return set("liveness", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Liveness::fromJson), liveness); + } + + /** + * Present when face match ran. + * + * @param faceMatch the value + * @return this builder + */ + public Builder faceMatch(SessionsListResponse.Results.User.AdditionalDetails.FaceMatch faceMatch) { + return set("face_match", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.FaceMatch::fromJson), faceMatch); + } + + /** + * Present when phone verification ran. + * + * @param phoneVerification the value + * @return this builder + */ + public Builder phoneVerification(SessionsListResponse.Results.User.AdditionalDetails.PhoneVerification phoneVerification) { + return set("phone_verification", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.PhoneVerification::fromJson), phoneVerification); + } + + /** + * Present when email verification ran. + * + * @param emailVerification the value + * @return this builder + */ + public Builder emailVerification(SessionsListResponse.Results.User.AdditionalDetails.EmailVerification emailVerification) { + return set("email_verification", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.EmailVerification::fromJson), emailVerification); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AdditionalDetails} + */ + public AdditionalDetails build() { + return new AdditionalDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Present when AML screening ran. */ + public static final class Aml extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total_hits", "entity_type", "is_adverse_media_fetched", "screened_data"); + + private Aml(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Aml} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Aml fromJson(JsonNode json) { + return new Aml(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of AML screening hits. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalHits() { + return Json.optional(json, "total_hits", Conv.LONG); + } + + /** + * Screened entity type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * The is_adverse_media_fetched field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isAdverseMediaFetched() { + return Json.optional(json, "is_adverse_media_fetched", Conv.BOOLEAN); + } + + /** + * Subset of the data that was screened. Only non-empty keys are included. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedData() { + return Json.optional(json, "screened_data", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Aml.ScreenedData::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Aml}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Aml from) { + super(from); + } + + /** + * Number of AML screening hits. + * + * @param totalHits the value + * @return this builder + */ + public Builder totalHits(long totalHits) { + return set("total_hits", Conv.LONG, totalHits); + } + + /** + * Screened entity type. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * The is_adverse_media_fetched field. + * + * @param isAdverseMediaFetched the value + * @return this builder + */ + public Builder isAdverseMediaFetched(boolean isAdverseMediaFetched) { + return set("is_adverse_media_fetched", Conv.BOOLEAN, isAdverseMediaFetched); + } + + /** + * Subset of the data that was screened. Only non-empty keys are included. + * + * @param screenedData the value + * @return this builder + */ + public Builder screenedData(SessionsListResponse.Results.User.AdditionalDetails.Aml.ScreenedData screenedData) { + return set("screened_data", Conv.model(SessionsListResponse.Results.User.AdditionalDetails.Aml.ScreenedData::fromJson), screenedData); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Aml} + */ + public Aml build() { + return new Aml(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Subset of the data that was screened. Only non-empty keys are included. */ + public static final class ScreenedData extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("nationality", "document_number", "date_of_birth"); + + private ScreenedData(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScreenedData} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScreenedData fromJson(JsonNode json) { + return new ScreenedData(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScreenedData}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScreenedData from) { + super(from); + } + + /** + * The nationality field. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * The document_number field. + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(String dateOfBirth) { + return set("date_of_birth", Conv.STRING, dateOfBirth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScreenedData} + */ + public ScreenedData build() { + return new ScreenedData(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** Present when database validation ran. */ + public static final class DatabaseValidation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("validation_type", "match_type", "identification_number"); + + private DatabaseValidation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DatabaseValidation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DatabaseValidation fromJson(JsonNode json) { + return new DatabaseValidation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The validation_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validationType() { + return Json.optional(json, "validation_type", Conv.STRING); + } + + /** + * The match_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchType() { + return Json.optional(json, "match_type", Conv.STRING); + } + + /** + * Tax, personal, or document number that was validated (first available). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identificationNumber() { + return Json.optional(json, "identification_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DatabaseValidation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DatabaseValidation from) { + super(from); + } + + /** + * The validation_type field. + * + * @param validationType the value + * @return this builder + */ + public Builder validationType(String validationType) { + return set("validation_type", Conv.STRING, validationType); + } + + /** + * The match_type field. + * + * @param matchType the value + * @return this builder + */ + public Builder matchType(String matchType) { + return set("match_type", Conv.STRING, matchType); + } + + /** + * Tax, personal, or document number that was validated (first available). + * + * @param identificationNumber the value + * @return this builder + */ + public Builder identificationNumber(String identificationNumber) { + return set("identification_number", Conv.STRING, identificationNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DatabaseValidation} + */ + public DatabaseValidation build() { + return new DatabaseValidation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Present when proof of address ran. */ + public static final class Poa extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("document_type", "issuer", "address", "name_on_document"); + + private Poa(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Poa} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Poa fromJson(JsonNode json) { + return new Poa(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The issuer field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + /** + * The address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * The name_on_document field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameOnDocument() { + return Json.optional(json, "name_on_document", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Poa}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Poa from) { + super(from); + } + + /** + * The document_type field. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * The issuer field. + * + * @param issuer the value + * @return this builder + */ + public Builder issuer(String issuer) { + return set("issuer", Conv.STRING, issuer); + } + + /** + * The address field. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * The name_on_document field. + * + * @param nameOnDocument the value + * @return this builder + */ + public Builder nameOnDocument(String nameOnDocument) { + return set("name_on_document", Conv.STRING, nameOnDocument); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Poa} + */ + public Poa build() { + return new Poa(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Present when a liveness check ran. */ + public static final class Liveness extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("method", "score"); + + private Liveness(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Liveness} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Liveness fromJson(JsonNode json) { + return new Liveness(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The method field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional method() { + return Json.optional(json, "method", Conv.STRING); + } + + /** + * Liveness confidence score, rounded to 2 decimals. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Liveness}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Liveness from) { + super(from); + } + + /** + * The method field. + * + * @param method the value + * @return this builder + */ + public Builder method(String method) { + return set("method", Conv.STRING, method); + } + + /** + * Liveness confidence score, rounded to 2 decimals. + * + * @param score the value + * @return this builder + */ + public Builder score(double score) { + return set("score", Conv.DOUBLE, score); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Liveness} + */ + public Liveness build() { + return new Liveness(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Present when face match ran. */ + public static final class FaceMatch extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "source_image", "target_image"); + + private FaceMatch(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceMatch} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceMatch fromJson(JsonNode json) { + return new FaceMatch(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Face-match similarity score, rounded to 2 decimals. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Expiring (presigned) URL of the source face image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceImage() { + return Json.optional(json, "source_image", Conv.STRING); + } + + /** + * Expiring (presigned) URL of the target face image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional targetImage() { + return Json.optional(json, "target_image", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceMatch}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceMatch from) { + super(from); + } + + /** + * Face-match similarity score, rounded to 2 decimals. + * + * @param score the value + * @return this builder + */ + public Builder score(double score) { + return set("score", Conv.DOUBLE, score); + } + + /** + * Expiring (presigned) URL of the source face image. + * + * @param sourceImage the value + * @return this builder + */ + public Builder sourceImage(String sourceImage) { + return set("source_image", Conv.STRING, sourceImage); + } + + /** + * Expiring (presigned) URL of the target face image. + * + * @param targetImage the value + * @return this builder + */ + public Builder targetImage(String targetImage) { + return set("target_image", Conv.STRING, targetImage); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceMatch} + */ + public FaceMatch build() { + return new FaceMatch(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Present when phone verification ran. */ + public static final class PhoneVerification extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("country_code", "is_temporary", "is_ported", "is_blocked"); + + private PhoneVerification(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneVerification} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneVerification fromJson(JsonNode json) { + return new PhoneVerification(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * ISO 3166-1 alpha-2 country of the phone number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * The is_temporary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isTemporary() { + return Json.optional(json, "is_temporary", Conv.BOOLEAN); + } + + /** + * The is_ported field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isPorted() { + return Json.optional(json, "is_ported", Conv.BOOLEAN); + } + + /** + * The is_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocked() { + return Json.optional(json, "is_blocked", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneVerification}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneVerification from) { + super(from); + } + + /** + * ISO 3166-1 alpha-2 country of the phone number. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * The is_temporary field. + * + * @param isTemporary the value + * @return this builder + */ + public Builder isTemporary(boolean isTemporary) { + return set("is_temporary", Conv.BOOLEAN, isTemporary); + } + + /** + * The is_ported field. + * + * @param isPorted the value + * @return this builder + */ + public Builder isPorted(boolean isPorted) { + return set("is_ported", Conv.BOOLEAN, isPorted); + } + + /** + * The is_blocked field. + * + * @param isBlocked the value + * @return this builder + */ + public Builder isBlocked(boolean isBlocked) { + return set("is_blocked", Conv.BOOLEAN, isBlocked); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneVerification} + */ + public PhoneVerification build() { + return new PhoneVerification(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Present when email verification ran. */ + public static final class EmailVerification extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_breached", "is_disposable", "is_undeliverable", "is_blocklisted"); + + private EmailVerification(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailVerification} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailVerification fromJson(JsonNode json) { + return new EmailVerification(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The is_breached field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBreached() { + return Json.optional(json, "is_breached", Conv.BOOLEAN); + } + + /** + * The is_disposable field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * The is_undeliverable field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isUndeliverable() { + return Json.optional(json, "is_undeliverable", Conv.BOOLEAN); + } + + /** + * The is_blocklisted field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailVerification}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailVerification from) { + super(from); + } + + /** + * The is_breached field. + * + * @param isBreached the value + * @return this builder + */ + public Builder isBreached(boolean isBreached) { + return set("is_breached", Conv.BOOLEAN, isBreached); + } + + /** + * The is_disposable field. + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * The is_undeliverable field. + * + * @param isUndeliverable the value + * @return this builder + */ + public Builder isUndeliverable(boolean isUndeliverable) { + return set("is_undeliverable", Conv.BOOLEAN, isUndeliverable); + } + + /** + * The is_blocklisted field. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailVerification} + */ + public EmailVerification build() { + return new EmailVerification(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + /** + * Summary row for a Business Verification (KYB) session. Returned only when session_kind is business or all. + */ + public static final class Business extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_kind", "session_number", "status", "vendor_data", "created_at", "workflow_id", "workflow_type", "workflow_label", "company_name", "registration_number", "country"); + + private Business(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Business} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Business fromJson(JsonNode json) { + return new Business(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier of the business verification session. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sessionId() { + return Json.required(json, "session_id", Conv.STRING); + } + + /** + * Row discriminator. Always "business" for KYB rows. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsListResponse.Results.Business.SessionKind sessionKind() { + return Json.required(json, "session_kind", Conv.enumeration(SessionsListResponse.Results.Business.SessionKind::of)); + } + + /** + * Human-friendly sequential number of the business session within your application. Numbered independently from KYC sessions. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long sessionNumber() { + return Json.required(json, "session_number", Conv.LONG); + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsListResponse.Results.Business.Status status() { + return Json.required(json, "status", Conv.enumeration(SessionsListResponse.Results.Business.Status::of)); + } + + /** + * Your own identifier for the business, echoed back exactly as sent at session creation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * UTC timestamp when the session was created. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * Identifier of the workflow this session was created with. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowId() { + return Json.optional(json, "workflow_id", Conv.STRING); + } + + /** + * Workflow type. kyb for business workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowType() { + return Json.optional(json, "workflow_type", Conv.STRING); + } + + /** + * Display name of the workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowLabel() { + return Json.optional(json, "workflow_label", Conv.STRING); + } + + /** + * Name of the company being verified, from the registry company linked to the session. null until a company is selected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * Company registration number from the registry company linked to the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country code of the registry company linked to the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Business}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Business from) { + super(from); + } + + /** + * Unique identifier of the business verification session. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Row discriminator. Always "business" for KYB rows. + * + * @param sessionKind the value + * @return this builder + */ + public Builder sessionKind(SessionsListResponse.Results.Business.SessionKind sessionKind) { + return set("session_kind", Conv.enumeration(SessionsListResponse.Results.Business.SessionKind::of), sessionKind); + } + + /** + * Human-friendly sequential number of the business session within your application. Numbered independently from KYC sessions. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsListResponse.Results.Business.Status status) { + return set("status", Conv.enumeration(SessionsListResponse.Results.Business.Status::of), status); + } + + /** + * Your own identifier for the business, echoed back exactly as sent at session creation. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * UTC timestamp when the session was created. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Identifier of the workflow this session was created with. + * + * @param workflowId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder workflowId(@Nullable String workflowId) { + return setNullable("workflow_id", Conv.STRING, workflowId); + } + + /** + * Workflow type. kyb for business workflows. + * + * @param workflowType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder workflowType(@Nullable String workflowType) { + return setNullable("workflow_type", Conv.STRING, workflowType); + } + + /** + * Display name of the workflow. + * + * @param workflowLabel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder workflowLabel(@Nullable String workflowLabel) { + return setNullable("workflow_label", Conv.STRING, workflowLabel); + } + + /** + * Name of the company being verified, from the registry company linked to the session. null until a company is selected. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * Company registration number from the registry company linked to the session. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country code of the registry company linked to the session. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Business} + * @throws IllegalStateException when a required field is missing + */ + public Business build() { + require("session_id", false); + require("session_kind", false); + require("session_number", false); + require("status", false); + require("vendor_data", true); + require("created_at", false); + require("workflow_id", true); + require("workflow_type", true); + require("workflow_label", true); + require("company_name", true); + require("registration_number", true); + require("country", true); + return new Business(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Row discriminator. Always "business" for KYB rows. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SessionKind extends StringEnum { + /** The value {@code "business"}. */ + public static final SessionKind BUSINESS = new SessionKind("business"); + + private static final List KNOWN_VALUES = List.of(BUSINESS); + + private SessionKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SessionKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SessionKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Overall session status. See the [Verification Statuses](/integration/verification-statuses) page. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final Status NOT_STARTED = new Status("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final Status IN_PROGRESS = new Status("In Progress"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final Status ABANDONED = new Status("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final Status KYC_EXPIRED = new Status("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final Status RESUBMITTED = new Status("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final Status AWAITING_USER = new Status("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsPreviewResubmissionParams.java b/src/main/java/me/didit/types/SessionsPreviewResubmissionParams.java new file mode 100644 index 0000000..e6be30c --- /dev/null +++ b/src/main/java/me/didit/types/SessionsPreviewResubmissionParams.java @@ -0,0 +1,359 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.preview_resubmission}. */ +public final class SessionsPreviewResubmissionParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("nodes_to_resubmit", "email_address", "email_language"); + + private SessionsPreviewResubmissionParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsPreviewResubmissionParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsPreviewResubmissionParams fromJson(JsonNode json) { + return new SessionsPreviewResubmissionParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Steps to preview, using the same validation, selection and workflow ordering as a resubmission. Omit to auto-select recorded attempts needing resubmission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> nodesToResubmit() { + return Json.optional(json, "nodes_to_resubmit", Conv.list(Conv.model(SessionsPreviewResubmissionParams.NodesToResubmit::fromJson))); + } + + /** + * Recipient shown in the preview. No email is sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String emailAddress() { + return Json.required(json, "email_address", Conv.STRING); + } + + /** + * Language for the notification email. Accepts any string at schema level; unsupported codes silently fall back to English (en). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailLanguage() { + return Json.optional(json, "email_language", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsPreviewResubmissionParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsPreviewResubmissionParams from) { + super(from); + } + + /** + * Steps to preview, using the same validation, selection and workflow ordering as a resubmission. Omit to auto-select recorded attempts needing resubmission. + * + * @param nodesToResubmit the value + * @return this builder + */ + public Builder nodesToResubmit(List nodesToResubmit) { + return set("nodes_to_resubmit", Conv.list(Conv.model(SessionsPreviewResubmissionParams.NodesToResubmit::fromJson)), nodesToResubmit); + } + + /** + * Recipient shown in the preview. No email is sent. + * + * @param emailAddress the value + * @return this builder + */ + public Builder emailAddress(String emailAddress) { + return set("email_address", Conv.STRING, emailAddress); + } + + /** + * Language for the notification email. Accepts any string at schema level; unsupported codes silently fall back to English (en). + * + * @param emailLanguage the value + * @return this builder + */ + public Builder emailLanguage(String emailLanguage) { + return set("email_language", Conv.STRING, emailLanguage); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsPreviewResubmissionParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsPreviewResubmissionParams build() { + require("email_address", false); + return new SessionsPreviewResubmissionParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class NodesToResubmit extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "feature"); + + private NodesToResubmit(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NodesToResubmit} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NodesToResubmit fromJson(JsonNode json) { + return new NodesToResubmit(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Node identifier as it appears in the session's workflow definition (for example feature_ocr, feature_liveness). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String nodeId() { + return Json.required(json, "node_id", Conv.STRING); + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsPreviewResubmissionParams.NodesToResubmit.Feature feature() { + return Json.required(json, "feature", Conv.enumeration(SessionsPreviewResubmissionParams.NodesToResubmit.Feature::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NodesToResubmit}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NodesToResubmit from) { + super(from); + } + + /** + * Node identifier as it appears in the session's workflow definition (for example feature_ocr, feature_liveness). + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsPreviewResubmissionParams.NodesToResubmit.Feature feature) { + return set("feature", Conv.enumeration(SessionsPreviewResubmissionParams.NodesToResubmit.Feature::of), feature); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NodesToResubmit} + * @throws IllegalStateException when a required field is missing + */ + public NodesToResubmit build() { + require("node_id", false); + require("feature", false); + return new NodesToResubmit(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "OCR"}. */ + public static final Feature OCR = new Feature("OCR"); + + /** The value {@code "OCR_BACK"}. */ + public static final Feature OCR_BACK = new Feature("OCR_BACK"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "FACE"}. */ + public static final Feature FACE = new Feature("FACE"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACE_MATCH"}. */ + public static final Feature FACE_MATCH = new Feature("FACE_MATCH"); + + /** The value {@code "IP_ANALYSIS"}. */ + public static final Feature IP_ANALYSIS = new Feature("IP_ANALYSIS"); + + /** The value {@code "AGE_ESTIMATION"}. */ + public static final Feature AGE_ESTIMATION = new Feature("AGE_ESTIMATION"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE_VERIFICATION"}. */ + public static final Feature PHONE_VERIFICATION = new Feature("PHONE_VERIFICATION"); + + /** The value {@code "EMAIL_VERIFICATION"}. */ + public static final Feature EMAIL_VERIFICATION = new Feature("EMAIL_VERIFICATION"); + + /** The value {@code "FACE_SEARCH"}. */ + public static final Feature FACE_SEARCH = new Feature("FACE_SEARCH"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "POA"}. */ + public static final Feature POA = new Feature("POA"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + /** The value {@code "KYB"}. */ + public static final Feature KYB = new Feature("KYB"); + + private static final List KNOWN_VALUES = List.of(OCR, OCR_BACK, NFC, AML, FACE, LIVENESS, FACE_MATCH, IP_ANALYSIS, AGE_ESTIMATION, PROOF_OF_ADDRESS, PHONE_VERIFICATION, EMAIL_VERIFICATION, FACE_SEARCH, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_DOCUMENTS, ID_VERIFICATION, POA, PHONE, EMAIL, KYB_REGISTRY, KYB_KEY_PEOPLE, KYB); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsPreviewResubmissionResponse.java b/src/main/java/me/didit/types/SessionsPreviewResubmissionResponse.java new file mode 100644 index 0000000..c1fdf92 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsPreviewResubmissionResponse.java @@ -0,0 +1,443 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class SessionsPreviewResubmissionResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("recipient", "sender", "subject", "html", "nodes_to_resubmit", "requires_user_action", "preview_token"); + + private SessionsPreviewResubmissionResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsPreviewResubmissionResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsPreviewResubmissionResponse fromJson(JsonNode json) { + return new SessionsPreviewResubmissionResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The recipient field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String recipient() { + return Json.required(json, "recipient", Conv.STRING); + } + + /** + * The sender field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String sender() { + return Json.required(json, "sender", Conv.STRING); + } + + /** + * The subject field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String subject() { + return Json.required(json, "subject", Conv.STRING); + } + + /** + * Rendered email. Inline image attachments use data URLs for preview. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String html() { + return Json.required(json, "html", Conv.STRING); + } + + /** + * The nodes_to_resubmit field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List nodesToResubmit() { + return Json.required(json, "nodes_to_resubmit", Conv.list(Conv.model(SessionsPreviewResubmissionResponse.NodesToResubmit::fromJson))); + } + + /** + * Whether at least one selected check requires user interaction. This does not predict the final workflow outcome. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean requiresUserAction() { + return Json.required(json, "requires_user_action", Conv.BOOLEAN); + } + + /** + * Signed confirmation receipt, valid for 15 minutes. Pass it as email_preview_token when confirming the same message. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String previewToken() { + return Json.required(json, "preview_token", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsPreviewResubmissionResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsPreviewResubmissionResponse from) { + super(from); + } + + /** + * The recipient field. + * + * @param recipient the value + * @return this builder + */ + public Builder recipient(String recipient) { + return set("recipient", Conv.STRING, recipient); + } + + /** + * The sender field. + * + * @param sender the value + * @return this builder + */ + public Builder sender(String sender) { + return set("sender", Conv.STRING, sender); + } + + /** + * The subject field. + * + * @param subject the value + * @return this builder + */ + public Builder subject(String subject) { + return set("subject", Conv.STRING, subject); + } + + /** + * Rendered email. Inline image attachments use data URLs for preview. + * + * @param html the value + * @return this builder + */ + public Builder html(String html) { + return set("html", Conv.STRING, html); + } + + /** + * The nodes_to_resubmit field. + * + * @param nodesToResubmit the value + * @return this builder + */ + public Builder nodesToResubmit(List nodesToResubmit) { + return set("nodes_to_resubmit", Conv.list(Conv.model(SessionsPreviewResubmissionResponse.NodesToResubmit::fromJson)), nodesToResubmit); + } + + /** + * Whether at least one selected check requires user interaction. This does not predict the final workflow outcome. + * + * @param requiresUserAction the value + * @return this builder + */ + public Builder requiresUserAction(boolean requiresUserAction) { + return set("requires_user_action", Conv.BOOLEAN, requiresUserAction); + } + + /** + * Signed confirmation receipt, valid for 15 minutes. Pass it as email_preview_token when confirming the same message. + * + * @param previewToken the value + * @return this builder + */ + public Builder previewToken(String previewToken) { + return set("preview_token", Conv.STRING, previewToken); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsPreviewResubmissionResponse} + * @throws IllegalStateException when a required field is missing + */ + public SessionsPreviewResubmissionResponse build() { + require("recipient", false); + require("sender", false); + require("subject", false); + require("html", false); + require("nodes_to_resubmit", false); + require("requires_user_action", false); + require("preview_token", false); + return new SessionsPreviewResubmissionResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class NodesToResubmit extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "feature"); + + private NodesToResubmit(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NodesToResubmit} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NodesToResubmit fromJson(JsonNode json) { + return new NodesToResubmit(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Node identifier as it appears in the session's workflow definition (for example feature_ocr, feature_liveness). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String nodeId() { + return Json.required(json, "node_id", Conv.STRING); + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsPreviewResubmissionResponse.NodesToResubmit.Feature feature() { + return Json.required(json, "feature", Conv.enumeration(SessionsPreviewResubmissionResponse.NodesToResubmit.Feature::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NodesToResubmit}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NodesToResubmit from) { + super(from); + } + + /** + * Node identifier as it appears in the session's workflow definition (for example feature_ocr, feature_liveness). + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsPreviewResubmissionResponse.NodesToResubmit.Feature feature) { + return set("feature", Conv.enumeration(SessionsPreviewResubmissionResponse.NodesToResubmit.Feature::of), feature); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NodesToResubmit} + * @throws IllegalStateException when a required field is missing + */ + public NodesToResubmit build() { + require("node_id", false); + require("feature", false); + return new NodesToResubmit(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "OCR"}. */ + public static final Feature OCR = new Feature("OCR"); + + /** The value {@code "OCR_BACK"}. */ + public static final Feature OCR_BACK = new Feature("OCR_BACK"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "FACE"}. */ + public static final Feature FACE = new Feature("FACE"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACE_MATCH"}. */ + public static final Feature FACE_MATCH = new Feature("FACE_MATCH"); + + /** The value {@code "IP_ANALYSIS"}. */ + public static final Feature IP_ANALYSIS = new Feature("IP_ANALYSIS"); + + /** The value {@code "AGE_ESTIMATION"}. */ + public static final Feature AGE_ESTIMATION = new Feature("AGE_ESTIMATION"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE_VERIFICATION"}. */ + public static final Feature PHONE_VERIFICATION = new Feature("PHONE_VERIFICATION"); + + /** The value {@code "EMAIL_VERIFICATION"}. */ + public static final Feature EMAIL_VERIFICATION = new Feature("EMAIL_VERIFICATION"); + + /** The value {@code "FACE_SEARCH"}. */ + public static final Feature FACE_SEARCH = new Feature("FACE_SEARCH"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "POA"}. */ + public static final Feature POA = new Feature("POA"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + /** The value {@code "KYB"}. */ + public static final Feature KYB = new Feature("KYB"); + + private static final List KNOWN_VALUES = List.of(OCR, OCR_BACK, NFC, AML, FACE, LIVENESS, FACE_MATCH, IP_ANALYSIS, AGE_ESTIMATION, PROOF_OF_ADDRESS, PHONE_VERIFICATION, EMAIL_VERIFICATION, FACE_SEARCH, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_DOCUMENTS, ID_VERIFICATION, POA, PHONE, EMAIL, KYB_REGISTRY, KYB_KEY_PEOPLE, KYB); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsRetrieveDecisionParams.java b/src/main/java/me/didit/types/SessionsRetrieveDecisionParams.java new file mode 100644 index 0000000..8062aa6 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsRetrieveDecisionParams.java @@ -0,0 +1,145 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.retrieve_decision}. */ +public final class SessionsRetrieveDecisionParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("include"); + + private SessionsRetrieveDecisionParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsRetrieveDecisionParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsRetrieveDecisionParams fromJson(JsonNode json) { + return new SessionsRetrieveDecisionParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Comma-separated list of extra payload sections. Supported values: events and resubmissions, alone or together (events,resubmissions). When include=events is passed, the response additionally contains the session event timeline (events, including the WORKFLOW_BRANCH_EVALUATED / WORKFLOW_STATUS_NODE_REACHED routing events described on the Retrieve Session page), the full activity log (activity_reviews), blocklist flags (blocklisted), a per-session cost_breakdown, workflow metadata (workflow_type, workflow_version, workflow_version_id, and workflow_terminal_node_id - the last recorded workflow status node that set a session status, or null if none has been recorded; historical provenance that is not cleared by manual approvals, declines or resubmissions, and is replaced by a later workflow status node), and session metadata (api_service โ€” string or null, set only for standalone-API sessions; session_type โ€” API, HOSTED, or MIGRATED; has_device_nfc_support โ€” boolean). Two fields change relative to the plain shape: the top-level session_kind discriminator is omitted (the events shape only exists for user sessions), and the features array switches from plain strings to {feature, node_id} objects โ€” where the email feature is reported as EMAIL instead of EMAIL_VERIFICATION. This expanded shape is primarily used by the Didit Console; most API integrations should omit the parameter. KYB limitation: include=events only applies to user (KYC) sessions. Business sessions (session_kind = "business") always return the standard business decision shape โ€” events, activity_reviews, blocklisted, cost_breakdown and the extra workflow_*/session metadata are never returned for business sessions, and their features array stays a plain string array. With include=resubmissions (user and business sessions alike) the response also contains resubmissions: one entry per resubmission request, oldest first, each with number, created_at, previous_status, nodes, reasons, requested_by and results (what the resubmitted steps returned before the request, under the same keys and in the same shape as the current results). Each cost_breakdown item carries usage_type, price, details and created_at: a resubmitted step that runs again is billed as a new item. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional include() { + return Json.optional(json, "include", Conv.enumeration(SessionsRetrieveDecisionParams.Include::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsRetrieveDecisionParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsRetrieveDecisionParams from) { + super(from); + } + + /** + * Comma-separated list of extra payload sections. Supported values: events and resubmissions, alone or together (events,resubmissions). When include=events is passed, the response additionally contains the session event timeline (events, including the WORKFLOW_BRANCH_EVALUATED / WORKFLOW_STATUS_NODE_REACHED routing events described on the Retrieve Session page), the full activity log (activity_reviews), blocklist flags (blocklisted), a per-session cost_breakdown, workflow metadata (workflow_type, workflow_version, workflow_version_id, and workflow_terminal_node_id - the last recorded workflow status node that set a session status, or null if none has been recorded; historical provenance that is not cleared by manual approvals, declines or resubmissions, and is replaced by a later workflow status node), and session metadata (api_service โ€” string or null, set only for standalone-API sessions; session_type โ€” API, HOSTED, or MIGRATED; has_device_nfc_support โ€” boolean). Two fields change relative to the plain shape: the top-level session_kind discriminator is omitted (the events shape only exists for user sessions), and the features array switches from plain strings to {feature, node_id} objects โ€” where the email feature is reported as EMAIL instead of EMAIL_VERIFICATION. This expanded shape is primarily used by the Didit Console; most API integrations should omit the parameter. KYB limitation: include=events only applies to user (KYC) sessions. Business sessions (session_kind = "business") always return the standard business decision shape โ€” events, activity_reviews, blocklisted, cost_breakdown and the extra workflow_*/session metadata are never returned for business sessions, and their features array stays a plain string array. With include=resubmissions (user and business sessions alike) the response also contains resubmissions: one entry per resubmission request, oldest first, each with number, created_at, previous_status, nodes, reasons, requested_by and results (what the resubmitted steps returned before the request, under the same keys and in the same shape as the current results). Each cost_breakdown item carries usage_type, price, details and created_at: a resubmitted step that runs again is billed as a new item. + * + * @param include the value + * @return this builder + */ + public Builder include(SessionsRetrieveDecisionParams.Include include) { + return set("include", Conv.enumeration(SessionsRetrieveDecisionParams.Include::of), include); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsRetrieveDecisionParams} + */ + public SessionsRetrieveDecisionParams build() { + return new SessionsRetrieveDecisionParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Include extends StringEnum { + /** The value {@code "events"}. */ + public static final Include EVENTS = new Include("events"); + + /** The value {@code "resubmissions"}. */ + public static final Include RESUBMISSIONS = new Include("resubmissions"); + + /** The value {@code "events,resubmissions"}. */ + public static final Include EVENTS_RESUBMISSIONS = new Include("events,resubmissions"); + + private static final List KNOWN_VALUES = List.of(EVENTS, RESUBMISSIONS, EVENTS_RESUBMISSIONS); + + private Include(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Include of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Include::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsRetrieveDecisionResponse.java b/src/main/java/me/didit/types/SessionsRetrieveDecisionResponse.java new file mode 100644 index 0000000..4f7451c --- /dev/null +++ b/src/main/java/me/didit/types/SessionsRetrieveDecisionResponse.java @@ -0,0 +1,36411 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsRetrieveDecisionResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_kind", "session_number", "session_url", "status", "workflow_id", "features", "vendor_data", "metadata", "expected_details", "contact_details", "callback", "id_verifications", "nfc_skip_reason", "nfc_verifications", "liveness_checks", "face_matches", "phone_verifications", "email_verifications", "poa_verifications", "document_ai_documents", "questionnaire_responses", "aml_screenings", "ip_analyses", "database_validations", "reviews", "created_at", "expires_at", "registry_checks", "key_people_checks", "document_verifications", "environment", "resubmissions"); + + private SessionsRetrieveDecisionResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsRetrieveDecisionResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsRetrieveDecisionResponse fromJson(JsonNode json) { + return new SessionsRetrieveDecisionResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The unique identifier of the session for which to retrieve verification results. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Discriminator indicating whether this is a User Verification (KYC) or Business Verification (KYB) session. When user, the KYC feature arrays (id_verifications, nfc_verifications, liveness_checks, face_matches, poa_verifications, document_ai_documents, database_validations, ...) apply and the business arrays are absent. When business, the payload instead carries registry_checks, document_verifications, key_people_checks plus the shared arrays (aml_screenings, phone_verifications, email_verifications, ip_analyses, questionnaire_responses). **Omitted when include=events is passed** โ€” the events shape only exists for user sessions, so the discriminator is dropped from that variant. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionKind() { + return Json.optional(json, "session_kind", Conv.enumeration(SessionsRetrieveDecisionResponse.SessionKind::of)); + } + + /** + * The number of the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * The URL of the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionUrl() { + return Json.optional(json, "session_url", Conv.STRING); + } + + /** + * Overall lifecycle status of the session โ€” the rolled-up workflow result. Terminal values are Approved, Declined, In Review, Expired, Kyc Expired, and Abandoned; Not Started, In Progress, Awaiting User, and Resubmitted indicate the session is still moving through the workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.Status::of)); + } + + /** + * Stable identifier of the workflow group that produced this session. Workflows are versioned โ€” this value identifies the workflow itself, not the specific version. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowId() { + return Json.optional(json, "workflow_id", Conv.STRING); + } + + /** + * List of verification features configured for this session, as display names: ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, PHONE, EMAIL_VERIFICATION, AML, IP_ANALYSIS, DATABASE_VALIDATION, QUESTIONNAIRE, AGE_ESTIMATION, FACE_SEARCH (Business Verification sessions use the KYB feature set: KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE, AML, PHONE, EMAIL_VERIFICATION, IP_ANALYSIS, QUESTIONNAIRE). With include=events each entry becomes an object {feature, node_id} instead of a plain string, and the email feature is renamed: it appears as EMAIL in events mode instead of the EMAIL_VERIFICATION used here. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.list(Conv.STRING)); + } + + /** + * The vendor data of the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The metadata of the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Expected details supplied at session creation โ€” used for cross-validation against extracted data (KYC) or to pre-fill the company registry search (KYB). Echoes back exactly the keys that were provided; null when none were supplied. KYC sessions carry the person fields; Business (KYB) sessions carry company_name, registry_country and registration_number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedDetails() { + return Json.optional(json, "expected_details", Conv.model(SessionsRetrieveDecisionResponse.ExpectedDetails::fromJson)); + } + + /** + * Contact details supplied when the session was created (used for notification emails, prefilled phone/email verification, and communication language). null when neither an email nor a phone number was provided. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contactDetails() { + return Json.optional(json, "contact_details", Conv.model(SessionsRetrieveDecisionResponse.ContactDetails::fromJson)); + } + + /** + * The callback URL of the session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callback() { + return Json.optional(json, "callback", Conv.STRING); + } + + /** + * Array of ID verification (OCR) reports produced by ID-document steps in the workflow graph. Always a JSON array โ€” read id_verifications[0] and iterate if your workflow can run more than one ID check (for example a primary check plus a step-up). null until at least one ID step has produced data. Each item is the full report, including node_id, feature-level status, extracted document fields, image URLs, quality scores, MRZ, address parsing, cross-session matches, and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> idVerifications() { + return Json.optional(json, "id_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications::fromJson))); + } + + /** + * Why NFC chip verification did not run, populated whenever the workflow includes an NFC step. null while NFC is pending or when the chip was actually read. Values: USER_SKIPPED - the user chose to skip on an NFC-capable device (allowed by allow_nfc_skip); DOCUMENT_WITHOUT_CHIP - the document has no readable NFC chip (not an ICAO 9303 electronic document); CHIP_CERTIFICATE_UNAVAILABLE - the issuing country's signing certificate (CSCA) covering the document's issue period is unavailable, so the chip signature cannot be verified; DEVICE_WITHOUT_NFC - the device reported no NFC reader; INTEGRATION_WITHOUT_NFC_ACCESS - the verification ran without a native SDK (e.g. in a web browser), which has no access to the phone's NFC reader; MRZ_KEY_UNAVAILABLE - the chip access key could not be derived from the document's MRZ. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nfcSkipReason() { + return Json.optional(json, "nfc_skip_reason", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcSkipReason::of)); + } + + /** + * Array of NFC / ePassport reports produced by NFC steps in the workflow graph. **This is always a JSON array, never a singular nfc object** โ€” read nfc_verifications[0] and iterate if your workflow can run NFC more than once. null until at least one NFC step has produced data. Each item is the full report, including node_id, feature-level status, chip_data, authenticity (SOD + DG integrity), certificate_summary, and warnings[]. When the NFC step was bypassed before it could ever be offered (chipless document, missing certificate, no NFC capability reported, unreadable MRZ key), this stays null and nfc_skip_reason explains why; a skip at the step itself (user tapped skip, or the reader turned out unavailable at scan time) still produces a report with is_nfc_skipped: true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> nfcVerifications() { + return Json.optional(json, "nfc_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications::fromJson))); + } + + /** + * Array of liveness reports produced by liveness steps in the workflow graph. Always a JSON array โ€” never a singular liveness object. null until at least one liveness step has produced data. Each item is the full report, including node_id, feature-level status, method, score, reference_image, video_url, optional age_estimation, cross-session matches[], and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> livenessChecks() { + return Json.optional(json, "liveness_checks", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks::fromJson))); + } + + /** + * Array of face-match reports produced by face-match steps in the workflow graph. Always a JSON array โ€” never a singular face_match object. null until at least one face-match step has produced data. Each item is the full report, including node_id, feature-level status, similarity score, source_image, target_image, and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> faceMatches() { + return Json.optional(json, "face_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.FaceMatches::fromJson))); + } + + /** + * Array of phone verification reports โ€” always a JSON array, never a singular phone object. null until at least one phone step has produced data. Each item is the full report, including node_id, feature-level status, the phone number and country metadata, lifecycle[], matches[], and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> phoneVerifications() { + return Json.optional(json, "phone_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications::fromJson))); + } + + /** + * Array of email verification reports โ€” always a JSON array, never a singular email object. null until at least one email step has produced data. Each item is the full report, including node_id, feature-level status, the email address, breach data, lifecycle[], matches[], and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> emailVerifications() { + return Json.optional(json, "email_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications::fromJson))); + } + + /** + * Array of Proof of Address (POA) reports โ€” always a JSON array, never a singular poa object. null until at least one POA step has produced data. Each item is the full report, including node_id, feature-level status, the document file URL, issuer, dates, parsed address, and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> poaVerifications() { + return Json.optional(json, "poa_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications::fromJson))); + } + + /** + * Document AI reports grouped by workflow node โ€” always a JSON array, never a singular object. null until at least one Document AI step has produced data. Present only when session_kind = user. Each item is a node group with an aggregate status, the node_id, an items[] array of the per-document results (extracted data keyed by the configured field key), and warnings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> documentAiDocuments() { + return Json.optional(json, "document_ai_documents", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentAiDocuments::fromJson))); + } + + /** + * Array of questionnaire response reports โ€” always a JSON array, never a singular questionnaire object. null until at least one questionnaire step has produced data. Each item is the full report, including node_id, the questionnaire metadata, sections with form elements, and the user's answers. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> questionnaireResponses() { + return Json.optional(json, "questionnaire_responses", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses::fromJson))); + } + + /** + * Array of AML screening reports โ€” always a JSON array, never a singular aml object. null until at least one AML step has produced data. Each item is the full report, including node_id, feature-level status, total_hits, entity_type, hits[], score, screened_data, is_ongoing_monitoring_enabled, and warnings[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> amlScreenings() { + return Json.optional(json, "aml_screenings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings::fromJson))); + } + + /** + * Array of Device & IP Analysis reports โ€” always a JSON array, never a singular ip_analysis object. null until at least one IP-analysis step has produced data. Each item is the full report, including node_id, feature-level status, IP and geolocation data, device fingerprint, and warnings[]. Entries with duplicate (node_id, ip_address, device_fingerprint) are deduplicated server-side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> ipAnalyses() { + return Json.optional(json, "ip_analyses", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses::fromJson))); + } + + /** + * Array of Database Validation reports โ€” always a JSON array, never a singular database_validation object. null until at least one DB validation step has produced data. Each item is the full report, including node_id, feature-level status, screened_data, the per-service validations[] (each with its registry source_data), and warnings[]. The screened_data and source_data fields vary by country: + * + *

ARG (Argentina): screened_data: {document_number, selfie, gender, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, date_of_death, tax_id, tax_id_type, face_match_score, sit_1_since, banks, last_position, highest_position, rejected_checks}. Uses RENAPER biometric face-match validation. Gender is auto-inferred from face analysis or given name when not present in the document (e.g., driver licenses) + * + *

BOL (Bolivia): screened_data: {document_number, date_of_birth, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, gender} + * + *

BRA (Brazil): screened_data: {tax_number, first_name, last_name, date_of_birth}. source_data always includes {identification_number, first_name, last_name, date_of_birth, lgpd_minor, minor_under_18, minor_under_16} for successful CPF matches. Successful adult lookups set those flags to false. The Receita Federal Consulta CPF service may return HTTP 422 (minor under 18) or 451 (under 16) with LGPD-withheld data; in those cases source_data sets the minor flags to true as appropriate, includes the upstream HTTP status, and field-level validation is no_match. See the Brazil section of the Database Validation Outcome Codes reference for the full code list. + * + *

CHL (Chile): screened_data: {personal_number, first_name, last_name, date_of_birth}. source_data: {identification_number, first_name, last_name, date_of_birth, gender} + * + *

COL (Colombia): screened_data: {document_number, document_type, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, document_type} + * + *

CRI (Costa Rica): screened_data: {personal_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

DOM (Dominican Republic): screened_data: {personal_number}. source_data: {identification_number} (returns valid/invalid only) + * + *

ECU (Ecuador): screened_data: {personal_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, street, formatted_address, gender, nationality, education, marital_status, spouse, mother_name, father_name, profession} + * + *

ESP (Spain): screened_data: {personal_number, document_type, expiration_date, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, document_type, expiration_date} + * + *

GTM (Guatemala): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

HND (Honduras): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

MEX (Mexico): screened_data: {personal_number (CURP), first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, gender, nationality, curp_status, state_of_birth, doc_probatorio, registration_year, registration_state, registration_municipality, num_acta, crip, issuing_state_code, foreign_registry_number, folio_carta, folio_certificado}. Uses the RENAPO civil registry. A separate INE validity-check service is also available for MEX as an additional one-by-one validation. + * + *

PAN (Panama): screened_data: {personal_number, selfie}. source_data: {identification_number}. Uses SIB biometric validation + * + *

PER (Peru): screened_data: {personal_number (DNI), first_name, last_name}. source_data: {identification_number, first_name, last_name, paternal_name, maternal_name, verification_number, verification_letter} + * + *

PRY (Paraguay): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

SLV (El Salvador): screened_data: {document_number, date_of_birth, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

URY (Uruguay): screened_data: {personal_number, date_of_birth, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

VEN (Venezuela): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, gender, date_of_birth, document_type} + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> databaseValidations() { + return Json.optional(json, "database_validations", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations::fromJson))); + } + + /** + * The reviews field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reviews() { + return Json.optional(json, "reviews", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.Reviews::fromJson))); + } + + /** + * Timestamp at which the session was created (ISO 8601, UTC). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * Timestamp at which this session is scheduled to expire. Set on User Verification (KYC) sessions when an expiration was configured at creation time (or once Approved status triggers KYC expiry computation). null for sessions without a configured expiration, and for kinds that do not use expiry (e.g. Business Verification (KYB) sessions that never received an expires_at). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + /** + * Company registry checks. Present only when session_kind = business. Each item wraps the full company-registry payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registryChecks() { + return Json.optional(json, "registry_checks", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks::fromJson))); + } + + /** + * Aggregate key-people checks. Present only when session_kind = business. Each item uses the two-bucket shape (registry, submitted, ubo_kyc_summary). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> keyPeopleChecks() { + return Json.optional(json, "key_people_checks", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks::fromJson))); + } + + /** + * Document verification checks grouped by workflow node. Present only when session_kind = business. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> documentVerifications() { + return Json.optional(json, "document_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications::fromJson))); + } + + /** + * Whether the session was created by a live application (live) or a sandbox application (sandbox). Sandbox sessions are free, fully simulated, and never bill credits. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional environment() { + return Json.optional(json, "environment", Conv.enumeration(SessionsRetrieveDecisionResponse.Environment::of)); + } + + /** + * Returned only with include=resubmissions, for user and business sessions. One entry per resubmission request, oldest first. Each entry carries the results the resubmitted steps returned before the request, so earlier submissions stay readable. Deleting the session deletes every submission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> resubmissions() { + return Json.optional(json, "resubmissions", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.Resubmissions::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsRetrieveDecisionResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsRetrieveDecisionResponse from) { + super(from); + } + + /** + * The unique identifier of the session for which to retrieve verification results. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Discriminator indicating whether this is a User Verification (KYC) or Business Verification (KYB) session. When user, the KYC feature arrays (id_verifications, nfc_verifications, liveness_checks, face_matches, poa_verifications, document_ai_documents, database_validations, ...) apply and the business arrays are absent. When business, the payload instead carries registry_checks, document_verifications, key_people_checks plus the shared arrays (aml_screenings, phone_verifications, email_verifications, ip_analyses, questionnaire_responses). **Omitted when include=events is passed** โ€” the events shape only exists for user sessions, so the discriminator is dropped from that variant. + * + * @param sessionKind the value + * @return this builder + */ + public Builder sessionKind(SessionsRetrieveDecisionResponse.SessionKind sessionKind) { + return set("session_kind", Conv.enumeration(SessionsRetrieveDecisionResponse.SessionKind::of), sessionKind); + } + + /** + * The number of the session. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * The URL of the session. + * + * @param sessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionUrl(@Nullable String sessionUrl) { + return setNullable("session_url", Conv.STRING, sessionUrl); + } + + /** + * Overall lifecycle status of the session โ€” the rolled-up workflow result. Terminal values are Approved, Declined, In Review, Expired, Kyc Expired, and Abandoned; Not Started, In Progress, Awaiting User, and Resubmitted indicate the session is still moving through the workflow. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.Status::of), status); + } + + /** + * Stable identifier of the workflow group that produced this session. Workflows are versioned โ€” this value identifies the workflow itself, not the specific version. + * + * @param workflowId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder workflowId(@Nullable String workflowId) { + return setNullable("workflow_id", Conv.STRING, workflowId); + } + + /** + * List of verification features configured for this session, as display names: ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, PHONE, EMAIL_VERIFICATION, AML, IP_ANALYSIS, DATABASE_VALIDATION, QUESTIONNAIRE, AGE_ESTIMATION, FACE_SEARCH (Business Verification sessions use the KYB feature set: KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE, AML, PHONE, EMAIL_VERIFICATION, IP_ANALYSIS, QUESTIONNAIRE). With include=events each entry becomes an object {feature, node_id} instead of a plain string, and the email feature is renamed: it appears as EMAIL in events mode instead of the EMAIL_VERIFICATION used here. + * + * @param features the value + * @return this builder + */ + public Builder features(List features) { + return set("features", Conv.list(Conv.STRING), features); + } + + /** + * The vendor data of the session. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The metadata of the session. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Expected details supplied at session creation โ€” used for cross-validation against extracted data (KYC) or to pre-fill the company registry search (KYB). Echoes back exactly the keys that were provided; null when none were supplied. KYC sessions carry the person fields; Business (KYB) sessions carry company_name, registry_country and registration_number. + * + * @param expectedDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedDetails(SessionsRetrieveDecisionResponse.@Nullable ExpectedDetails expectedDetails) { + return setNullable("expected_details", Conv.model(SessionsRetrieveDecisionResponse.ExpectedDetails::fromJson), expectedDetails); + } + + /** + * Contact details supplied when the session was created (used for notification emails, prefilled phone/email verification, and communication language). null when neither an email nor a phone number was provided. + * + * @param contactDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder contactDetails(SessionsRetrieveDecisionResponse.@Nullable ContactDetails contactDetails) { + return setNullable("contact_details", Conv.model(SessionsRetrieveDecisionResponse.ContactDetails::fromJson), contactDetails); + } + + /** + * The callback URL of the session. + * + * @param callback the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder callback(@Nullable String callback) { + return setNullable("callback", Conv.STRING, callback); + } + + /** + * Array of ID verification (OCR) reports produced by ID-document steps in the workflow graph. Always a JSON array โ€” read id_verifications[0] and iterate if your workflow can run more than one ID check (for example a primary check plus a step-up). null until at least one ID step has produced data. Each item is the full report, including node_id, feature-level status, extracted document fields, image URLs, quality scores, MRZ, address parsing, cross-session matches, and warnings[]. + * + * @param idVerifications the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder idVerifications(@Nullable List idVerifications) { + return setNullable("id_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications::fromJson)), idVerifications); + } + + /** + * Why NFC chip verification did not run, populated whenever the workflow includes an NFC step. null while NFC is pending or when the chip was actually read. Values: USER_SKIPPED - the user chose to skip on an NFC-capable device (allowed by allow_nfc_skip); DOCUMENT_WITHOUT_CHIP - the document has no readable NFC chip (not an ICAO 9303 electronic document); CHIP_CERTIFICATE_UNAVAILABLE - the issuing country's signing certificate (CSCA) covering the document's issue period is unavailable, so the chip signature cannot be verified; DEVICE_WITHOUT_NFC - the device reported no NFC reader; INTEGRATION_WITHOUT_NFC_ACCESS - the verification ran without a native SDK (e.g. in a web browser), which has no access to the phone's NFC reader; MRZ_KEY_UNAVAILABLE - the chip access key could not be derived from the document's MRZ. + * + * @param nfcSkipReason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nfcSkipReason(SessionsRetrieveDecisionResponse.@Nullable NfcSkipReason nfcSkipReason) { + return setNullable("nfc_skip_reason", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcSkipReason::of), nfcSkipReason); + } + + /** + * Array of NFC / ePassport reports produced by NFC steps in the workflow graph. **This is always a JSON array, never a singular nfc object** โ€” read nfc_verifications[0] and iterate if your workflow can run NFC more than once. null until at least one NFC step has produced data. Each item is the full report, including node_id, feature-level status, chip_data, authenticity (SOD + DG integrity), certificate_summary, and warnings[]. When the NFC step was bypassed before it could ever be offered (chipless document, missing certificate, no NFC capability reported, unreadable MRZ key), this stays null and nfc_skip_reason explains why; a skip at the step itself (user tapped skip, or the reader turned out unavailable at scan time) still produces a report with is_nfc_skipped: true. + * + * @param nfcVerifications the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nfcVerifications(@Nullable List nfcVerifications) { + return setNullable("nfc_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications::fromJson)), nfcVerifications); + } + + /** + * Array of liveness reports produced by liveness steps in the workflow graph. Always a JSON array โ€” never a singular liveness object. null until at least one liveness step has produced data. Each item is the full report, including node_id, feature-level status, method, score, reference_image, video_url, optional age_estimation, cross-session matches[], and warnings[]. + * + * @param livenessChecks the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder livenessChecks(@Nullable List livenessChecks) { + return setNullable("liveness_checks", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks::fromJson)), livenessChecks); + } + + /** + * Array of face-match reports produced by face-match steps in the workflow graph. Always a JSON array โ€” never a singular face_match object. null until at least one face-match step has produced data. Each item is the full report, including node_id, feature-level status, similarity score, source_image, target_image, and warnings[]. + * + * @param faceMatches the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceMatches(@Nullable List faceMatches) { + return setNullable("face_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.FaceMatches::fromJson)), faceMatches); + } + + /** + * Array of phone verification reports โ€” always a JSON array, never a singular phone object. null until at least one phone step has produced data. Each item is the full report, including node_id, feature-level status, the phone number and country metadata, lifecycle[], matches[], and warnings[]. + * + * @param phoneVerifications the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneVerifications(@Nullable List phoneVerifications) { + return setNullable("phone_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications::fromJson)), phoneVerifications); + } + + /** + * Array of email verification reports โ€” always a JSON array, never a singular email object. null until at least one email step has produced data. Each item is the full report, including node_id, feature-level status, the email address, breach data, lifecycle[], matches[], and warnings[]. + * + * @param emailVerifications the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder emailVerifications(@Nullable List emailVerifications) { + return setNullable("email_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications::fromJson)), emailVerifications); + } + + /** + * Array of Proof of Address (POA) reports โ€” always a JSON array, never a singular poa object. null until at least one POA step has produced data. Each item is the full report, including node_id, feature-level status, the document file URL, issuer, dates, parsed address, and warnings[]. + * + * @param poaVerifications the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaVerifications(@Nullable List poaVerifications) { + return setNullable("poa_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications::fromJson)), poaVerifications); + } + + /** + * Document AI reports grouped by workflow node โ€” always a JSON array, never a singular object. null until at least one Document AI step has produced data. Present only when session_kind = user. Each item is a node group with an aggregate status, the node_id, an items[] array of the per-document results (extracted data keyed by the configured field key), and warnings. + * + * @param documentAiDocuments the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentAiDocuments(@Nullable List documentAiDocuments) { + return setNullable("document_ai_documents", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentAiDocuments::fromJson)), documentAiDocuments); + } + + /** + * Array of questionnaire response reports โ€” always a JSON array, never a singular questionnaire object. null until at least one questionnaire step has produced data. Each item is the full report, including node_id, the questionnaire metadata, sections with form elements, and the user's answers. + * + * @param questionnaireResponses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder questionnaireResponses(@Nullable List questionnaireResponses) { + return setNullable("questionnaire_responses", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses::fromJson)), questionnaireResponses); + } + + /** + * Array of AML screening reports โ€” always a JSON array, never a singular aml object. null until at least one AML step has produced data. Each item is the full report, including node_id, feature-level status, total_hits, entity_type, hits[], score, screened_data, is_ongoing_monitoring_enabled, and warnings[]. + * + * @param amlScreenings the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amlScreenings(@Nullable List amlScreenings) { + return setNullable("aml_screenings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings::fromJson)), amlScreenings); + } + + /** + * Array of Device & IP Analysis reports โ€” always a JSON array, never a singular ip_analysis object. null until at least one IP-analysis step has produced data. Each item is the full report, including node_id, feature-level status, IP and geolocation data, device fingerprint, and warnings[]. Entries with duplicate (node_id, ip_address, device_fingerprint) are deduplicated server-side. + * + * @param ipAnalyses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipAnalyses(@Nullable List ipAnalyses) { + return setNullable("ip_analyses", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses::fromJson)), ipAnalyses); + } + + /** + * Array of Database Validation reports โ€” always a JSON array, never a singular database_validation object. null until at least one DB validation step has produced data. Each item is the full report, including node_id, feature-level status, screened_data, the per-service validations[] (each with its registry source_data), and warnings[]. The screened_data and source_data fields vary by country: + * + *

ARG (Argentina): screened_data: {document_number, selfie, gender, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, date_of_death, tax_id, tax_id_type, face_match_score, sit_1_since, banks, last_position, highest_position, rejected_checks}. Uses RENAPER biometric face-match validation. Gender is auto-inferred from face analysis or given name when not present in the document (e.g., driver licenses) + * + *

BOL (Bolivia): screened_data: {document_number, date_of_birth, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, gender} + * + *

BRA (Brazil): screened_data: {tax_number, first_name, last_name, date_of_birth}. source_data always includes {identification_number, first_name, last_name, date_of_birth, lgpd_minor, minor_under_18, minor_under_16} for successful CPF matches. Successful adult lookups set those flags to false. The Receita Federal Consulta CPF service may return HTTP 422 (minor under 18) or 451 (under 16) with LGPD-withheld data; in those cases source_data sets the minor flags to true as appropriate, includes the upstream HTTP status, and field-level validation is no_match. See the Brazil section of the Database Validation Outcome Codes reference for the full code list. + * + *

CHL (Chile): screened_data: {personal_number, first_name, last_name, date_of_birth}. source_data: {identification_number, first_name, last_name, date_of_birth, gender} + * + *

COL (Colombia): screened_data: {document_number, document_type, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, document_type} + * + *

CRI (Costa Rica): screened_data: {personal_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

DOM (Dominican Republic): screened_data: {personal_number}. source_data: {identification_number} (returns valid/invalid only) + * + *

ECU (Ecuador): screened_data: {personal_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, street, formatted_address, gender, nationality, education, marital_status, spouse, mother_name, father_name, profession} + * + *

ESP (Spain): screened_data: {personal_number, document_type, expiration_date, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, document_type, expiration_date} + * + *

GTM (Guatemala): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

HND (Honduras): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

MEX (Mexico): screened_data: {personal_number (CURP), first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, date_of_birth, gender, nationality, curp_status, state_of_birth, doc_probatorio, registration_year, registration_state, registration_municipality, num_acta, crip, issuing_state_code, foreign_registry_number, folio_carta, folio_certificado}. Uses the RENAPO civil registry. A separate INE validity-check service is also available for MEX as an additional one-by-one validation. + * + *

PAN (Panama): screened_data: {personal_number, selfie}. source_data: {identification_number}. Uses SIB biometric validation + * + *

PER (Peru): screened_data: {personal_number (DNI), first_name, last_name}. source_data: {identification_number, first_name, last_name, paternal_name, maternal_name, verification_number, verification_letter} + * + *

PRY (Paraguay): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

SLV (El Salvador): screened_data: {document_number, date_of_birth, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

URY (Uruguay): screened_data: {personal_number, date_of_birth, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name} + * + *

VEN (Venezuela): screened_data: {document_number, first_name, last_name}. source_data: {identification_number, first_name, last_name, full_name, gender, date_of_birth, document_type} + * + * @param databaseValidations the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder databaseValidations(@Nullable List databaseValidations) { + return setNullable("database_validations", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations::fromJson)), databaseValidations); + } + + /** + * The reviews field. + * + * @param reviews the value + * @return this builder + */ + public Builder reviews(List reviews) { + return set("reviews", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.Reviews::fromJson)), reviews); + } + + /** + * Timestamp at which the session was created (ISO 8601, UTC). + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Timestamp at which this session is scheduled to expire. Set on User Verification (KYC) sessions when an expiration was configured at creation time (or once Approved status triggers KYC expiry computation). null for sessions without a configured expiration, and for kinds that do not use expiry (e.g. Business Verification (KYB) sessions that never received an expires_at). + * + * @param expiresAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expiresAt(@Nullable OffsetDateTime expiresAt) { + return setNullable("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Company registry checks. Present only when session_kind = business. Each item wraps the full company-registry payload. + * + * @param registryChecks the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryChecks(@Nullable List registryChecks) { + return setNullable("registry_checks", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks::fromJson)), registryChecks); + } + + /** + * Aggregate key-people checks. Present only when session_kind = business. Each item uses the two-bucket shape (registry, submitted, ubo_kyc_summary). + * + * @param keyPeopleChecks the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder keyPeopleChecks(@Nullable List keyPeopleChecks) { + return setNullable("key_people_checks", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks::fromJson)), keyPeopleChecks); + } + + /** + * Document verification checks grouped by workflow node. Present only when session_kind = business. + * + * @param documentVerifications the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentVerifications(@Nullable List documentVerifications) { + return setNullable("document_verifications", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications::fromJson)), documentVerifications); + } + + /** + * Whether the session was created by a live application (live) or a sandbox application (sandbox). Sandbox sessions are free, fully simulated, and never bill credits. + * + * @param environment the value + * @return this builder + */ + public Builder environment(SessionsRetrieveDecisionResponse.Environment environment) { + return set("environment", Conv.enumeration(SessionsRetrieveDecisionResponse.Environment::of), environment); + } + + /** + * Returned only with include=resubmissions, for user and business sessions. One entry per resubmission request, oldest first. Each entry carries the results the resubmitted steps returned before the request, so earlier submissions stay readable. Deleting the session deletes every submission. + * + * @param resubmissions the value + * @return this builder + */ + public Builder resubmissions(List resubmissions) { + return set("resubmissions", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.Resubmissions::fromJson)), resubmissions); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsRetrieveDecisionResponse} + */ + public SessionsRetrieveDecisionResponse build() { + return new SessionsRetrieveDecisionResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Discriminator indicating whether this is a User Verification (KYC) or Business Verification (KYB) session. When user, the KYC feature arrays (id_verifications, nfc_verifications, liveness_checks, face_matches, poa_verifications, document_ai_documents, database_validations, ...) apply and the business arrays are absent. When business, the payload instead carries registry_checks, document_verifications, key_people_checks plus the shared arrays (aml_screenings, phone_verifications, email_verifications, ip_analyses, questionnaire_responses). **Omitted when include=events is passed** โ€” the events shape only exists for user sessions, so the discriminator is dropped from that variant. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SessionKind extends StringEnum { + /** The value {@code "user"}. */ + public static final SessionKind USER = new SessionKind("user"); + + /** The value {@code "business"}. */ + public static final SessionKind BUSINESS = new SessionKind("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private SessionKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SessionKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SessionKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Overall lifecycle status of the session โ€” the rolled-up workflow result. Terminal values are Approved, Declined, In Review, Expired, Kyc Expired, and Abandoned; Not Started, In Progress, Awaiting User, and Resubmitted indicate the session is still moving through the workflow. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final Status NOT_STARTED = new Status("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final Status IN_PROGRESS = new Status("In Progress"); + + /** The value {@code "Awaiting User"}. */ + public static final Status AWAITING_USER = new Status("Awaiting User"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "Resubmitted"}. */ + public static final Status RESUBMITTED = new Status("Resubmitted"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + /** The value {@code "Kyc Expired"}. */ + public static final Status KYC_EXPIRED = new Status("Kyc Expired"); + + /** The value {@code "Abandoned"}. */ + public static final Status ABANDONED = new Status("Abandoned"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, AWAITING_USER, IN_REVIEW, APPROVED, DECLINED, RESUBMITTED, EXPIRED, KYC_EXPIRED, ABANDONED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Expected details supplied at session creation โ€” used for cross-validation against extracted data (KYC) or to pre-fill the company registry search (KYB). Echoes back exactly the keys that were provided; null when none were supplied. KYC sessions carry the person fields; Business (KYB) sessions carry company_name, registry_country and registration_number. + */ + public static final class ExpectedDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("first_name", "last_name", "date_of_birth", "gender", "nationality", "country", "address", "identification_number", "ip_address", "expected_document_types", "id_country", "poa_country", "company_name", "registry_country", "registration_number"); + + private ExpectedDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ExpectedDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ExpectedDetails fromJson(JsonNode json) { + return new ExpectedDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * User's first name. For example, John. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * User's last name. For example, Doe. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * User's date of birth with format: YYYY-MM-DD. For example, 1990-05-15. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * User's gender. Must be either 'M', 'F', or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.enumeration(SessionsRetrieveDecisionResponse.ExpectedDetails.Gender::of)); + } + + /** + * ISO 3166-1 alpha-3 country code representing the applicant's country of origin. For example, USA. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country code representing the country of the Proof of Address document, or the country of the applicant's ID document, which may differ from nationality. For example, GBR. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The address in a human readable format, including as much information as possible. For example, 123 Main St, San Francisco, CA 94105, USA. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * The user's document number, personal number, or tax number. For example, 123456789. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identificationNumber() { + return Json.optional(json, "identification_number", Conv.STRING); + } + + /** + * Expected IP address for the session. If the actual IP address differs from this value, a warning will be logged. For example, 192.168.1.100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Document types the ID verification step was restricted to at session creation. Empty/unset means no restriction. Codes: P (passport), ID (national ID), DL (driver's license), RP (residence permit), HIC (health insurance card), TC (tax card), SSC (social security card). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> expectedDocumentTypes() { + return Json.optional(json, "expected_document_types", Conv.list(Conv.enumeration(SessionsRetrieveDecisionResponse.ExpectedDetails.ExpectedDocumentTypes::of))); + } + + /** + * Expected ID-document issuing country (ISO 3166-1 alpha-3), when restricted at creation time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional idCountry() { + return Json.optional(json, "id_country", Conv.STRING); + } + + /** + * Expected Proof of Address document country (ISO 3166-1 alpha-3), when restricted at creation time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaCountry() { + return Json.optional(json, "poa_country", Conv.STRING); + } + + /** + * Expected legal name of the business. Business (KYB) sessions only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * Expected registry country as XX or XX-YY (ISO 3166-1 alpha-2, optionally with an ISO 3166-2 subdivision for state-level registries, e.g. US-CA). Business (KYB) sessions only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryCountry() { + return Json.optional(json, "registry_country", Conv.STRING); + } + + /** + * Expected company registration number. Business (KYB) sessions only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ExpectedDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ExpectedDetails from) { + super(from); + } + + /** + * User's first name. For example, John. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * User's last name. For example, Doe. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * User's date of birth with format: YYYY-MM-DD. For example, 1990-05-15. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * User's gender. Must be either 'M', 'F', or null. + * + * @param gender the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder gender(SessionsRetrieveDecisionResponse.ExpectedDetails.@Nullable Gender gender) { + return setNullable("gender", Conv.enumeration(SessionsRetrieveDecisionResponse.ExpectedDetails.Gender::of), gender); + } + + /** + * ISO 3166-1 alpha-3 country code representing the applicant's country of origin. For example, USA. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * ISO 3166-1 alpha-3 country code representing the country of the Proof of Address document, or the country of the applicant's ID document, which may differ from nationality. For example, GBR. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * The address in a human readable format, including as much information as possible. For example, 123 Main St, San Francisco, CA 94105, USA. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * The user's document number, personal number, or tax number. For example, 123456789. + * + * @param identificationNumber the value + * @return this builder + */ + public Builder identificationNumber(String identificationNumber) { + return set("identification_number", Conv.STRING, identificationNumber); + } + + /** + * Expected IP address for the session. If the actual IP address differs from this value, a warning will be logged. For example, 192.168.1.100. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Document types the ID verification step was restricted to at session creation. Empty/unset means no restriction. Codes: P (passport), ID (national ID), DL (driver's license), RP (residence permit), HIC (health insurance card), TC (tax card), SSC (social security card). + * + * @param expectedDocumentTypes the value + * @return this builder + */ + public Builder expectedDocumentTypes(List expectedDocumentTypes) { + return set("expected_document_types", Conv.list(Conv.enumeration(SessionsRetrieveDecisionResponse.ExpectedDetails.ExpectedDocumentTypes::of)), expectedDocumentTypes); + } + + /** + * Expected ID-document issuing country (ISO 3166-1 alpha-3), when restricted at creation time. + * + * @param idCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder idCountry(@Nullable String idCountry) { + return setNullable("id_country", Conv.STRING, idCountry); + } + + /** + * Expected Proof of Address document country (ISO 3166-1 alpha-3), when restricted at creation time. + * + * @param poaCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaCountry(@Nullable String poaCountry) { + return setNullable("poa_country", Conv.STRING, poaCountry); + } + + /** + * Expected legal name of the business. Business (KYB) sessions only. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * Expected registry country as XX or XX-YY (ISO 3166-1 alpha-2, optionally with an ISO 3166-2 subdivision for state-level registries, e.g. US-CA). Business (KYB) sessions only. + * + * @param registryCountry the value + * @return this builder + */ + public Builder registryCountry(String registryCountry) { + return set("registry_country", Conv.STRING, registryCountry); + } + + /** + * Expected company registration number. Business (KYB) sessions only. + * + * @param registrationNumber the value + * @return this builder + */ + public Builder registrationNumber(String registrationNumber) { + return set("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ExpectedDetails} + */ + public ExpectedDetails build() { + return new ExpectedDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * User's gender. Must be either 'M', 'F', or null. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Gender extends StringEnum { + /** The value {@code "M"}. */ + public static final Gender M = new Gender("M"); + + /** The value {@code "F"}. */ + public static final Gender F = new Gender("F"); + + private static final List KNOWN_VALUES = List.of(M, F); + + private Gender(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Gender of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Gender::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExpectedDocumentTypes extends StringEnum { + /** The value {@code "P"}. */ + public static final ExpectedDocumentTypes P = new ExpectedDocumentTypes("P"); + + /** The value {@code "ID"}. */ + public static final ExpectedDocumentTypes ID = new ExpectedDocumentTypes("ID"); + + /** The value {@code "DL"}. */ + public static final ExpectedDocumentTypes DL = new ExpectedDocumentTypes("DL"); + + /** The value {@code "RP"}. */ + public static final ExpectedDocumentTypes RP = new ExpectedDocumentTypes("RP"); + + /** The value {@code "HIC"}. */ + public static final ExpectedDocumentTypes HIC = new ExpectedDocumentTypes("HIC"); + + /** The value {@code "TC"}. */ + public static final ExpectedDocumentTypes TC = new ExpectedDocumentTypes("TC"); + + /** The value {@code "SSC"}. */ + public static final ExpectedDocumentTypes SSC = new ExpectedDocumentTypes("SSC"); + + private static final List KNOWN_VALUES = List.of(P, ID, DL, RP, HIC, TC, SSC); + + private ExpectedDocumentTypes(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExpectedDocumentTypes of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExpectedDocumentTypes::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Contact details supplied when the session was created (used for notification emails, prefilled phone/email verification, and communication language). null when neither an email nor a phone number was provided. + */ + public static final class ContactDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "email_lang", "send_notification_emails", "phone"); + + private ContactDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ContactDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ContactDetails fromJson(JsonNode json) { + return new ContactDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Email address of the user (e.g., "john.doe@example.com") that will be used during the Email Verification step. If not provided, the user must provide it during the verification flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * Language code (ISO 639-1) for email notifications. Controls the language of all email communications (e.g., "en", "es", "fr"). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailLang() { + return Json.optional(json, "email_lang", Conv.STRING); + } + + /** + * If true and an email is provided, Didit sends the initial "Verify your identity" email asynchronously when the User Verification (KYC) or Business Verification (KYB) session is created. Didit also sends verification status notifications for sessions requiring manual review to the provided email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sendNotificationEmails() { + return Json.optional(json, "send_notification_emails", Conv.BOOLEAN); + } + + /** + * Phone number of the user in E.164 format if available (e.g., +14155552671). null when only an email was supplied at session creation. Note: This field returns the original phone number provided during session creation. If the number was invalid, it may not be in E.164 format. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ContactDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ContactDetails from) { + super(from); + } + + /** + * Email address of the user (e.g., "john.doe@example.com") that will be used during the Email Verification step. If not provided, the user must provide it during the verification flow. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Language code (ISO 639-1) for email notifications. Controls the language of all email communications (e.g., "en", "es", "fr"). + * + * @param emailLang the value + * @return this builder + */ + public Builder emailLang(String emailLang) { + return set("email_lang", Conv.STRING, emailLang); + } + + /** + * If true and an email is provided, Didit sends the initial "Verify your identity" email asynchronously when the User Verification (KYC) or Business Verification (KYB) session is created. Didit also sends verification status notifications for sessions requiring manual review to the provided email address. + * + * @param sendNotificationEmails the value + * @return this builder + */ + public Builder sendNotificationEmails(boolean sendNotificationEmails) { + return set("send_notification_emails", Conv.BOOLEAN, sendNotificationEmails); + } + + /** + * Phone number of the user in E.164 format if available (e.g., +14155552671). null when only an email was supplied at session creation. Note: This field returns the original phone number provided during session creation. If the number was invalid, it may not be in E.164 format. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(@Nullable String phone) { + return setNullable("phone", Conv.STRING, phone); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ContactDetails} + */ + public ContactDetails build() { + return new ContactDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * One ID verification report - the full report for a single ID Verification step. verification_method says which of the three methods produced it (document capture, non-doc lookup or wallet sign-in) and the method-specific evidence block is populated accordingly. + */ + public static final class IdVerifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "verification_method", "assurance", "wallet_provider", "fallback_from", "id_lookup", "wallet_verification", "status", "document_type", "document_subtype", "document_number", "personal_number", "portrait_image", "front_image", "front_video", "back_image", "back_video", "full_front_image", "full_back_image", "front_image_camera_front", "back_image_camera_front", "date_of_birth", "age", "expiration_date", "date_of_issue", "issuing_state", "issuing_state_name", "first_name", "last_name", "full_name", "gender", "address", "formatted_address", "place_of_birth", "marital_status", "nationality", "extra_fields", "mrz", "parsed_address", "extra_files", "front_image_camera_front_face_match_score", "back_image_camera_front_face_match_score", "document_selfie_face_matches", "front_image_quality_score", "back_image_quality_score", "warnings", "matches", "document_liveness"); + + private IdVerifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IdVerifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IdVerifications fromJson(JsonNode json) { + return new IdVerifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node id of the OCR step that produced this report. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Which ID Verification method produced this report. document - the user photographed a physical ID (the default, and the value on every session created before the other methods existed). id_lookup - the user typed their national ID number and it was checked against a government register or another authoritative source for that country (id_lookup.source names which). wallet - the user signed in with a government or bank digital identity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationMethod() { + return Json.optional(json, "verification_method", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.VerificationMethod::of)); + } + + /** + * Assurance tier derived from verification_method: documentary for a document that was captured and checked, data_match for details that matched a record held by the source queried, cryptographic for attributes an identity provider authenticated and signed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assurance() { + return Json.optional(json, "assurance", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.Assurance::of)); + } + + /** + * Catalog wallet id when verification_method is wallet (mitid, bankid_se, itsme, ...). null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional walletProvider() { + return Json.optional(json, "wallet_provider", Conv.STRING); + } + + /** + * Why a non-document method ended the ID step. Set on the declined report when a lookup or a wallet sign-in failed and the country's fallback switch was decline. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fallbackFrom() { + return Json.optional(json, "fallback_from", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.FallbackFrom::fromJson)); + } + + /** + * Registry evidence. Present only when verification_method is id_lookup; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional idLookup() { + return Json.optional(json, "id_lookup", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup::fromJson)); + } + + /** + * Credential evidence. Present only when verification_method is wallet; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional walletVerification() { + return Json.optional(json, "wallet_verification", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.WalletVerification::fromJson)); + } + + /** + * Feature-level status of this ID verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.Status::of)); + } + + /** + * Type of identity document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * Accepted document subtype code from the workflow document settings, including the document region when applicable. Examples: ID_CARD_GENERIC, QUEENSLAND_DRIVER_LICENSE_GENERIC. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * Document identification number + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * Personal identification number + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * URL of the portrait image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImage() { + return Json.optional(json, "portrait_image", Conv.STRING); + } + + /** + * URL of the front document image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImage() { + return Json.optional(json, "front_image", Conv.STRING); + } + + /** + * URL of the front document video + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontVideo() { + return Json.optional(json, "front_video", Conv.STRING); + } + + /** + * URL of the back document image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImage() { + return Json.optional(json, "back_image", Conv.STRING); + } + + /** + * URL of the back document video + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backVideo() { + return Json.optional(json, "back_video", Conv.STRING); + } + + /** + * URL of the full front document image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullFrontImage() { + return Json.optional(json, "full_front_image", Conv.STRING); + } + + /** + * URL of the full back document image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullBackImage() { + return Json.optional(json, "full_back_image", Conv.STRING); + } + + /** + * URL of the front document image captured from the front-facing camera + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageCameraFront() { + return Json.optional(json, "front_image_camera_front", Conv.STRING); + } + + /** + * URL of the back document image captured from the front-facing camera + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImageCameraFront() { + return Json.optional(json, "back_image_camera_front", Conv.STRING); + } + + /** + * Date of birth from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Calculated age from date of birth + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional age() { + return Json.optional(json, "age", Conv.LONG); + } + + /** + * Document expiration date + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * Document issue date + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfIssue() { + return Json.optional(json, "date_of_issue", Conv.DATE); + } + + /** + * ISO code of issuing state + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * Full name of issuing state + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingStateName() { + return Json.optional(json, "issuing_state_name", Conv.STRING); + } + + /** + * First name from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Last name from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Full name from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * Gender from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * Raw address from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Formatted full address + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + /** + * Place of birth from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + /** + * Marital status from document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maritalStatus() { + return Json.optional(json, "marital_status", Conv.STRING); + } + + /** + * ISO nationality code + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Additional document fields. Includes document-specific attributes (e.g. dl_categories, blood_group, sponsor, employer, dl_class_code_b_from, dl_class_code_b_to). Driver license class validity dates are returned as dl_class_code_<class>_from and dl_class_code_<class>_to, and per-class restriction/information codes (e.g. column 12 of UK licences) as dl_class_code_<class>_notes. When the document carries names, address, or place of birth in multiple scripts, this object also includes alternate-script versions of those fields. The workflow setting preferred_characters (latin or non_latin) controls which script populates the top-level fields (first_name, last_name, full_name, address, place_of_birth); the opposite script lands here as first_name_non_latin / last_name_non_latin / full_name_non_latin / middle_name_non_latin / address_non_latin / place_of_birth_non_latin (when preferred_characters is latin) or with a _latin suffix (when preferred_characters is non_latin). Keys appear only when the OCR actually extracts a real alternate-script value โ€” a field whose alternate value is in the same script as the preferred set (for example, a Cyrillic-labelled field whose OCR value came back in Latin homoglyphs) is skipped. When preferred_characters is latin but the document only carries non-Latin text, Didit transliterates the extracted values and exposes first_name_latin / last_name_latin / etc. as a fallback. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional extraFields() { + return Json.optional(json, "extra_fields", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ExtraFields::fromJson)); + } + + /** + * Parsed Machine-Readable Zone (MRZ) fields extracted from the document. null if no MRZ was detected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrz() { + return Json.optional(json, "mrz", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Mrz::fromJson)); + } + + /** + * Structured address details + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional parsedAddress() { + return Json.optional(json, "parsed_address", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress::fromJson)); + } + + /** + * Additional document verification files + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFiles() { + return Json.optional(json, "extra_files", Conv.list(Conv.STRING)); + } + + /** + * Face match score between the portrait extracted from the front document image and the front camera image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageCameraFrontFaceMatchScore() { + return Json.optional(json, "front_image_camera_front_face_match_score", Conv.DOUBLE); + } + + /** + * Face match score between the portrait extracted from the back document image and the front camera image + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImageCameraFrontFaceMatchScore() { + return Json.optional(json, "back_image_camera_front_face_match_score", Conv.DOUBLE); + } + + /** + * Previous sessions or face blocklist entries whose face matched the selfie the front camera took during document capture (Silent Capture Face Search). Same entry format as liveness_checks[].matches. null for sessions created before this field existed or when the search did not run; an empty array when it ran and found nothing. match_image_url is a presigned URL that expires. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> documentSelfieFaceMatches() { + return Json.optional(json, "document_selfie_face_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches::fromJson))); + } + + /** + * Quality metrics for the front document image. Each sub-score ranges from 0 to 100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageQualityScore() { + return Json.optional(json, "front_image_quality_score", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.FrontImageQualityScore::fromJson)); + } + + /** + * Quality metrics for the back document image. Same structure as front_image_quality_score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional backImageQualityScore() { + return Json.optional(json, "back_image_quality_score", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.BackImageQualityScore::fromJson)); + } + + /** + * Document verification warnings + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Warnings::fromJson))); + } + + /** + * Matching documents found during duplicate/blocklist detection (up to 5 matches) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Matches::fromJson))); + } + + /** + * Document-liveness scores per fraud type, reported whether or not a warning fired, so an approved document can still be audited. null when the check did not run. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLiveness() { + return Json.optional(json, "document_liveness", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IdVerifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IdVerifications from) { + super(from); + } + + /** + * Workflow graph node id of the OCR step that produced this report. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Which ID Verification method produced this report. document - the user photographed a physical ID (the default, and the value on every session created before the other methods existed). id_lookup - the user typed their national ID number and it was checked against a government register or another authoritative source for that country (id_lookup.source names which). wallet - the user signed in with a government or bank digital identity. + * + * @param verificationMethod the value + * @return this builder + */ + public Builder verificationMethod(SessionsRetrieveDecisionResponse.IdVerifications.VerificationMethod verificationMethod) { + return set("verification_method", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.VerificationMethod::of), verificationMethod); + } + + /** + * Assurance tier derived from verification_method: documentary for a document that was captured and checked, data_match for details that matched a record held by the source queried, cryptographic for attributes an identity provider authenticated and signed. + * + * @param assurance the value + * @return this builder + */ + public Builder assurance(SessionsRetrieveDecisionResponse.IdVerifications.Assurance assurance) { + return set("assurance", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.Assurance::of), assurance); + } + + /** + * Catalog wallet id when verification_method is wallet (mitid, bankid_se, itsme, ...). null otherwise. + * + * @param walletProvider the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder walletProvider(@Nullable String walletProvider) { + return setNullable("wallet_provider", Conv.STRING, walletProvider); + } + + /** + * Why a non-document method ended the ID step. Set on the declined report when a lookup or a wallet sign-in failed and the country's fallback switch was decline. null otherwise. + * + * @param fallbackFrom the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fallbackFrom(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable FallbackFrom fallbackFrom) { + return setNullable("fallback_from", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.FallbackFrom::fromJson), fallbackFrom); + } + + /** + * Registry evidence. Present only when verification_method is id_lookup; null otherwise. + * + * @param idLookup the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder idLookup(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable IdLookup idLookup) { + return setNullable("id_lookup", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup::fromJson), idLookup); + } + + /** + * Credential evidence. Present only when verification_method is wallet; null otherwise. + * + * @param walletVerification the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder walletVerification(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable WalletVerification walletVerification) { + return setNullable("wallet_verification", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.WalletVerification::fromJson), walletVerification); + } + + /** + * Feature-level status of this ID verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.IdVerifications.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.Status::of), status); + } + + /** + * Type of identity document + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * Accepted document subtype code from the workflow document settings, including the document region when applicable. Examples: ID_CARD_GENERIC, QUEENSLAND_DRIVER_LICENSE_GENERIC. + * + * @param documentSubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSubtype(@Nullable String documentSubtype) { + return setNullable("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * Document identification number + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * Personal identification number + * + * @param personalNumber the value + * @return this builder + */ + public Builder personalNumber(String personalNumber) { + return set("personal_number", Conv.STRING, personalNumber); + } + + /** + * URL of the portrait image + * + * @param portraitImage the value + * @return this builder + */ + public Builder portraitImage(String portraitImage) { + return set("portrait_image", Conv.STRING, portraitImage); + } + + /** + * URL of the front document image + * + * @param frontImage the value + * @return this builder + */ + public Builder frontImage(String frontImage) { + return set("front_image", Conv.STRING, frontImage); + } + + /** + * URL of the front document video + * + * @param frontVideo the value + * @return this builder + */ + public Builder frontVideo(String frontVideo) { + return set("front_video", Conv.STRING, frontVideo); + } + + /** + * URL of the back document image + * + * @param backImage the value + * @return this builder + */ + public Builder backImage(String backImage) { + return set("back_image", Conv.STRING, backImage); + } + + /** + * URL of the back document video + * + * @param backVideo the value + * @return this builder + */ + public Builder backVideo(String backVideo) { + return set("back_video", Conv.STRING, backVideo); + } + + /** + * URL of the full front document image + * + * @param fullFrontImage the value + * @return this builder + */ + public Builder fullFrontImage(String fullFrontImage) { + return set("full_front_image", Conv.STRING, fullFrontImage); + } + + /** + * URL of the full back document image + * + * @param fullBackImage the value + * @return this builder + */ + public Builder fullBackImage(String fullBackImage) { + return set("full_back_image", Conv.STRING, fullBackImage); + } + + /** + * URL of the front document image captured from the front-facing camera + * + * @param frontImageCameraFront the value + * @return this builder + */ + public Builder frontImageCameraFront(String frontImageCameraFront) { + return set("front_image_camera_front", Conv.STRING, frontImageCameraFront); + } + + /** + * URL of the back document image captured from the front-facing camera + * + * @param backImageCameraFront the value + * @return this builder + */ + public Builder backImageCameraFront(String backImageCameraFront) { + return set("back_image_camera_front", Conv.STRING, backImageCameraFront); + } + + /** + * Date of birth from document + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Calculated age from date of birth + * + * @param age the value + * @return this builder + */ + public Builder age(long age) { + return set("age", Conv.LONG, age); + } + + /** + * Document expiration date + * + * @param expirationDate the value + * @return this builder + */ + public Builder expirationDate(LocalDate expirationDate) { + return set("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Document issue date + * + * @param dateOfIssue the value + * @return this builder + */ + public Builder dateOfIssue(LocalDate dateOfIssue) { + return set("date_of_issue", Conv.DATE, dateOfIssue); + } + + /** + * ISO code of issuing state + * + * @param issuingState the value + * @return this builder + */ + public Builder issuingState(String issuingState) { + return set("issuing_state", Conv.STRING, issuingState); + } + + /** + * Full name of issuing state + * + * @param issuingStateName the value + * @return this builder + */ + public Builder issuingStateName(String issuingStateName) { + return set("issuing_state_name", Conv.STRING, issuingStateName); + } + + /** + * First name from document + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * Last name from document + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * Full name from document + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * Gender from document + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * Raw address from document + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * Formatted full address + * + * @param formattedAddress the value + * @return this builder + */ + public Builder formattedAddress(String formattedAddress) { + return set("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * Place of birth from document + * + * @param placeOfBirth the value + * @return this builder + */ + public Builder placeOfBirth(String placeOfBirth) { + return set("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * Marital status from document + * + * @param maritalStatus the value + * @return this builder + */ + public Builder maritalStatus(String maritalStatus) { + return set("marital_status", Conv.STRING, maritalStatus); + } + + /** + * ISO nationality code + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * Additional document fields. Includes document-specific attributes (e.g. dl_categories, blood_group, sponsor, employer, dl_class_code_b_from, dl_class_code_b_to). Driver license class validity dates are returned as dl_class_code_<class>_from and dl_class_code_<class>_to, and per-class restriction/information codes (e.g. column 12 of UK licences) as dl_class_code_<class>_notes. When the document carries names, address, or place of birth in multiple scripts, this object also includes alternate-script versions of those fields. The workflow setting preferred_characters (latin or non_latin) controls which script populates the top-level fields (first_name, last_name, full_name, address, place_of_birth); the opposite script lands here as first_name_non_latin / last_name_non_latin / full_name_non_latin / middle_name_non_latin / address_non_latin / place_of_birth_non_latin (when preferred_characters is latin) or with a _latin suffix (when preferred_characters is non_latin). Keys appear only when the OCR actually extracts a real alternate-script value โ€” a field whose alternate value is in the same script as the preferred set (for example, a Cyrillic-labelled field whose OCR value came back in Latin homoglyphs) is skipped. When preferred_characters is latin but the document only carries non-Latin text, Didit transliterates the extracted values and exposes first_name_latin / last_name_latin / etc. as a fallback. + * + * @param extraFields the value + * @return this builder + */ + public Builder extraFields(SessionsRetrieveDecisionResponse.IdVerifications.ExtraFields extraFields) { + return set("extra_fields", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ExtraFields::fromJson), extraFields); + } + + /** + * Parsed Machine-Readable Zone (MRZ) fields extracted from the document. null if no MRZ was detected. + * + * @param mrz the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder mrz(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable Mrz mrz) { + return setNullable("mrz", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Mrz::fromJson), mrz); + } + + /** + * Structured address details + * + * @param parsedAddress the value + * @return this builder + */ + public Builder parsedAddress(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress parsedAddress) { + return set("parsed_address", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress::fromJson), parsedAddress); + } + + /** + * Additional document verification files + * + * @param extraFiles the value + * @return this builder + */ + public Builder extraFiles(List extraFiles) { + return set("extra_files", Conv.list(Conv.STRING), extraFiles); + } + + /** + * Face match score between the portrait extracted from the front document image and the front camera image + * + * @param frontImageCameraFrontFaceMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImageCameraFrontFaceMatchScore(@Nullable Double frontImageCameraFrontFaceMatchScore) { + return setNullable("front_image_camera_front_face_match_score", Conv.DOUBLE, frontImageCameraFrontFaceMatchScore); + } + + /** + * Face match score between the portrait extracted from the back document image and the front camera image + * + * @param backImageCameraFrontFaceMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder backImageCameraFrontFaceMatchScore(@Nullable Double backImageCameraFrontFaceMatchScore) { + return setNullable("back_image_camera_front_face_match_score", Conv.DOUBLE, backImageCameraFrontFaceMatchScore); + } + + /** + * Previous sessions or face blocklist entries whose face matched the selfie the front camera took during document capture (Silent Capture Face Search). Same entry format as liveness_checks[].matches. null for sessions created before this field existed or when the search did not run; an empty array when it ran and found nothing. match_image_url is a presigned URL that expires. + * + * @param documentSelfieFaceMatches the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSelfieFaceMatches(@Nullable List documentSelfieFaceMatches) { + return setNullable("document_selfie_face_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches::fromJson)), documentSelfieFaceMatches); + } + + /** + * Quality metrics for the front document image. Each sub-score ranges from 0 to 100. + * + * @param frontImageQualityScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImageQualityScore(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable FrontImageQualityScore frontImageQualityScore) { + return setNullable("front_image_quality_score", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.FrontImageQualityScore::fromJson), frontImageQualityScore); + } + + /** + * Quality metrics for the back document image. Same structure as front_image_quality_score. + * + * @param backImageQualityScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder backImageQualityScore(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable BackImageQualityScore backImageQualityScore) { + return setNullable("back_image_quality_score", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.BackImageQualityScore::fromJson), backImageQualityScore); + } + + /** + * Document verification warnings + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Warnings::fromJson)), warnings); + } + + /** + * Matching documents found during duplicate/blocklist detection (up to 5 matches) + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Matches::fromJson)), matches); + } + + /** + * Document-liveness scores per fraud type, reported whether or not a warning fired, so an approved document can still be audited. null when the check did not run. + * + * @param documentLiveness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentLiveness(SessionsRetrieveDecisionResponse.IdVerifications.@Nullable DocumentLiveness documentLiveness) { + return setNullable("document_liveness", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness::fromJson), documentLiveness); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IdVerifications} + */ + public IdVerifications build() { + return new IdVerifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Which ID Verification method produced this report. document - the user photographed a physical ID (the default, and the value on every session created before the other methods existed). id_lookup - the user typed their national ID number and it was checked against a government register or another authoritative source for that country (id_lookup.source names which). wallet - the user signed in with a government or bank digital identity. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VerificationMethod extends StringEnum { + /** The value {@code "document"}. */ + public static final VerificationMethod DOCUMENT = new VerificationMethod("document"); + + /** The value {@code "id_lookup"}. */ + public static final VerificationMethod ID_LOOKUP = new VerificationMethod("id_lookup"); + + /** The value {@code "wallet"}. */ + public static final VerificationMethod WALLET = new VerificationMethod("wallet"); + + private static final List KNOWN_VALUES = List.of(DOCUMENT, ID_LOOKUP, WALLET); + + private VerificationMethod(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VerificationMethod of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VerificationMethod::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Assurance tier derived from verification_method: documentary for a document that was captured and checked, data_match for details that matched a record held by the source queried, cryptographic for attributes an identity provider authenticated and signed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Assurance extends StringEnum { + /** The value {@code "documentary"}. */ + public static final Assurance DOCUMENTARY = new Assurance("documentary"); + + /** The value {@code "data_match"}. */ + public static final Assurance DATA_MATCH = new Assurance("data_match"); + + /** The value {@code "cryptographic"}. */ + public static final Assurance CRYPTOGRAPHIC = new Assurance("cryptographic"); + + private static final List KNOWN_VALUES = List.of(DOCUMENTARY, DATA_MATCH, CRYPTOGRAPHIC); + + private Assurance(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Assurance of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Assurance::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Why a non-document method ended the ID step. Set on the declined report when a lookup or a wallet sign-in failed and the country's fallback switch was decline. null otherwise. + */ + public static final class FallbackFrom extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("method", "reason", "action"); + + private FallbackFrom(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FallbackFrom} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FallbackFrom fromJson(JsonNode json) { + return new FallbackFrom(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The method that failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional method() { + return Json.optional(json, "method", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.FallbackFrom.Method::of)); + } + + /** + * The outcome that ended it, e.g. no_match, provider_error, cancelled, timeout. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The configured action that was taken, e.g. decline. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FallbackFrom}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FallbackFrom from) { + super(from); + } + + /** + * The method that failed. + * + * @param method the value + * @return this builder + */ + public Builder method(SessionsRetrieveDecisionResponse.IdVerifications.FallbackFrom.Method method) { + return set("method", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.FallbackFrom.Method::of), method); + } + + /** + * The outcome that ended it, e.g. no_match, provider_error, cancelled, timeout. + * + * @param reason the value + * @return this builder + */ + public Builder reason(String reason) { + return set("reason", Conv.STRING, reason); + } + + /** + * The configured action that was taken, e.g. decline. + * + * @param action the value + * @return this builder + */ + public Builder action(String action) { + return set("action", Conv.STRING, action); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FallbackFrom} + */ + public FallbackFrom build() { + return new FallbackFrom(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The method that failed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Method extends StringEnum { + /** The value {@code "id_lookup"}. */ + public static final Method ID_LOOKUP = new Method("id_lookup"); + + /** The value {@code "wallet"}. */ + public static final Method WALLET = new Method("wallet"); + + private static final List KNOWN_VALUES = List.of(ID_LOOKUP, WALLET); + + private Method(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Method of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Method::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Registry evidence. Present only when verification_method is id_lookup; null otherwise. + */ + public static final class IdLookup extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("source", "checked_at", "attempts", "max_attempts", "outcome", "comparison", "registry_portrait", "face_match_score"); + + private IdLookup(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IdLookup} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IdLookup fromJson(JsonNode json) { + return new IdLookup(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Customer-facing name of the source queried, e.g. Department of Home Affairs (a government register) or UK credit bureau and financial services records (not a government register). This is the only statement of provenance for the lookup; do not assume a government source. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + /** + * When the register answered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional checkedAt() { + return Json.optional(json, "checked_at", Conv.DATE_TIME); + } + + /** + * 1-based attempt number this report came from. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional attempts() { + return Json.optional(json, "attempts", Conv.LONG); + } + + /** + * Attempt budget configured for the country (1 to 5, default 1). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxAttempts() { + return Json.optional(json, "max_attempts", Conv.LONG); + } + + /** + * What the register answered. Only match, partial_match and no_match count against the attempt budget and bill. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Outcome::of)); + } + + /** + * One row per comparable field the source answered on, plus one row per source error. Comparison rows use the normalised field names below rather than the country's request field keys, because several request fields (first and last name, or any of the identifier aliases) collapse into a single comparison. A source that failed appends a row with field: "provider" and result: "error", so read result before treating a row as a field verdict. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> comparison() { + return Json.optional(json, "comparison", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison::fromJson))); + } + + /** + * Short-lived presigned URL to the portrait the source returned. Only the four government registers that return one (South Africa, Nigeria, Argentina, Panama). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryPortrait() { + return Json.optional(json, "registry_portrait", Conv.STRING); + } + + /** + * Selfie against the registry portrait, 0-100. Only where the register returns a portrait. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatchScore() { + return Json.optional(json, "face_match_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IdLookup}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IdLookup from) { + super(from); + } + + /** + * Customer-facing name of the source queried, e.g. Department of Home Affairs (a government register) or UK credit bureau and financial services records (not a government register). This is the only statement of provenance for the lookup; do not assume a government source. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * When the register answered. + * + * @param checkedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder checkedAt(@Nullable OffsetDateTime checkedAt) { + return setNullable("checked_at", Conv.DATE_TIME, checkedAt); + } + + /** + * 1-based attempt number this report came from. + * + * @param attempts the value + * @return this builder + */ + public Builder attempts(long attempts) { + return set("attempts", Conv.LONG, attempts); + } + + /** + * Attempt budget configured for the country (1 to 5, default 1). + * + * @param maxAttempts the value + * @return this builder + */ + public Builder maxAttempts(long maxAttempts) { + return set("max_attempts", Conv.LONG, maxAttempts); + } + + /** + * What the register answered. Only match, partial_match and no_match count against the attempt budget and bill. + * + * @param outcome the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder outcome(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.@Nullable Outcome outcome) { + return setNullable("outcome", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Outcome::of), outcome); + } + + /** + * One row per comparable field the source answered on, plus one row per source error. Comparison rows use the normalised field names below rather than the country's request field keys, because several request fields (first and last name, or any of the identifier aliases) collapse into a single comparison. A source that failed appends a row with field: "provider" and result: "error", so read result before treating a row as a field verdict. + * + * @param comparison the value + * @return this builder + */ + public Builder comparison(List comparison) { + return set("comparison", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison::fromJson)), comparison); + } + + /** + * Short-lived presigned URL to the portrait the source returned. Only the four government registers that return one (South Africa, Nigeria, Argentina, Panama). + * + * @param registryPortrait the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryPortrait(@Nullable String registryPortrait) { + return setNullable("registry_portrait", Conv.STRING, registryPortrait); + } + + /** + * Selfie against the registry portrait, 0-100. Only where the register returns a portrait. + * + * @param faceMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceMatchScore(@Nullable Double faceMatchScore) { + return setNullable("face_match_score", Conv.DOUBLE, faceMatchScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IdLookup} + */ + public IdLookup build() { + return new IdLookup(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * What the register answered. Only match, partial_match and no_match count against the attempt budget and bill. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "match"}. */ + public static final Outcome MATCH = new Outcome("match"); + + /** The value {@code "partial_match"}. */ + public static final Outcome PARTIAL_MATCH = new Outcome("partial_match"); + + /** The value {@code "no_match"}. */ + public static final Outcome NO_MATCH = new Outcome("no_match"); + + /** The value {@code "provider_error"}. */ + public static final Outcome PROVIDER_ERROR = new Outcome("provider_error"); + + /** The value {@code "format_rejected"}. */ + public static final Outcome FORMAT_REJECTED = new Outcome("format_rejected"); + + private static final List KNOWN_VALUES = List.of(MATCH, PARTIAL_MATCH, NO_MATCH, PROVIDER_ERROR, FORMAT_REJECTED); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Comparison extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("field", "label", "provided", "record", "result"); + + private Comparison(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Comparison} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Comparison fromJson(JsonNode json) { + return new Comparison(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Normalised comparison field. provider is not a user field: it marks a source error row. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Field field() { + return Json.required(json, "field", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Field::of)); + } + + /** + * Display label for the row, e.g. ID number, Full name, Provider. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String label() { + return Json.required(json, "label", Conv.STRING); + } + + /** + * What the user typed. null on a provider error row. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional provided() { + return Json.optional(json, "provided", Conv.STRING); + } + + /** + * What the source held. On a provider error row this carries the error message instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional record_() { + return Json.optional(json, "record", Conv.STRING); + } + + /** + * Per-field comparison result. error appears only on a provider row and means that source did not answer; treat it as evidence about the query, never as a field mismatch. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Result result() { + return Json.required(json, "result", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Result::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Comparison}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Comparison from) { + super(from); + } + + /** + * Normalised comparison field. provider is not a user field: it marks a source error row. + * + * @param field the value + * @return this builder + */ + public Builder field(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Field field) { + return set("field", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Field::of), field); + } + + /** + * Display label for the row, e.g. ID number, Full name, Provider. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * What the user typed. null on a provider error row. + * + * @param provided the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder provided(@Nullable String provided) { + return setNullable("provided", Conv.STRING, provided); + } + + /** + * What the source held. On a provider error row this carries the error message instead. + * + * @param record_ the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder record_(@Nullable String record_) { + return setNullable("record", Conv.STRING, record_); + } + + /** + * Per-field comparison result. error appears only on a provider row and means that source did not answer; treat it as evidence about the query, never as a field mismatch. + * + * @param result the value + * @return this builder + */ + public Builder result(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Result result) { + return set("result", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.IdLookup.Comparison.Result::of), result); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Comparison} + * @throws IllegalStateException when a required field is missing + */ + public Comparison build() { + require("field", false); + require("label", false); + require("provided", true); + require("record", true); + require("result", false); + return new Comparison(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Normalised comparison field. provider is not a user field: it marks a source error row. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Field extends StringEnum { + /** The value {@code "identification_number"}. */ + public static final Field IDENTIFICATION_NUMBER = new Field("identification_number"); + + /** The value {@code "full_name"}. */ + public static final Field FULL_NAME = new Field("full_name"); + + /** The value {@code "date_of_birth"}. */ + public static final Field DATE_OF_BIRTH = new Field("date_of_birth"); + + /** The value {@code "address"}. */ + public static final Field ADDRESS = new Field("address"); + + /** The value {@code "provider"}. */ + public static final Field PROVIDER = new Field("provider"); + + private static final List KNOWN_VALUES = List.of(IDENTIFICATION_NUMBER, FULL_NAME, DATE_OF_BIRTH, ADDRESS, PROVIDER); + + private Field(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Field of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Field::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-field comparison result. error appears only on a provider row and means that source did not answer; treat it as evidence about the query, never as a field mismatch. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Result extends StringEnum { + /** The value {@code "match"}. */ + public static final Result MATCH = new Result("match"); + + /** The value {@code "partial"}. */ + public static final Result PARTIAL = new Result("partial"); + + /** The value {@code "no_match"}. */ + public static final Result NO_MATCH = new Result("no_match"); + + /** The value {@code "error"}. */ + public static final Result ERROR = new Result("error"); + + private static final List KNOWN_VALUES = List.of(MATCH, PARTIAL, NO_MATCH, ERROR); + + private Result(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Result of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Result::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + /** + * Credential evidence. Present only when verification_method is wallet; null otherwise. + */ + public static final class WalletVerification extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("provider", "provider_name", "issuing_authority", "issuing_country", "credential_type", "level_of_assurance", "verified_at", "signature_valid", "attributes", "portrait", "face_match_score"); + + private WalletVerification(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletVerification} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletVerification fromJson(JsonNode json) { + return new WalletVerification(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Catalog wallet id, e.g. mitid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional provider() { + return Json.optional(json, "provider", Conv.STRING); + } + + /** + * Wallet name as the end user knows it, e.g. MitID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerName() { + return Json.optional(json, "provider_name", Conv.STRING); + } + + /** + * The authority behind the wallet, e.g. Danish Agency for Digital Government. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingAuthority() { + return Json.optional(json, "issuing_authority", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country the wallet was offered in. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingCountry() { + return Json.optional(json, "issuing_country", Conv.STRING); + } + + /** + * Credential the wallet presented, e.g. person_identification. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional credentialType() { + return Json.optional(json, "credential_type", Conv.STRING); + } + + /** + * The level of assurance the wallet asserted. A sign-in that asserts less than the level requested fails instead of downgrading. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional levelOfAssurance() { + return Json.optional(json, "level_of_assurance", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.WalletVerification.LevelOfAssurance::of)); + } + + /** + * The wallet's authentication instant. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * Whether the signed assertion the wallet returned validated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signatureValid() { + return Json.optional(json, "signature_valid", Conv.BOOLEAN); + } + + /** + * The attributes the wallet shared, keyed as the wallet's catalog entry lists them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> attributes() { + return Json.optional(json, "attributes", Conv.OBJECT); + } + + /** + * Short-lived presigned URL to the portrait the wallet shared, where it shares one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portrait() { + return Json.optional(json, "portrait", Conv.STRING); + } + + /** + * Selfie against the wallet portrait, 0-100, where the wallet shares one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatchScore() { + return Json.optional(json, "face_match_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletVerification}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletVerification from) { + super(from); + } + + /** + * Catalog wallet id, e.g. mitid. + * + * @param provider the value + * @return this builder + */ + public Builder provider(String provider) { + return set("provider", Conv.STRING, provider); + } + + /** + * Wallet name as the end user knows it, e.g. MitID. + * + * @param providerName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerName(@Nullable String providerName) { + return setNullable("provider_name", Conv.STRING, providerName); + } + + /** + * The authority behind the wallet, e.g. Danish Agency for Digital Government. + * + * @param issuingAuthority the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingAuthority(@Nullable String issuingAuthority) { + return setNullable("issuing_authority", Conv.STRING, issuingAuthority); + } + + /** + * ISO 3166-1 alpha-3 country the wallet was offered in. + * + * @param issuingCountry the value + * @return this builder + */ + public Builder issuingCountry(String issuingCountry) { + return set("issuing_country", Conv.STRING, issuingCountry); + } + + /** + * Credential the wallet presented, e.g. person_identification. + * + * @param credentialType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder credentialType(@Nullable String credentialType) { + return setNullable("credential_type", Conv.STRING, credentialType); + } + + /** + * The level of assurance the wallet asserted. A sign-in that asserts less than the level requested fails instead of downgrading. + * + * @param levelOfAssurance the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder levelOfAssurance(SessionsRetrieveDecisionResponse.IdVerifications.WalletVerification.@Nullable LevelOfAssurance levelOfAssurance) { + return setNullable("level_of_assurance", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.WalletVerification.LevelOfAssurance::of), levelOfAssurance); + } + + /** + * The wallet's authentication instant. + * + * @param verifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verifiedAt(@Nullable OffsetDateTime verifiedAt) { + return setNullable("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Whether the signed assertion the wallet returned validated. + * + * @param signatureValid the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder signatureValid(@Nullable Boolean signatureValid) { + return setNullable("signature_valid", Conv.BOOLEAN, signatureValid); + } + + /** + * The attributes the wallet shared, keyed as the wallet's catalog entry lists them. + * + * @param attributes the value + * @return this builder + */ + public Builder attributes(Map attributes) { + return setAny("attributes", attributes); + } + + /** + * Short-lived presigned URL to the portrait the wallet shared, where it shares one. + * + * @param portrait the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder portrait(@Nullable String portrait) { + return setNullable("portrait", Conv.STRING, portrait); + } + + /** + * Selfie against the wallet portrait, 0-100, where the wallet shares one. + * + * @param faceMatchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceMatchScore(@Nullable Double faceMatchScore) { + return setNullable("face_match_score", Conv.DOUBLE, faceMatchScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletVerification} + */ + public WalletVerification build() { + return new WalletVerification(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The level of assurance the wallet asserted. A sign-in that asserts less than the level requested fails instead of downgrading. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class LevelOfAssurance extends StringEnum { + /** The value {@code "low"}. */ + public static final LevelOfAssurance LOW = new LevelOfAssurance("low"); + + /** The value {@code "substantial"}. */ + public static final LevelOfAssurance SUBSTANTIAL = new LevelOfAssurance("substantial"); + + /** The value {@code "high"}. */ + public static final LevelOfAssurance HIGH = new LevelOfAssurance("high"); + + private static final List KNOWN_VALUES = List.of(LOW, SUBSTANTIAL, HIGH); + + private LevelOfAssurance(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static LevelOfAssurance of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, LevelOfAssurance::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Feature-level status of this ID verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, EXPIRED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Additional document fields. Includes document-specific attributes (e.g. dl_categories, blood_group, sponsor, employer, dl_class_code_b_from, dl_class_code_b_to). Driver license class validity dates are returned as dl_class_code_<class>_from and dl_class_code_<class>_to, and per-class restriction/information codes (e.g. column 12 of UK licences) as dl_class_code_<class>_notes. When the document carries names, address, or place of birth in multiple scripts, this object also includes alternate-script versions of those fields. The workflow setting preferred_characters (latin or non_latin) controls which script populates the top-level fields (first_name, last_name, full_name, address, place_of_birth); the opposite script lands here as first_name_non_latin / last_name_non_latin / full_name_non_latin / middle_name_non_latin / address_non_latin / place_of_birth_non_latin (when preferred_characters is latin) or with a _latin suffix (when preferred_characters is non_latin). Keys appear only when the OCR actually extracts a real alternate-script value โ€” a field whose alternate value is in the same script as the preferred set (for example, a Cyrillic-labelled field whose OCR value came back in Latin homoglyphs) is skipped. When preferred_characters is latin but the document only carries non-Latin text, Didit transliterates the extracted values and exposes first_name_latin / last_name_latin / etc. as a fallback. + */ + public static final class ExtraFields extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("dl_categories", "blood_group", "first_name_non_latin", "last_name_non_latin", "middle_name_non_latin", "full_name_non_latin", "address_non_latin", "place_of_birth_non_latin", "first_name_latin", "last_name_latin", "middle_name_latin", "full_name_latin", "address_latin", "place_of_birth_latin"); + + private ExtraFields(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ExtraFields} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ExtraFields fromJson(JsonNode json) { + return new ExtraFields(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The dl_categories field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> dlCategories() { + return Json.optional(json, "dl_categories", Conv.list(Conv.STRING)); + } + + /** + * The blood_group field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bloodGroup() { + return Json.optional(json, "blood_group", Conv.STRING); + } + + /** + * First name in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document (e.g. ะะนะฝะฐ for a Kyrgyz ID). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstNameNonLatin() { + return Json.optional(json, "first_name_non_latin", Conv.STRING); + } + + /** + * Surname in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastNameNonLatin() { + return Json.optional(json, "last_name_non_latin", Conv.STRING); + } + + /** + * Middle name / patronymic in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional middleNameNonLatin() { + return Json.optional(json, "middle_name_non_latin", Conv.STRING); + } + + /** + * Composed full name in the non-Latin script. Reconstructed from the individual components when both first and last names are available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullNameNonLatin() { + return Json.optional(json, "full_name_non_latin", Conv.STRING); + } + + /** + * Address in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressNonLatin() { + return Json.optional(json, "address_non_latin", Conv.STRING); + } + + /** + * Place of birth in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirthNonLatin() { + return Json.optional(json, "place_of_birth_non_latin", Conv.STRING); + } + + /** + * First name in Latin script. Populated when preferred_characters=non_latin and a Latin version is present on the document, or โ€” as a transliteration fallback โ€” when preferred_characters=latin but the document only carries non-Latin text. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstNameLatin() { + return Json.optional(json, "first_name_latin", Conv.STRING); + } + + /** + * Surname in Latin script. Same rules as first_name_latin. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastNameLatin() { + return Json.optional(json, "last_name_latin", Conv.STRING); + } + + /** + * Middle name / patronymic in Latin script. Same rules as first_name_latin. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional middleNameLatin() { + return Json.optional(json, "middle_name_latin", Conv.STRING); + } + + /** + * Composed full name in Latin script. Always reconstructed from the individual components when both first and last names are available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullNameLatin() { + return Json.optional(json, "full_name_latin", Conv.STRING); + } + + /** + * Address in Latin script. Same rules as first_name_latin. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressLatin() { + return Json.optional(json, "address_latin", Conv.STRING); + } + + /** + * Place of birth in Latin script. Same rules as first_name_latin. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirthLatin() { + return Json.optional(json, "place_of_birth_latin", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ExtraFields}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ExtraFields from) { + super(from); + } + + /** + * The dl_categories field. + * + * @param dlCategories the value + * @return this builder + */ + public Builder dlCategories(List dlCategories) { + return set("dl_categories", Conv.list(Conv.STRING), dlCategories); + } + + /** + * The blood_group field. + * + * @param bloodGroup the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bloodGroup(@Nullable String bloodGroup) { + return setNullable("blood_group", Conv.STRING, bloodGroup); + } + + /** + * First name in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document (e.g. ะะนะฝะฐ for a Kyrgyz ID). + * + * @param firstNameNonLatin the value + * @return this builder + */ + public Builder firstNameNonLatin(String firstNameNonLatin) { + return set("first_name_non_latin", Conv.STRING, firstNameNonLatin); + } + + /** + * Surname in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @param lastNameNonLatin the value + * @return this builder + */ + public Builder lastNameNonLatin(String lastNameNonLatin) { + return set("last_name_non_latin", Conv.STRING, lastNameNonLatin); + } + + /** + * Middle name / patronymic in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @param middleNameNonLatin the value + * @return this builder + */ + public Builder middleNameNonLatin(String middleNameNonLatin) { + return set("middle_name_non_latin", Conv.STRING, middleNameNonLatin); + } + + /** + * Composed full name in the non-Latin script. Reconstructed from the individual components when both first and last names are available. + * + * @param fullNameNonLatin the value + * @return this builder + */ + public Builder fullNameNonLatin(String fullNameNonLatin) { + return set("full_name_non_latin", Conv.STRING, fullNameNonLatin); + } + + /** + * Address in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @param addressNonLatin the value + * @return this builder + */ + public Builder addressNonLatin(String addressNonLatin) { + return set("address_non_latin", Conv.STRING, addressNonLatin); + } + + /** + * Place of birth in the non-Latin script when preferred_characters=latin and a non-Latin version is present on the document. + * + * @param placeOfBirthNonLatin the value + * @return this builder + */ + public Builder placeOfBirthNonLatin(String placeOfBirthNonLatin) { + return set("place_of_birth_non_latin", Conv.STRING, placeOfBirthNonLatin); + } + + /** + * First name in Latin script. Populated when preferred_characters=non_latin and a Latin version is present on the document, or โ€” as a transliteration fallback โ€” when preferred_characters=latin but the document only carries non-Latin text. + * + * @param firstNameLatin the value + * @return this builder + */ + public Builder firstNameLatin(String firstNameLatin) { + return set("first_name_latin", Conv.STRING, firstNameLatin); + } + + /** + * Surname in Latin script. Same rules as first_name_latin. + * + * @param lastNameLatin the value + * @return this builder + */ + public Builder lastNameLatin(String lastNameLatin) { + return set("last_name_latin", Conv.STRING, lastNameLatin); + } + + /** + * Middle name / patronymic in Latin script. Same rules as first_name_latin. + * + * @param middleNameLatin the value + * @return this builder + */ + public Builder middleNameLatin(String middleNameLatin) { + return set("middle_name_latin", Conv.STRING, middleNameLatin); + } + + /** + * Composed full name in Latin script. Always reconstructed from the individual components when both first and last names are available. + * + * @param fullNameLatin the value + * @return this builder + */ + public Builder fullNameLatin(String fullNameLatin) { + return set("full_name_latin", Conv.STRING, fullNameLatin); + } + + /** + * Address in Latin script. Same rules as first_name_latin. + * + * @param addressLatin the value + * @return this builder + */ + public Builder addressLatin(String addressLatin) { + return set("address_latin", Conv.STRING, addressLatin); + } + + /** + * Place of birth in Latin script. Same rules as first_name_latin. + * + * @param placeOfBirthLatin the value + * @return this builder + */ + public Builder placeOfBirthLatin(String placeOfBirthLatin) { + return set("place_of_birth_latin", Conv.STRING, placeOfBirthLatin); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ExtraFields} + */ + public ExtraFields build() { + return new ExtraFields(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Parsed Machine-Readable Zone (MRZ) fields extracted from the document. null if no MRZ was detected. + */ + public static final class Mrz extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("surname", "name", "country", "nationality", "birth_date", "expiry_date", "sex", "document_type", "document_number", "optional_data", "optional_data_2", "birth_date_hash", "expiry_date_hash", "document_number_hash", "final_hash", "personal_number", "warnings", "errors", "mrz_type", "mrz_string", "mrz_key"); + + private Mrz(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Mrz} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Mrz fromJson(JsonNode json) { + return new Mrz(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The surname field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional surname() { + return Json.optional(json, "surname", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The birth_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthDate() { + return Json.optional(json, "birth_date", Conv.STRING); + } + + /** + * The expiry_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiryDate() { + return Json.optional(json, "expiry_date", Conv.STRING); + } + + /** + * The sex field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sex() { + return Json.optional(json, "sex", Conv.STRING); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * The optional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional optionalData() { + return Json.optional(json, "optional_data", Conv.STRING); + } + + /** + * The optional_data_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional optionalData2() { + return Json.optional(json, "optional_data_2", Conv.STRING); + } + + /** + * The birth_date_hash field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthDateHash() { + return Json.optional(json, "birth_date_hash", Conv.STRING); + } + + /** + * The expiry_date_hash field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiryDateHash() { + return Json.optional(json, "expiry_date_hash", Conv.STRING); + } + + /** + * The document_number_hash field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumberHash() { + return Json.optional(json, "document_number_hash", Conv.STRING); + } + + /** + * The final_hash field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional finalHash() { + return Json.optional(json, "final_hash", Conv.STRING); + } + + /** + * The personal_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.STRING)); + } + + /** + * The errors field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> errors() { + return Json.optional(json, "errors", Conv.list(Conv.STRING)); + } + + /** + * The mrz_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrzType() { + return Json.optional(json, "mrz_type", Conv.STRING); + } + + /** + * The mrz_string field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrzString() { + return Json.optional(json, "mrz_string", Conv.STRING); + } + + /** + * The mrz_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mrzKey() { + return Json.optional(json, "mrz_key", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Mrz}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Mrz from) { + super(from); + } + + /** + * The surname field. + * + * @param surname the value + * @return this builder + */ + public Builder surname(String surname) { + return set("surname", Conv.STRING, surname); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The country field. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * The nationality field. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * The birth_date field. + * + * @param birthDate the value + * @return this builder + */ + public Builder birthDate(String birthDate) { + return set("birth_date", Conv.STRING, birthDate); + } + + /** + * The expiry_date field. + * + * @param expiryDate the value + * @return this builder + */ + public Builder expiryDate(String expiryDate) { + return set("expiry_date", Conv.STRING, expiryDate); + } + + /** + * The sex field. + * + * @param sex the value + * @return this builder + */ + public Builder sex(String sex) { + return set("sex", Conv.STRING, sex); + } + + /** + * The document_type field. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * The document_number field. + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * The optional_data field. + * + * @param optionalData the value + * @return this builder + */ + public Builder optionalData(String optionalData) { + return set("optional_data", Conv.STRING, optionalData); + } + + /** + * The optional_data_2 field. + * + * @param optionalData2 the value + * @return this builder + */ + public Builder optionalData2(String optionalData2) { + return set("optional_data_2", Conv.STRING, optionalData2); + } + + /** + * The birth_date_hash field. + * + * @param birthDateHash the value + * @return this builder + */ + public Builder birthDateHash(String birthDateHash) { + return set("birth_date_hash", Conv.STRING, birthDateHash); + } + + /** + * The expiry_date_hash field. + * + * @param expiryDateHash the value + * @return this builder + */ + public Builder expiryDateHash(String expiryDateHash) { + return set("expiry_date_hash", Conv.STRING, expiryDateHash); + } + + /** + * The document_number_hash field. + * + * @param documentNumberHash the value + * @return this builder + */ + public Builder documentNumberHash(String documentNumberHash) { + return set("document_number_hash", Conv.STRING, documentNumberHash); + } + + /** + * The final_hash field. + * + * @param finalHash the value + * @return this builder + */ + public Builder finalHash(String finalHash) { + return set("final_hash", Conv.STRING, finalHash); + } + + /** + * The personal_number field. + * + * @param personalNumber the value + * @return this builder + */ + public Builder personalNumber(String personalNumber) { + return set("personal_number", Conv.STRING, personalNumber); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.STRING), warnings); + } + + /** + * The errors field. + * + * @param errors the value + * @return this builder + */ + public Builder errors(List errors) { + return set("errors", Conv.list(Conv.STRING), errors); + } + + /** + * The mrz_type field. + * + * @param mrzType the value + * @return this builder + */ + public Builder mrzType(String mrzType) { + return set("mrz_type", Conv.STRING, mrzType); + } + + /** + * The mrz_string field. + * + * @param mrzString the value + * @return this builder + */ + public Builder mrzString(String mrzString) { + return set("mrz_string", Conv.STRING, mrzString); + } + + /** + * The mrz_key field. + * + * @param mrzKey the value + * @return this builder + */ + public Builder mrzKey(String mrzKey) { + return set("mrz_key", Conv.STRING, mrzKey); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Mrz} + */ + public Mrz build() { + return new Mrz(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Structured address details */ + public static final class ParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("city", "label", "region", "country", "category", "street_1", "street_2", "is_verified", "postal_code", "raw_results", "address_type", "document_location", "formatted_address"); + + private ParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ParsedAddress fromJson(JsonNode json) { + return new ParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The region field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * Two-letter country code + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Address category (e.g., Residential, Commercial) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * Whether the address has been verified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVerified() { + return Json.optional(json, "is_verified", Conv.BOOLEAN); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * The raw_results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rawResults() { + return Json.optional(json, "raw_results", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults::fromJson)); + } + + /** + * The address_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * The document_location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLocation() { + return Json.optional(json, "document_location", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.DocumentLocation::fromJson)); + } + + /** + * The formatted_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ParsedAddress from) { + super(from); + } + + /** + * The city field. + * + * @param city the value + * @return this builder + */ + public Builder city(String city) { + return set("city", Conv.STRING, city); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The region field. + * + * @param region the value + * @return this builder + */ + public Builder region(String region) { + return set("region", Conv.STRING, region); + } + + /** + * Two-letter country code + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Address category (e.g., Residential, Commercial) + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * The street_1 field. + * + * @param street1 the value + * @return this builder + */ + public Builder street1(String street1) { + return set("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * Whether the address has been verified + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * The postal_code field. + * + * @param postalCode the value + * @return this builder + */ + public Builder postalCode(String postalCode) { + return set("postal_code", Conv.STRING, postalCode); + } + + /** + * The raw_results field. + * + * @param rawResults the value + * @return this builder + */ + public Builder rawResults(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults rawResults) { + return set("raw_results", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults::fromJson), rawResults); + } + + /** + * The address_type field. + * + * @param addressType the value + * @return this builder + */ + public Builder addressType(String addressType) { + return set("address_type", Conv.STRING, addressType); + } + + /** + * The document_location field. + * + * @param documentLocation the value + * @return this builder + */ + public Builder documentLocation(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.DocumentLocation documentLocation) { + return set("document_location", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.DocumentLocation::fromJson), documentLocation); + } + + /** + * The formatted_address field. + * + * @param formattedAddress the value + * @return this builder + */ + public Builder formattedAddress(String formattedAddress) { + return set("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ParsedAddress} + */ + public ParsedAddress build() { + return new ParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class RawResults extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("types", "geometry", "place_id", "formatted_address", "navigation_points", "address_components"); + + private RawResults(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RawResults} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RawResults fromJson(JsonNode json) { + return new RawResults(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The types field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> types() { + return Json.optional(json, "types", Conv.list(Conv.STRING)); + } + + /** + * The geometry field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional geometry() { + return Json.optional(json, "geometry", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry::fromJson)); + } + + /** + * The place_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeId() { + return Json.optional(json, "place_id", Conv.STRING); + } + + /** + * The formatted_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + /** + * The navigation_points field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> navigationPoints() { + return Json.optional(json, "navigation_points", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.NavigationPoints::fromJson))); + } + + /** + * The address_components field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> addressComponents() { + return Json.optional(json, "address_components", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.AddressComponents::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RawResults}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RawResults from) { + super(from); + } + + /** + * The types field. + * + * @param types the value + * @return this builder + */ + public Builder types(List types) { + return set("types", Conv.list(Conv.STRING), types); + } + + /** + * The geometry field. + * + * @param geometry the value + * @return this builder + */ + public Builder geometry(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry geometry) { + return set("geometry", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry::fromJson), geometry); + } + + /** + * The place_id field. + * + * @param placeId the value + * @return this builder + */ + public Builder placeId(String placeId) { + return set("place_id", Conv.STRING, placeId); + } + + /** + * The formatted_address field. + * + * @param formattedAddress the value + * @return this builder + */ + public Builder formattedAddress(String formattedAddress) { + return set("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * The navigation_points field. + * + * @param navigationPoints the value + * @return this builder + */ + public Builder navigationPoints(List navigationPoints) { + return set("navigation_points", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.NavigationPoints::fromJson)), navigationPoints); + } + + /** + * The address_components field. + * + * @param addressComponents the value + * @return this builder + */ + public Builder addressComponents(List addressComponents) { + return set("address_components", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.AddressComponents::fromJson)), addressComponents); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RawResults} + */ + public RawResults build() { + return new RawResults(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Geometry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("location", "viewport", "location_type"); + + private Geometry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Geometry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Geometry fromJson(JsonNode json) { + return new Geometry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional location() { + return Json.optional(json, "location", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Location::fromJson)); + } + + /** + * The viewport field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional viewport() { + return Json.optional(json, "viewport", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport::fromJson)); + } + + /** + * The location_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationType() { + return Json.optional(json, "location_type", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Geometry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Geometry from) { + super(from); + } + + /** + * The location field. + * + * @param location the value + * @return this builder + */ + public Builder location(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Location location) { + return set("location", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Location::fromJson), location); + } + + /** + * The viewport field. + * + * @param viewport the value + * @return this builder + */ + public Builder viewport(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport viewport) { + return set("viewport", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport::fromJson), viewport); + } + + /** + * The location_type field. + * + * @param locationType the value + * @return this builder + */ + public Builder locationType(String locationType) { + return set("location_type", Conv.STRING, locationType); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Geometry} + */ + public Geometry build() { + return new Geometry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Location extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("lat", "lng"); + + private Location(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Location} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Location fromJson(JsonNode json) { + return new Location(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The lat field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lat() { + return Json.optional(json, "lat", Conv.DOUBLE); + } + + /** + * The lng field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lng() { + return Json.optional(json, "lng", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Location}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Location from) { + super(from); + } + + /** + * The lat field. + * + * @param lat the value + * @return this builder + */ + public Builder lat(double lat) { + return set("lat", Conv.DOUBLE, lat); + } + + /** + * The lng field. + * + * @param lng the value + * @return this builder + */ + public Builder lng(double lng) { + return set("lng", Conv.DOUBLE, lng); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Location} + */ + public Location build() { + return new Location(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Viewport extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("northeast", "southwest"); + + private Viewport(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Viewport} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Viewport fromJson(JsonNode json) { + return new Viewport(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The northeast field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional northeast() { + return Json.optional(json, "northeast", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport.Northeast::fromJson)); + } + + /** + * The southwest field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional southwest() { + return Json.optional(json, "southwest", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport.Southwest::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Viewport}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Viewport from) { + super(from); + } + + /** + * The northeast field. + * + * @param northeast the value + * @return this builder + */ + public Builder northeast(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport.Northeast northeast) { + return set("northeast", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport.Northeast::fromJson), northeast); + } + + /** + * The southwest field. + * + * @param southwest the value + * @return this builder + */ + public Builder southwest(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport.Southwest southwest) { + return set("southwest", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.Geometry.Viewport.Southwest::fromJson), southwest); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Viewport} + */ + public Viewport build() { + return new Viewport(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Northeast extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("lat", "lng"); + + private Northeast(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Northeast} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Northeast fromJson(JsonNode json) { + return new Northeast(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The lat field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lat() { + return Json.optional(json, "lat", Conv.DOUBLE); + } + + /** + * The lng field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lng() { + return Json.optional(json, "lng", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Northeast}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Northeast from) { + super(from); + } + + /** + * The lat field. + * + * @param lat the value + * @return this builder + */ + public Builder lat(double lat) { + return set("lat", Conv.DOUBLE, lat); + } + + /** + * The lng field. + * + * @param lng the value + * @return this builder + */ + public Builder lng(double lng) { + return set("lng", Conv.DOUBLE, lng); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Northeast} + */ + public Northeast build() { + return new Northeast(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Southwest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("lat", "lng"); + + private Southwest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Southwest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Southwest fromJson(JsonNode json) { + return new Southwest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The lat field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lat() { + return Json.optional(json, "lat", Conv.DOUBLE); + } + + /** + * The lng field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lng() { + return Json.optional(json, "lng", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Southwest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Southwest from) { + super(from); + } + + /** + * The lat field. + * + * @param lat the value + * @return this builder + */ + public Builder lat(double lat) { + return set("lat", Conv.DOUBLE, lat); + } + + /** + * The lng field. + * + * @param lng the value + * @return this builder + */ + public Builder lng(double lng) { + return set("lng", Conv.DOUBLE, lng); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Southwest} + */ + public Southwest build() { + return new Southwest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class NavigationPoints extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("location"); + + private NavigationPoints(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NavigationPoints} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NavigationPoints fromJson(JsonNode json) { + return new NavigationPoints(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional location() { + return Json.optional(json, "location", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.NavigationPoints.Location::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NavigationPoints}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NavigationPoints from) { + super(from); + } + + /** + * The location field. + * + * @param location the value + * @return this builder + */ + public Builder location(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.NavigationPoints.Location location) { + return set("location", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.ParsedAddress.RawResults.NavigationPoints.Location::fromJson), location); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NavigationPoints} + */ + public NavigationPoints build() { + return new NavigationPoints(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Location extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private Location(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Location} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Location fromJson(JsonNode json) { + return new Location(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Location}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Location from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Location} + */ + public Location build() { + return new Location(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class AddressComponents extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("types", "long_name", "short_name"); + + private AddressComponents(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AddressComponents} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AddressComponents fromJson(JsonNode json) { + return new AddressComponents(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The types field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> types() { + return Json.optional(json, "types", Conv.list(Conv.STRING)); + } + + /** + * The long_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longName() { + return Json.optional(json, "long_name", Conv.STRING); + } + + /** + * The short_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortName() { + return Json.optional(json, "short_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AddressComponents}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AddressComponents from) { + super(from); + } + + /** + * The types field. + * + * @param types the value + * @return this builder + */ + public Builder types(List types) { + return set("types", Conv.list(Conv.STRING), types); + } + + /** + * The long_name field. + * + * @param longName the value + * @return this builder + */ + public Builder longName(String longName) { + return set("long_name", Conv.STRING, longName); + } + + /** + * The short_name field. + * + * @param shortName the value + * @return this builder + */ + public Builder shortName(String shortName) { + return set("short_name", Conv.STRING, shortName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AddressComponents} + */ + public AddressComponents build() { + return new AddressComponents(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class DocumentLocation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private DocumentLocation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentLocation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentLocation fromJson(JsonNode json) { + return new DocumentLocation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentLocation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentLocation from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentLocation} + */ + public DocumentLocation build() { + return new DocumentLocation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class DocumentSelfieFaceMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "similarity_percentage", "vendor_data", "vendor_user_id", "biometric_template_id", "verification_date", "user_details", "match_image_url", "status", "is_blocklisted", "is_allowlisted", "api_service", "source"); + + private DocumentSelfieFaceMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentSelfieFaceMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentSelfieFaceMatches fromJson(JsonNode json) { + return new DocumentSelfieFaceMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session ID of the matching face. null when source is imported, list_entry, or retained_template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The session_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * Face similarity between the two images, clamped to 0โ€“100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional similarityPercentage() { + return Json.optional(json, "similarity_percentage", Conv.DOUBLE); + } + + /** + * vendor_data of the matching session or linked User for imported and retained-template faces. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Linked User id for imported and retained_template matches and for session matches linked to a User. null for list entries and sessions without a User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserId() { + return Json.optional(json, "vendor_user_id", Conv.STRING); + } + + /** + * Id of the retained biometric template. Set only when source is retained_template; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateId() { + return Json.optional(json, "biometric_template_id", Conv.STRING); + } + + /** + * When the matching face was captured, or when a retained template was created. null for list entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * Identity data from the matching session or imported User profile. Always null for retained_template and list_entry matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userDetails() { + return Json.optional(json, "user_details", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches.UserDetails::fromJson)); + } + + /** + * Reference image for image-backed matches. Always null for retained_template matches because retained templates contain no image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchImageUrl() { + return Json.optional(json, "match_image_url", Conv.STRING); + } + + /** + * Lifecycle status of the matching session. null for non-session sources. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the matching face is on a blocklist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * Whether the matching face is on an allowlist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isAllowlisted() { + return Json.optional(json, "is_allowlisted", Conv.BOOLEAN); + } + + /** + * Standalone API service of the matching session (e.g. PASSIVE_LIVENESS, FACE_MATCH); null for workflow sessions and non-session sources. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Origin of the matching face: session, imported (User face upload), list_entry (allow/block list), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches.Source::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentSelfieFaceMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentSelfieFaceMatches from) { + super(from); + } + + /** + * Session ID of the matching face. null when source is imported, list_entry, or retained_template. + * + * @param sessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionId(@Nullable String sessionId) { + return setNullable("session_id", Conv.STRING, sessionId); + } + + /** + * The session_number field. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * Face similarity between the two images, clamped to 0โ€“100. + * + * @param similarityPercentage the value + * @return this builder + */ + public Builder similarityPercentage(double similarityPercentage) { + return set("similarity_percentage", Conv.DOUBLE, similarityPercentage); + } + + /** + * vendor_data of the matching session or linked User for imported and retained-template faces. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Linked User id for imported and retained_template matches and for session matches linked to a User. null for list entries and sessions without a User. + * + * @param vendorUserId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorUserId(@Nullable String vendorUserId) { + return setNullable("vendor_user_id", Conv.STRING, vendorUserId); + } + + /** + * Id of the retained biometric template. Set only when source is retained_template; null otherwise. + * + * @param biometricTemplateId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateId(@Nullable String biometricTemplateId) { + return setNullable("biometric_template_id", Conv.STRING, biometricTemplateId); + } + + /** + * When the matching face was captured, or when a retained template was created. null for list entries. + * + * @param verificationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationDate(@Nullable OffsetDateTime verificationDate) { + return setNullable("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * Identity data from the matching session or imported User profile. Always null for retained_template and list_entry matches. + * + * @param userDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userDetails(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches.@Nullable UserDetails userDetails) { + return setNullable("user_details", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches.UserDetails::fromJson), userDetails); + } + + /** + * Reference image for image-backed matches. Always null for retained_template matches because retained templates contain no image. + * + * @param matchImageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchImageUrl(@Nullable String matchImageUrl) { + return setNullable("match_image_url", Conv.STRING, matchImageUrl); + } + + /** + * Lifecycle status of the matching session. null for non-session sources. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * Whether the matching face is on a blocklist. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * Whether the matching face is on an allowlist. + * + * @param isAllowlisted the value + * @return this builder + */ + public Builder isAllowlisted(boolean isAllowlisted) { + return set("is_allowlisted", Conv.BOOLEAN, isAllowlisted); + } + + /** + * Standalone API service of the matching session (e.g. PASSIVE_LIVENESS, FACE_MATCH); null for workflow sessions and non-session sources. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Origin of the matching face: session, imported (User face upload), list_entry (allow/block list), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). + * + * @param source the value + * @return this builder + */ + public Builder source(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches.Source source) { + return set("source", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentSelfieFaceMatches.Source::of), source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentSelfieFaceMatches} + */ + public DocumentSelfieFaceMatches build() { + return new DocumentSelfieFaceMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Identity data from the matching session or imported User profile. Always null for retained_template and list_entry matches. + */ + public static final class UserDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "document_type", "document_number"); + + private UserDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserDetails fromJson(JsonNode json) { + return new UserDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserDetails from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The document_type field. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(@Nullable String documentType) { + return setNullable("document_type", Conv.STRING, documentType); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserDetails} + */ + public UserDetails build() { + return new UserDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Origin of the matching face: session, imported (User face upload), list_entry (allow/block list), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "session"}. */ + public static final Source SESSION = new Source("session"); + + /** The value {@code "imported"}. */ + public static final Source IMPORTED = new Source("imported"); + + /** The value {@code "list_entry"}. */ + public static final Source LIST_ENTRY = new Source("list_entry"); + + /** The value {@code "retained_template"}. */ + public static final Source RETAINED_TEMPLATE = new Source("retained_template"); + + private static final List KNOWN_VALUES = List.of(SESSION, IMPORTED, LIST_ENTRY, RETAINED_TEMPLATE); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Quality metrics for the front document image. Each sub-score ranges from 0 to 100. */ + public static final class FrontImageQualityScore extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("focus_score", "brightness_score", "brightness_issue", "is_document_fully_visible", "resolution_score", "overall_score"); + + private FrontImageQualityScore(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FrontImageQualityScore} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FrontImageQualityScore fromJson(JsonNode json) { + return new FrontImageQualityScore(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Sharpness of the image measured via top-10% local Laplacian variance. Robust to documents with large uniform backgrounds. Higher values indicate a sharper, less blurry image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional focusScore() { + return Json.optional(json, "focus_score", Conv.DOUBLE); + } + + /** + * How well-lit the image is. Penalizes images that are too dark or overexposed, with ideal brightness around mid-range. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessScore() { + return Json.optional(json, "brightness_score", Conv.DOUBLE); + } + + /** + * Indicates the direction of the brightness problem when the brightness_score is low. 'ok' means brightness is acceptable, 'too_dark' means the image is underexposed, 'too_bright' means the image is overexposed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessIssue() { + return Json.optional(json, "brightness_issue", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.FrontImageQualityScore.BrightnessIssue::of)); + } + + /** + * true if all four corners of the document are fully visible inside the image frame, false if any corner is cut off. Null when corner coordinates are unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDocumentFullyVisible() { + return Json.optional(json, "is_document_fully_visible", Conv.BOOLEAN); + } + + /** + * Effective resolution of the image based on total pixel count. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolutionScore() { + return Json.optional(json, "resolution_score", Conv.DOUBLE); + } + + /** + * Weighted composite of sub-scores (focus 45%, brightness 30%, resolution 25%). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overallScore() { + return Json.optional(json, "overall_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FrontImageQualityScore}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FrontImageQualityScore from) { + super(from); + } + + /** + * Sharpness of the image measured via top-10% local Laplacian variance. Robust to documents with large uniform backgrounds. Higher values indicate a sharper, less blurry image. + * + * @param focusScore the value + * @return this builder + */ + public Builder focusScore(double focusScore) { + return set("focus_score", Conv.DOUBLE, focusScore); + } + + /** + * How well-lit the image is. Penalizes images that are too dark or overexposed, with ideal brightness around mid-range. + * + * @param brightnessScore the value + * @return this builder + */ + public Builder brightnessScore(double brightnessScore) { + return set("brightness_score", Conv.DOUBLE, brightnessScore); + } + + /** + * Indicates the direction of the brightness problem when the brightness_score is low. 'ok' means brightness is acceptable, 'too_dark' means the image is underexposed, 'too_bright' means the image is overexposed. + * + * @param brightnessIssue the value + * @return this builder + */ + public Builder brightnessIssue(SessionsRetrieveDecisionResponse.IdVerifications.FrontImageQualityScore.BrightnessIssue brightnessIssue) { + return set("brightness_issue", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.FrontImageQualityScore.BrightnessIssue::of), brightnessIssue); + } + + /** + * true if all four corners of the document are fully visible inside the image frame, false if any corner is cut off. Null when corner coordinates are unavailable. + * + * @param isDocumentFullyVisible the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDocumentFullyVisible(@Nullable Boolean isDocumentFullyVisible) { + return setNullable("is_document_fully_visible", Conv.BOOLEAN, isDocumentFullyVisible); + } + + /** + * Effective resolution of the image based on total pixel count. + * + * @param resolutionScore the value + * @return this builder + */ + public Builder resolutionScore(double resolutionScore) { + return set("resolution_score", Conv.DOUBLE, resolutionScore); + } + + /** + * Weighted composite of sub-scores (focus 45%, brightness 30%, resolution 25%). + * + * @param overallScore the value + * @return this builder + */ + public Builder overallScore(double overallScore) { + return set("overall_score", Conv.DOUBLE, overallScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FrontImageQualityScore} + */ + public FrontImageQualityScore build() { + return new FrontImageQualityScore(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Indicates the direction of the brightness problem when the brightness_score is low. 'ok' means brightness is acceptable, 'too_dark' means the image is underexposed, 'too_bright' means the image is overexposed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class BrightnessIssue extends StringEnum { + /** The value {@code "ok"}. */ + public static final BrightnessIssue OK = new BrightnessIssue("ok"); + + /** The value {@code "too_dark"}. */ + public static final BrightnessIssue TOO_DARK = new BrightnessIssue("too_dark"); + + /** The value {@code "too_bright"}. */ + public static final BrightnessIssue TOO_BRIGHT = new BrightnessIssue("too_bright"); + + private static final List KNOWN_VALUES = List.of(OK, TOO_DARK, TOO_BRIGHT); + + private BrightnessIssue(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static BrightnessIssue of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, BrightnessIssue::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Quality metrics for the back document image. Same structure as front_image_quality_score. */ + public static final class BackImageQualityScore extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("focus_score", "brightness_score", "brightness_issue", "is_document_fully_visible", "resolution_score", "overall_score"); + + private BackImageQualityScore(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BackImageQualityScore} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BackImageQualityScore fromJson(JsonNode json) { + return new BackImageQualityScore(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Sharpness of the image measured via top-10% local Laplacian variance. Robust to documents with large uniform backgrounds. Higher values indicate a sharper, less blurry image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional focusScore() { + return Json.optional(json, "focus_score", Conv.DOUBLE); + } + + /** + * How well-lit the image is. Penalizes images that are too dark or overexposed, with ideal brightness around mid-range. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessScore() { + return Json.optional(json, "brightness_score", Conv.DOUBLE); + } + + /** + * Indicates the direction of the brightness problem when the brightness_score is low. 'ok' means brightness is acceptable, 'too_dark' means the image is underexposed, 'too_bright' means the image is overexposed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional brightnessIssue() { + return Json.optional(json, "brightness_issue", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.BackImageQualityScore.BrightnessIssue::of)); + } + + /** + * true if all four corners of the document are fully visible inside the image frame, false if any corner is cut off. Null when corner coordinates are unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDocumentFullyVisible() { + return Json.optional(json, "is_document_fully_visible", Conv.BOOLEAN); + } + + /** + * Effective resolution of the image based on total pixel count. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resolutionScore() { + return Json.optional(json, "resolution_score", Conv.DOUBLE); + } + + /** + * Weighted composite of sub-scores (focus 45%, brightness 30%, resolution 25%). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overallScore() { + return Json.optional(json, "overall_score", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BackImageQualityScore}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BackImageQualityScore from) { + super(from); + } + + /** + * Sharpness of the image measured via top-10% local Laplacian variance. Robust to documents with large uniform backgrounds. Higher values indicate a sharper, less blurry image. + * + * @param focusScore the value + * @return this builder + */ + public Builder focusScore(double focusScore) { + return set("focus_score", Conv.DOUBLE, focusScore); + } + + /** + * How well-lit the image is. Penalizes images that are too dark or overexposed, with ideal brightness around mid-range. + * + * @param brightnessScore the value + * @return this builder + */ + public Builder brightnessScore(double brightnessScore) { + return set("brightness_score", Conv.DOUBLE, brightnessScore); + } + + /** + * Indicates the direction of the brightness problem when the brightness_score is low. 'ok' means brightness is acceptable, 'too_dark' means the image is underexposed, 'too_bright' means the image is overexposed. + * + * @param brightnessIssue the value + * @return this builder + */ + public Builder brightnessIssue(SessionsRetrieveDecisionResponse.IdVerifications.BackImageQualityScore.BrightnessIssue brightnessIssue) { + return set("brightness_issue", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.BackImageQualityScore.BrightnessIssue::of), brightnessIssue); + } + + /** + * true if all four corners of the document are fully visible inside the image frame, false if any corner is cut off. Null when corner coordinates are unavailable. + * + * @param isDocumentFullyVisible the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isDocumentFullyVisible(@Nullable Boolean isDocumentFullyVisible) { + return setNullable("is_document_fully_visible", Conv.BOOLEAN, isDocumentFullyVisible); + } + + /** + * Effective resolution of the image based on total pixel count. + * + * @param resolutionScore the value + * @return this builder + */ + public Builder resolutionScore(double resolutionScore) { + return set("resolution_score", Conv.DOUBLE, resolutionScore); + } + + /** + * Weighted composite of sub-scores (focus 45%, brightness 30%, resolution 25%). + * + * @param overallScore the value + * @return this builder + */ + public Builder overallScore(double overallScore) { + return set("overall_score", Conv.DOUBLE, overallScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BackImageQualityScore} + */ + public BackImageQualityScore build() { + return new BackImageQualityScore(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Indicates the direction of the brightness problem when the brightness_score is low. 'ok' means brightness is acceptable, 'too_dark' means the image is underexposed, 'too_bright' means the image is overexposed. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class BrightnessIssue extends StringEnum { + /** The value {@code "ok"}. */ + public static final BrightnessIssue OK = new BrightnessIssue("ok"); + + /** The value {@code "too_dark"}. */ + public static final BrightnessIssue TOO_DARK = new BrightnessIssue("too_dark"); + + /** The value {@code "too_bright"}. */ + public static final BrightnessIssue TOO_BRIGHT = new BrightnessIssue("too_bright"); + + private static final List KNOWN_VALUES = List.of(OK, TOO_DARK, TOO_BRIGHT); + + private BrightnessIssue(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static BrightnessIssue of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, BrightnessIssue::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning (e.g., ID_VERIFICATION, NFC, LIVENESS). The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module, but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * Additional contextual data about the warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * Type of log: information, warning, or error + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning (for graph-based workflows) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning (e.g., ID_VERIFICATION, NFC, LIVENESS). The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module, but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.IdVerifications.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * Additional contextual data about the warning + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Type of log: information, warning, or error + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning (for graph-based workflows) + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning (e.g., ID_VERIFICATION, NFC, LIVENESS). The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module, but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "user_details", "status", "is_blocklisted", "api_service", "front_image_url"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session ID of the matching document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Session number of the matching document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * Vendor data associated with the matching session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Date when the matching session was verified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * The user_details field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userDetails() { + return Json.optional(json, "user_details", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Matches.UserDetails::fromJson)); + } + + /** + * Status of the matching session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the matching document is blocklisted + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * API service type of the matching session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * URL of the front document image from the matching document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional frontImageUrl() { + return Json.optional(json, "front_image_url", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * Session ID of the matching document + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Session number of the matching document + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * Vendor data associated with the matching session + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Date when the matching session was verified + * + * @param verificationDate the value + * @return this builder + */ + public Builder verificationDate(OffsetDateTime verificationDate) { + return set("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * The user_details field. + * + * @param userDetails the value + * @return this builder + */ + public Builder userDetails(SessionsRetrieveDecisionResponse.IdVerifications.Matches.UserDetails userDetails) { + return set("user_details", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.Matches.UserDetails::fromJson), userDetails); + } + + /** + * Status of the matching session + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Whether the matching document is blocklisted + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * API service type of the matching session + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * URL of the front document image from the matching document + * + * @param frontImageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder frontImageUrl(@Nullable String frontImageUrl) { + return setNullable("front_image_url", Conv.STRING, frontImageUrl); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class UserDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "document_type", "document_number"); + + private UserDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserDetails fromJson(JsonNode json) { + return new UserDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Full name from the matching document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Type of the matching document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * Document number of the matching document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserDetails from) { + super(from); + } + + /** + * Full name from the matching document + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Type of the matching document + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * Document number of the matching document + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserDetails} + */ + public UserDetails build() { + return new UserDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Document-liveness scores per fraud type, reported whether or not a warning fired, so an approved document can still be audited. null when the check did not run. + */ + public static final class DocumentLiveness extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("portrait_replace", "printed_copy", "screen_replay"); + + private DocumentLiveness(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentLiveness} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentLiveness fromJson(JsonNode json) { + return new DocumentLiveness(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The portrait_replace field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitReplace() { + return Json.optional(json, "portrait_replace", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PortraitReplace::fromJson)); + } + + /** + * The printed_copy field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional printedCopy() { + return Json.optional(json, "printed_copy", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PrintedCopy::fromJson)); + } + + /** + * The screen_replay field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenReplay() { + return Json.optional(json, "screen_replay", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.ScreenReplay::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentLiveness}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentLiveness from) { + super(from); + } + + /** + * The portrait_replace field. + * + * @param portraitReplace the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder portraitReplace(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.@Nullable PortraitReplace portraitReplace) { + return setNullable("portrait_replace", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PortraitReplace::fromJson), portraitReplace); + } + + /** + * The printed_copy field. + * + * @param printedCopy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder printedCopy(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.@Nullable PrintedCopy printedCopy) { + return setNullable("printed_copy", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PrintedCopy::fromJson), printedCopy); + } + + /** + * The screen_replay field. + * + * @param screenReplay the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder screenReplay(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.@Nullable ScreenReplay screenReplay) { + return setNullable("screen_replay", Conv.model(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.ScreenReplay::fromJson), screenReplay); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentLiveness} + */ + public DocumentLiveness build() { + return new DocumentLiveness(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class PortraitReplace extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "front", "back", "decline_threshold", "review_threshold", "bucket"); + + private PortraitReplace(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PortraitReplace} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PortraitReplace fromJson(JsonNode json) { + return new PortraitReplace(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Likelihood that the document is genuine for this fraud type, 0-100 (higher = more likely genuine). The lowest of the two sides - the value the decision used. null when neither side produced a usable score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Score for the front side; null when not captured or when the score was dropped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional front() { + return Json.optional(json, "front", Conv.DOUBLE); + } + + /** + * Score for the back side; null when not captured or when the score was dropped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional back() { + return Json.optional(json, "back", Conv.DOUBLE); + } + + /** + * The decline threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declineThreshold() { + return Json.optional(json, "decline_threshold", Conv.DOUBLE); + } + + /** + * The review threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewThreshold() { + return Json.optional(json, "review_threshold", Conv.DOUBLE); + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bucket() { + return Json.optional(json, "bucket", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PortraitReplace.Bucket::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PortraitReplace}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PortraitReplace from) { + super(from); + } + + /** + * Likelihood that the document is genuine for this fraud type, 0-100 (higher = more likely genuine). The lowest of the two sides - the value the decision used. null when neither side produced a usable score. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Score for the front side; null when not captured or when the score was dropped. + * + * @param front the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder front(@Nullable Double front) { + return setNullable("front", Conv.DOUBLE, front); + } + + /** + * Score for the back side; null when not captured or when the score was dropped. + * + * @param back the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder back(@Nullable Double back) { + return setNullable("back", Conv.DOUBLE, back); + } + + /** + * The decline threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @param declineThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder declineThreshold(@Nullable Double declineThreshold) { + return setNullable("decline_threshold", Conv.DOUBLE, declineThreshold); + } + + /** + * The review threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @param reviewThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewThreshold(@Nullable Double reviewThreshold) { + return setNullable("review_threshold", Conv.DOUBLE, reviewThreshold); + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + * @param bucket the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bucket(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PortraitReplace.@Nullable Bucket bucket) { + return setNullable("bucket", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PortraitReplace.Bucket::of), bucket); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PortraitReplace} + */ + public PortraitReplace build() { + return new PortraitReplace(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Bucket extends StringEnum { + /** The value {@code "approve"}. */ + public static final Bucket APPROVE = new Bucket("approve"); + + /** The value {@code "review"}. */ + public static final Bucket REVIEW = new Bucket("review"); + + /** The value {@code "decline"}. */ + public static final Bucket DECLINE = new Bucket("decline"); + + private static final List KNOWN_VALUES = List.of(APPROVE, REVIEW, DECLINE); + + private Bucket(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Bucket of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Bucket::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class PrintedCopy extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "front", "back", "decline_threshold", "review_threshold", "bucket"); + + private PrintedCopy(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PrintedCopy} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PrintedCopy fromJson(JsonNode json) { + return new PrintedCopy(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Likelihood that the document is genuine for this fraud type, 0-100 (higher = more likely genuine). The lowest of the two sides - the value the decision used. null when neither side produced a usable score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Score for the front side; null when not captured or when the score was dropped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional front() { + return Json.optional(json, "front", Conv.DOUBLE); + } + + /** + * Score for the back side; null when not captured or when the score was dropped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional back() { + return Json.optional(json, "back", Conv.DOUBLE); + } + + /** + * The decline threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declineThreshold() { + return Json.optional(json, "decline_threshold", Conv.DOUBLE); + } + + /** + * The review threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewThreshold() { + return Json.optional(json, "review_threshold", Conv.DOUBLE); + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bucket() { + return Json.optional(json, "bucket", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PrintedCopy.Bucket::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PrintedCopy}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PrintedCopy from) { + super(from); + } + + /** + * Likelihood that the document is genuine for this fraud type, 0-100 (higher = more likely genuine). The lowest of the two sides - the value the decision used. null when neither side produced a usable score. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Score for the front side; null when not captured or when the score was dropped. + * + * @param front the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder front(@Nullable Double front) { + return setNullable("front", Conv.DOUBLE, front); + } + + /** + * Score for the back side; null when not captured or when the score was dropped. + * + * @param back the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder back(@Nullable Double back) { + return setNullable("back", Conv.DOUBLE, back); + } + + /** + * The decline threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @param declineThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder declineThreshold(@Nullable Double declineThreshold) { + return setNullable("decline_threshold", Conv.DOUBLE, declineThreshold); + } + + /** + * The review threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @param reviewThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewThreshold(@Nullable Double reviewThreshold) { + return setNullable("review_threshold", Conv.DOUBLE, reviewThreshold); + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + * @param bucket the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bucket(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PrintedCopy.@Nullable Bucket bucket) { + return setNullable("bucket", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.PrintedCopy.Bucket::of), bucket); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PrintedCopy} + */ + public PrintedCopy build() { + return new PrintedCopy(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Bucket extends StringEnum { + /** The value {@code "approve"}. */ + public static final Bucket APPROVE = new Bucket("approve"); + + /** The value {@code "review"}. */ + public static final Bucket REVIEW = new Bucket("review"); + + /** The value {@code "decline"}. */ + public static final Bucket DECLINE = new Bucket("decline"); + + private static final List KNOWN_VALUES = List.of(APPROVE, REVIEW, DECLINE); + + private Bucket(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Bucket of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Bucket::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class ScreenReplay extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "front", "back", "decline_threshold", "review_threshold", "bucket"); + + private ScreenReplay(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScreenReplay} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScreenReplay fromJson(JsonNode json) { + return new ScreenReplay(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Likelihood that the document is genuine for this fraud type, 0-100 (higher = more likely genuine). The lowest of the two sides - the value the decision used. null when neither side produced a usable score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Score for the front side; null when not captured or when the score was dropped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional front() { + return Json.optional(json, "front", Conv.DOUBLE); + } + + /** + * Score for the back side; null when not captured or when the score was dropped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional back() { + return Json.optional(json, "back", Conv.DOUBLE); + } + + /** + * The decline threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declineThreshold() { + return Json.optional(json, "decline_threshold", Conv.DOUBLE); + } + + /** + * The review threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewThreshold() { + return Json.optional(json, "review_threshold", Conv.DOUBLE); + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bucket() { + return Json.optional(json, "bucket", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.ScreenReplay.Bucket::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScreenReplay}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScreenReplay from) { + super(from); + } + + /** + * Likelihood that the document is genuine for this fraud type, 0-100 (higher = more likely genuine). The lowest of the two sides - the value the decision used. null when neither side produced a usable score. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Score for the front side; null when not captured or when the score was dropped. + * + * @param front the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder front(@Nullable Double front) { + return setNullable("front", Conv.DOUBLE, front); + } + + /** + * Score for the back side; null when not captured or when the score was dropped. + * + * @param back the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder back(@Nullable Double back) { + return setNullable("back", Conv.DOUBLE, back); + } + + /** + * The decline threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @param declineThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder declineThreshold(@Nullable Double declineThreshold) { + return setNullable("decline_threshold", Conv.DOUBLE, declineThreshold); + } + + /** + * The review threshold saved when this document was evaluated. Later workflow edits do not change it. Null when historical evaluation evidence is unavailable. + * + * @param reviewThreshold the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reviewThreshold(@Nullable Double reviewThreshold) { + return setNullable("review_threshold", Conv.DOUBLE, reviewThreshold); + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + * @param bucket the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bucket(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.ScreenReplay.@Nullable Bucket bucket) { + return setNullable("bucket", Conv.enumeration(SessionsRetrieveDecisionResponse.IdVerifications.DocumentLiveness.ScreenReplay.Bucket::of), bucket); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScreenReplay} + */ + public ScreenReplay build() { + return new ScreenReplay(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The fraud-type bucket saved at evaluation time. Null when there is no usable score, the check was not applied, or historical evaluation evidence is unavailable. Later workflow edits do not change it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Bucket extends StringEnum { + /** The value {@code "approve"}. */ + public static final Bucket APPROVE = new Bucket("approve"); + + /** The value {@code "review"}. */ + public static final Bucket REVIEW = new Bucket("review"); + + /** The value {@code "decline"}. */ + public static final Bucket DECLINE = new Bucket("decline"); + + private static final List KNOWN_VALUES = List.of(APPROVE, REVIEW, DECLINE); + + private Bucket(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Bucket of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Bucket::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + } + + /** + * Why NFC chip verification did not run, populated whenever the workflow includes an NFC step. null while NFC is pending or when the chip was actually read. Values: USER_SKIPPED - the user chose to skip on an NFC-capable device (allowed by allow_nfc_skip); DOCUMENT_WITHOUT_CHIP - the document has no readable NFC chip (not an ICAO 9303 electronic document); CHIP_CERTIFICATE_UNAVAILABLE - the issuing country's signing certificate (CSCA) covering the document's issue period is unavailable, so the chip signature cannot be verified; DEVICE_WITHOUT_NFC - the device reported no NFC reader; INTEGRATION_WITHOUT_NFC_ACCESS - the verification ran without a native SDK (e.g. in a web browser), which has no access to the phone's NFC reader; MRZ_KEY_UNAVAILABLE - the chip access key could not be derived from the document's MRZ. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NfcSkipReason extends StringEnum { + /** The value {@code "USER_SKIPPED"}. */ + public static final NfcSkipReason USER_SKIPPED = new NfcSkipReason("USER_SKIPPED"); + + /** The value {@code "DOCUMENT_WITHOUT_CHIP"}. */ + public static final NfcSkipReason DOCUMENT_WITHOUT_CHIP = new NfcSkipReason("DOCUMENT_WITHOUT_CHIP"); + + /** The value {@code "CHIP_CERTIFICATE_UNAVAILABLE"}. */ + public static final NfcSkipReason CHIP_CERTIFICATE_UNAVAILABLE = new NfcSkipReason("CHIP_CERTIFICATE_UNAVAILABLE"); + + /** The value {@code "DEVICE_WITHOUT_NFC"}. */ + public static final NfcSkipReason DEVICE_WITHOUT_NFC = new NfcSkipReason("DEVICE_WITHOUT_NFC"); + + /** The value {@code "INTEGRATION_WITHOUT_NFC_ACCESS"}. */ + public static final NfcSkipReason INTEGRATION_WITHOUT_NFC_ACCESS = new NfcSkipReason("INTEGRATION_WITHOUT_NFC_ACCESS"); + + /** The value {@code "MRZ_KEY_UNAVAILABLE"}. */ + public static final NfcSkipReason MRZ_KEY_UNAVAILABLE = new NfcSkipReason("MRZ_KEY_UNAVAILABLE"); + + private static final List KNOWN_VALUES = List.of(USER_SKIPPED, DOCUMENT_WITHOUT_CHIP, CHIP_CERTIFICATE_UNAVAILABLE, DEVICE_WITHOUT_NFC, INTEGRATION_WITHOUT_NFC_ACCESS, MRZ_KEY_UNAVAILABLE); + + private NfcSkipReason(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NfcSkipReason of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NfcSkipReason::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** One NFC report โ€” the full report for a single ePassport chip read. */ + public static final class NfcVerifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "is_nfc_skipped", "skip_reason", "portrait_image", "signature_image", "chip_data", "authenticity", "certificate_summary", "warnings"); + + private NfcVerifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NfcVerifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NfcVerifications fromJson(JsonNode json) { + return new NfcVerifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node id of the NFC step that produced this report. Use it to correlate the report with the workflow definition. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this NFC step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcVerifications.Status::of)); + } + + /** + * true when this NFC step was explicitly skipped instead of read; skip_reason says why. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isNfcSkipped() { + return Json.optional(json, "is_nfc_skipped", Conv.BOOLEAN); + } + + /** + * Why this NFC step was skipped. Only set when is_nfc_skipped is true. Same taxonomy as the session-level nfc_skip_reason, which additionally covers the cases where NFC never produced a report at all. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skipReason() { + return Json.optional(json, "skip_reason", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcVerifications.SkipReason::of)); + } + + /** + * The portrait_image field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImage() { + return Json.optional(json, "portrait_image", Conv.STRING); + } + + /** + * The signature_image field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional signatureImage() { + return Json.optional(json, "signature_image", Conv.STRING); + } + + /** + * The chip_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional chipData() { + return Json.optional(json, "chip_data", Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.ChipData::fromJson)); + } + + /** + * The authenticity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional authenticity() { + return Json.optional(json, "authenticity", Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.Authenticity::fromJson)); + } + + /** + * The certificate_summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional certificateSummary() { + return Json.optional(json, "certificate_summary", Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.CertificateSummary::fromJson)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NfcVerifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NfcVerifications from) { + super(from); + } + + /** + * Workflow graph node id of the NFC step that produced this report. Use it to correlate the report with the workflow definition. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this NFC step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.NfcVerifications.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcVerifications.Status::of), status); + } + + /** + * true when this NFC step was explicitly skipped instead of read; skip_reason says why. + * + * @param isNfcSkipped the value + * @return this builder + */ + public Builder isNfcSkipped(boolean isNfcSkipped) { + return set("is_nfc_skipped", Conv.BOOLEAN, isNfcSkipped); + } + + /** + * Why this NFC step was skipped. Only set when is_nfc_skipped is true. Same taxonomy as the session-level nfc_skip_reason, which additionally covers the cases where NFC never produced a report at all. + * + * @param skipReason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder skipReason(SessionsRetrieveDecisionResponse.NfcVerifications.@Nullable SkipReason skipReason) { + return setNullable("skip_reason", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcVerifications.SkipReason::of), skipReason); + } + + /** + * The portrait_image field. + * + * @param portraitImage the value + * @return this builder + */ + public Builder portraitImage(String portraitImage) { + return set("portrait_image", Conv.STRING, portraitImage); + } + + /** + * The signature_image field. + * + * @param signatureImage the value + * @return this builder + */ + public Builder signatureImage(String signatureImage) { + return set("signature_image", Conv.STRING, signatureImage); + } + + /** + * The chip_data field. + * + * @param chipData the value + * @return this builder + */ + public Builder chipData(SessionsRetrieveDecisionResponse.NfcVerifications.ChipData chipData) { + return set("chip_data", Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.ChipData::fromJson), chipData); + } + + /** + * The authenticity field. + * + * @param authenticity the value + * @return this builder + */ + public Builder authenticity(SessionsRetrieveDecisionResponse.NfcVerifications.Authenticity authenticity) { + return set("authenticity", Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.Authenticity::fromJson), authenticity); + } + + /** + * The certificate_summary field. + * + * @param certificateSummary the value + * @return this builder + */ + public Builder certificateSummary(SessionsRetrieveDecisionResponse.NfcVerifications.CertificateSummary certificateSummary) { + return set("certificate_summary", Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.CertificateSummary::fromJson), certificateSummary); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.NfcVerifications.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NfcVerifications} + */ + public NfcVerifications build() { + return new NfcVerifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this NFC step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Why this NFC step was skipped. Only set when is_nfc_skipped is true. Same taxonomy as the session-level nfc_skip_reason, which additionally covers the cases where NFC never produced a report at all. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SkipReason extends StringEnum { + /** The value {@code "USER_SKIPPED"}. */ + public static final SkipReason USER_SKIPPED = new SkipReason("USER_SKIPPED"); + + /** The value {@code "DOCUMENT_WITHOUT_CHIP"}. */ + public static final SkipReason DOCUMENT_WITHOUT_CHIP = new SkipReason("DOCUMENT_WITHOUT_CHIP"); + + /** The value {@code "CHIP_CERTIFICATE_UNAVAILABLE"}. */ + public static final SkipReason CHIP_CERTIFICATE_UNAVAILABLE = new SkipReason("CHIP_CERTIFICATE_UNAVAILABLE"); + + /** The value {@code "DEVICE_WITHOUT_NFC"}. */ + public static final SkipReason DEVICE_WITHOUT_NFC = new SkipReason("DEVICE_WITHOUT_NFC"); + + /** The value {@code "INTEGRATION_WITHOUT_NFC_ACCESS"}. */ + public static final SkipReason INTEGRATION_WITHOUT_NFC_ACCESS = new SkipReason("INTEGRATION_WITHOUT_NFC_ACCESS"); + + /** The value {@code "MRZ_KEY_UNAVAILABLE"}. */ + public static final SkipReason MRZ_KEY_UNAVAILABLE = new SkipReason("MRZ_KEY_UNAVAILABLE"); + + private static final List KNOWN_VALUES = List.of(USER_SKIPPED, DOCUMENT_WITHOUT_CHIP, CHIP_CERTIFICATE_UNAVAILABLE, DEVICE_WITHOUT_NFC, INTEGRATION_WITHOUT_NFC_ACCESS, MRZ_KEY_UNAVAILABLE); + + private SkipReason(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SkipReason of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SkipReason::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class ChipData extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("document_type", "issuing_country", "document_number", "expiration_date", "first_name", "last_name", "birth_date", "gender", "nationality", "address", "place_of_birth"); + + private ChipData(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ChipData} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ChipData fromJson(JsonNode json) { + return new ChipData(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The issuing_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingCountry() { + return Json.optional(json, "issuing_country", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * The expiration_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The birth_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional birthDate() { + return Json.optional(json, "birth_date", Conv.DATE); + } + + /** + * The gender field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * The place_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ChipData}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ChipData from) { + super(from); + } + + /** + * The document_type field. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * The issuing_country field. + * + * @param issuingCountry the value + * @return this builder + */ + public Builder issuingCountry(String issuingCountry) { + return set("issuing_country", Conv.STRING, issuingCountry); + } + + /** + * The document_number field. + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * The expiration_date field. + * + * @param expirationDate the value + * @return this builder + */ + public Builder expirationDate(LocalDate expirationDate) { + return set("expiration_date", Conv.DATE, expirationDate); + } + + /** + * The first_name field. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * The birth_date field. + * + * @param birthDate the value + * @return this builder + */ + public Builder birthDate(LocalDate birthDate) { + return set("birth_date", Conv.DATE, birthDate); + } + + /** + * The gender field. + * + * @param gender the value + * @return this builder + */ + public Builder gender(String gender) { + return set("gender", Conv.STRING, gender); + } + + /** + * The nationality field. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * The address field. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * The place_of_birth field. + * + * @param placeOfBirth the value + * @return this builder + */ + public Builder placeOfBirth(String placeOfBirth) { + return set("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ChipData} + */ + public ChipData build() { + return new ChipData(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Authenticity extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("sod_integrity", "dg_integrity"); + + private Authenticity(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Authenticity} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Authenticity fromJson(JsonNode json) { + return new Authenticity(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The sod_integrity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sodIntegrity() { + return Json.optional(json, "sod_integrity", Conv.BOOLEAN); + } + + /** + * The dg_integrity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dgIntegrity() { + return Json.optional(json, "dg_integrity", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Authenticity}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Authenticity from) { + super(from); + } + + /** + * The sod_integrity field. + * + * @param sodIntegrity the value + * @return this builder + */ + public Builder sodIntegrity(boolean sodIntegrity) { + return set("sod_integrity", Conv.BOOLEAN, sodIntegrity); + } + + /** + * The dg_integrity field. + * + * @param dgIntegrity the value + * @return this builder + */ + public Builder dgIntegrity(boolean dgIntegrity) { + return set("dg_integrity", Conv.BOOLEAN, dgIntegrity); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Authenticity} + */ + public Authenticity build() { + return new Authenticity(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class CertificateSummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("issuer", "subject", "serial_number", "not_valid_after", "not_valid_before"); + + private CertificateSummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CertificateSummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CertificateSummary fromJson(JsonNode json) { + return new CertificateSummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The issuer field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + /** + * The subject field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subject() { + return Json.optional(json, "subject", Conv.STRING); + } + + /** + * The serial_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serialNumber() { + return Json.optional(json, "serial_number", Conv.STRING); + } + + /** + * The not_valid_after field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional notValidAfter() { + return Json.optional(json, "not_valid_after", Conv.DATE_TIME); + } + + /** + * The not_valid_before field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional notValidBefore() { + return Json.optional(json, "not_valid_before", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CertificateSummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CertificateSummary from) { + super(from); + } + + /** + * The issuer field. + * + * @param issuer the value + * @return this builder + */ + public Builder issuer(String issuer) { + return set("issuer", Conv.STRING, issuer); + } + + /** + * The subject field. + * + * @param subject the value + * @return this builder + */ + public Builder subject(String subject) { + return set("subject", Conv.STRING, subject); + } + + /** + * The serial_number field. + * + * @param serialNumber the value + * @return this builder + */ + public Builder serialNumber(String serialNumber) { + return set("serial_number", Conv.STRING, serialNumber); + } + + /** + * The not_valid_after field. + * + * @param notValidAfter the value + * @return this builder + */ + public Builder notValidAfter(OffsetDateTime notValidAfter) { + return set("not_valid_after", Conv.DATE_TIME, notValidAfter); + } + + /** + * The not_valid_before field. + * + * @param notValidBefore the value + * @return this builder + */ + public Builder notValidBefore(OffsetDateTime notValidBefore) { + return set("not_valid_before", Conv.DATE_TIME, notValidBefore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CertificateSummary} + */ + public CertificateSummary build() { + return new CertificateSummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcVerifications.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.NfcVerifications.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.NfcVerifications.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + /** One liveness report โ€” the full report for a single liveness pass. */ + public static final class LivenessChecks extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "method", "score", "reference_image", "video_url", "age_estimation", "matches", "warnings", "face_quality", "face_luminance"); + + private LivenessChecks(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code LivenessChecks} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static LivenessChecks fromJson(JsonNode json) { + return new LivenessChecks(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node id of the liveness step that produced this report. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this liveness step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.LivenessChecks.Status::of)); + } + + /** + * Method used for liveness detection + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional method() { + return Json.optional(json, "method", Conv.STRING); + } + + /** + * Confidence score of the liveness check + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * URL of the reference image used + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional referenceImage() { + return Json.optional(json, "reference_image", Conv.STRING); + } + + /** + * URL of the liveness check video + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional videoUrl() { + return Json.optional(json, "video_url", Conv.STRING); + } + + /** + * Estimated age of the person + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ageEstimation() { + return Json.optional(json, "age_estimation", Conv.DOUBLE); + } + + /** + * Similar faces found by the duplicate-face search (top matches, blocklisted/allowlisted entries first). Each entry's source tells you where the matching face came from: session (another verification session), imported (a face uploaded against a vendor user), list_entry (an org-managed allow/block list face), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). session_id, session_number, status and api_service are null for non-session sources. imported matches still populate vendor_data, verification_date and โ€” when the vendor user has a name on file โ€” user_details (with full_name only) from the vendor-user record; retained_template matches populate vendor_user_id, vendor_data, biometric_template_id and verification_date, while their image and identity fields are null; list_entry matches return all of these as null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks.Matches::fromJson))); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks.Warnings::fromJson))); + } + + /** + * Face image quality score (0-100%). Only available for passive liveness. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceQuality() { + return Json.optional(json, "face_quality", Conv.DOUBLE); + } + + /** + * Face luminance/brightness score (0-100%). Only available for passive liveness. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceLuminance() { + return Json.optional(json, "face_luminance", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link LivenessChecks}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(LivenessChecks from) { + super(from); + } + + /** + * Workflow graph node id of the liveness step that produced this report. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this liveness step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.LivenessChecks.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.LivenessChecks.Status::of), status); + } + + /** + * Method used for liveness detection + * + * @param method the value + * @return this builder + */ + public Builder method(String method) { + return set("method", Conv.STRING, method); + } + + /** + * Confidence score of the liveness check + * + * @param score the value + * @return this builder + */ + public Builder score(double score) { + return set("score", Conv.DOUBLE, score); + } + + /** + * URL of the reference image used + * + * @param referenceImage the value + * @return this builder + */ + public Builder referenceImage(String referenceImage) { + return set("reference_image", Conv.STRING, referenceImage); + } + + /** + * URL of the liveness check video + * + * @param videoUrl the value + * @return this builder + */ + public Builder videoUrl(String videoUrl) { + return set("video_url", Conv.STRING, videoUrl); + } + + /** + * Estimated age of the person + * + * @param ageEstimation the value + * @return this builder + */ + public Builder ageEstimation(double ageEstimation) { + return set("age_estimation", Conv.DOUBLE, ageEstimation); + } + + /** + * Similar faces found by the duplicate-face search (top matches, blocklisted/allowlisted entries first). Each entry's source tells you where the matching face came from: session (another verification session), imported (a face uploaded against a vendor user), list_entry (an org-managed allow/block list face), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). session_id, session_number, status and api_service are null for non-session sources. imported matches still populate vendor_data, verification_date and โ€” when the vendor user has a name on file โ€” user_details (with full_name only) from the vendor-user record; retained_template matches populate vendor_user_id, vendor_data, biometric_template_id and verification_date, while their image and identity fields are null; list_entry matches return all of these as null. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks.Matches::fromJson)), matches); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks.Warnings::fromJson)), warnings); + } + + /** + * Face image quality score (0-100%). Only available for passive liveness. + * + * @param faceQuality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceQuality(@Nullable Double faceQuality) { + return setNullable("face_quality", Conv.DOUBLE, faceQuality); + } + + /** + * Face luminance/brightness score (0-100%). Only available for passive liveness. + * + * @param faceLuminance the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder faceLuminance(@Nullable Double faceLuminance) { + return setNullable("face_luminance", Conv.DOUBLE, faceLuminance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code LivenessChecks} + */ + public LivenessChecks build() { + return new LivenessChecks(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this liveness step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "similarity_percentage", "vendor_data", "vendor_user_id", "biometric_template_id", "verification_date", "user_details", "match_image_url", "status", "is_blocklisted", "is_allowlisted", "api_service", "source"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session ID of the matching face. null when source is imported, list_entry, or retained_template. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The session_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * Face similarity between the two images, clamped to 0โ€“100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional similarityPercentage() { + return Json.optional(json, "similarity_percentage", Conv.DOUBLE); + } + + /** + * vendor_data of the matching session or linked User for imported and retained-template faces. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Linked User id for imported and retained_template matches and for session matches linked to a User. null for list entries and sessions without a User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorUserId() { + return Json.optional(json, "vendor_user_id", Conv.STRING); + } + + /** + * Id of the retained biometric template. Set only when source is retained_template; null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional biometricTemplateId() { + return Json.optional(json, "biometric_template_id", Conv.STRING); + } + + /** + * When the matching face was captured, or when a retained template was created. null for list entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * Identity data from the matching session or imported User profile. Always null for retained_template and list_entry matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userDetails() { + return Json.optional(json, "user_details", Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks.Matches.UserDetails::fromJson)); + } + + /** + * Reference image for image-backed matches. Always null for retained_template matches because retained templates contain no image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchImageUrl() { + return Json.optional(json, "match_image_url", Conv.STRING); + } + + /** + * Lifecycle status of the matching session. null for non-session sources. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the matching face is on a blocklist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * Whether the matching face is on an allowlist. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isAllowlisted() { + return Json.optional(json, "is_allowlisted", Conv.BOOLEAN); + } + + /** + * Standalone API service of the matching session (e.g. PASSIVE_LIVENESS, FACE_MATCH); null for workflow sessions and non-session sources. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Origin of the matching face: session, imported (User face upload), list_entry (allow/block list), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(SessionsRetrieveDecisionResponse.LivenessChecks.Matches.Source::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * Session ID of the matching face. null when source is imported, list_entry, or retained_template. + * + * @param sessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionId(@Nullable String sessionId) { + return setNullable("session_id", Conv.STRING, sessionId); + } + + /** + * The session_number field. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * Face similarity between the two images, clamped to 0โ€“100. + * + * @param similarityPercentage the value + * @return this builder + */ + public Builder similarityPercentage(double similarityPercentage) { + return set("similarity_percentage", Conv.DOUBLE, similarityPercentage); + } + + /** + * vendor_data of the matching session or linked User for imported and retained-template faces. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Linked User id for imported and retained_template matches and for session matches linked to a User. null for list entries and sessions without a User. + * + * @param vendorUserId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorUserId(@Nullable String vendorUserId) { + return setNullable("vendor_user_id", Conv.STRING, vendorUserId); + } + + /** + * Id of the retained biometric template. Set only when source is retained_template; null otherwise. + * + * @param biometricTemplateId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder biometricTemplateId(@Nullable String biometricTemplateId) { + return setNullable("biometric_template_id", Conv.STRING, biometricTemplateId); + } + + /** + * When the matching face was captured, or when a retained template was created. null for list entries. + * + * @param verificationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationDate(@Nullable OffsetDateTime verificationDate) { + return setNullable("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * Identity data from the matching session or imported User profile. Always null for retained_template and list_entry matches. + * + * @param userDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userDetails(SessionsRetrieveDecisionResponse.LivenessChecks.Matches.@Nullable UserDetails userDetails) { + return setNullable("user_details", Conv.model(SessionsRetrieveDecisionResponse.LivenessChecks.Matches.UserDetails::fromJson), userDetails); + } + + /** + * Reference image for image-backed matches. Always null for retained_template matches because retained templates contain no image. + * + * @param matchImageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchImageUrl(@Nullable String matchImageUrl) { + return setNullable("match_image_url", Conv.STRING, matchImageUrl); + } + + /** + * Lifecycle status of the matching session. null for non-session sources. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * Whether the matching face is on a blocklist. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * Whether the matching face is on an allowlist. + * + * @param isAllowlisted the value + * @return this builder + */ + public Builder isAllowlisted(boolean isAllowlisted) { + return set("is_allowlisted", Conv.BOOLEAN, isAllowlisted); + } + + /** + * Standalone API service of the matching session (e.g. PASSIVE_LIVENESS, FACE_MATCH); null for workflow sessions and non-session sources. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Origin of the matching face: session, imported (User face upload), list_entry (allow/block list), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). + * + * @param source the value + * @return this builder + */ + public Builder source(SessionsRetrieveDecisionResponse.LivenessChecks.Matches.Source source) { + return set("source", Conv.enumeration(SessionsRetrieveDecisionResponse.LivenessChecks.Matches.Source::of), source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Identity data from the matching session or imported User profile. Always null for retained_template and list_entry matches. + */ + public static final class UserDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "document_type", "document_number"); + + private UserDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserDetails fromJson(JsonNode json) { + return new UserDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The document_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserDetails from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The document_type field. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(@Nullable String documentType) { + return setNullable("document_type", Conv.STRING, documentType); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserDetails} + */ + public UserDetails build() { + return new UserDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Origin of the matching face: session, imported (User face upload), list_entry (allow/block list), or retained_template (an image-free biometric template stored on a User, listed under /v3/biometric-templates/). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "session"}. */ + public static final Source SESSION = new Source("session"); + + /** The value {@code "imported"}. */ + public static final Source IMPORTED = new Source("imported"); + + /** The value {@code "list_entry"}. */ + public static final Source LIST_ENTRY = new Source("list_entry"); + + /** The value {@code "retained_template"}. */ + public static final Source RETAINED_TEMPLATE = new Source("retained_template"); + + private static final List KNOWN_VALUES = List.of(SESSION, IMPORTED, LIST_ENTRY, RETAINED_TEMPLATE); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.LivenessChecks.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.LivenessChecks.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.LivenessChecks.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + /** One face-match report โ€” the full report. */ + public static final class FaceMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "score", "source_image_session_id", "source_image", "target_image", "warnings"); + + private FaceMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FaceMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FaceMatches fromJson(JsonNode json) { + return new FaceMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node id of the face-match step that produced this report. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this face-match step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.FaceMatches.Status::of)); + } + + /** + * Confidence score of the face match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Session id under which the source (reference) portrait is stored. In biometric-authentication flows this is the session's own id (the submitted portrait is stored under the new session). null when the source image is the same session's document portrait. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceImageSessionId() { + return Json.optional(json, "source_image_session_id", Conv.STRING); + } + + /** + * URL of the source image used for comparison + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceImage() { + return Json.optional(json, "source_image", Conv.STRING); + } + + /** + * URL of the target image used for comparison + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional targetImage() { + return Json.optional(json, "target_image", Conv.STRING); + } + + /** + * Face match verification warnings + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.FaceMatches.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FaceMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FaceMatches from) { + super(from); + } + + /** + * Workflow graph node id of the face-match step that produced this report. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this face-match step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.FaceMatches.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.FaceMatches.Status::of), status); + } + + /** + * Confidence score of the face match + * + * @param score the value + * @return this builder + */ + public Builder score(double score) { + return set("score", Conv.DOUBLE, score); + } + + /** + * Session id under which the source (reference) portrait is stored. In biometric-authentication flows this is the session's own id (the submitted portrait is stored under the new session). null when the source image is the same session's document portrait. + * + * @param sourceImageSessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sourceImageSessionId(@Nullable String sourceImageSessionId) { + return setNullable("source_image_session_id", Conv.STRING, sourceImageSessionId); + } + + /** + * URL of the source image used for comparison + * + * @param sourceImage the value + * @return this builder + */ + public Builder sourceImage(String sourceImage) { + return set("source_image", Conv.STRING, sourceImage); + } + + /** + * URL of the target image used for comparison + * + * @param targetImage the value + * @return this builder + */ + public Builder targetImage(String targetImage) { + return set("target_image", Conv.STRING, targetImage); + } + + /** + * Face match verification warnings + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.FaceMatches.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FaceMatches} + */ + public FaceMatches build() { + return new FaceMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this face-match step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.FaceMatches.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.FaceMatches.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.FaceMatches.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class PhoneVerifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "phone_number_prefix", "phone_number", "full_number", "country_code", "country_name", "carrier", "is_disposable", "is_virtual", "verification_method", "verification_attempts", "verified_at", "lifecycle", "warnings", "matches"); + + private PhoneVerifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PhoneVerifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PhoneVerifications fromJson(JsonNode json) { + return new PhoneVerifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this phone step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this phone verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.PhoneVerifications.Status::of)); + } + + /** + * Country calling code prefix + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumberPrefix() { + return Json.optional(json, "phone_number_prefix", Conv.STRING); + } + + /** + * Phone number without country prefix + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * Complete phone number with country prefix + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullNumber() { + return Json.optional(json, "full_number", Conv.STRING); + } + + /** + * Two-letter country code (ISO 3166-1 alpha-2) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Full country name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryName() { + return Json.optional(json, "country_name", Conv.STRING); + } + + /** + * The carrier field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional carrier() { + return Json.optional(json, "carrier", Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Carrier::fromJson)); + } + + /** + * Whether the phone number is from a disposable service + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * Whether the phone number is virtual + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVirtual() { + return Json.optional(json, "is_virtual", Conv.BOOLEAN); + } + + /** + * Method used to verify the phone number + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationMethod() { + return Json.optional(json, "verification_method", Conv.STRING); + } + + /** + * Number of verification attempts made + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationAttempts() { + return Json.optional(json, "verification_attempts", Conv.LONG); + } + + /** + * Timestamp when the phone was verified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * Chronological list of events in the phone verification lifecycle. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lifecycle() { + return Json.optional(json, "lifecycle", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Lifecycle::fromJson))); + } + + /** + * List of warnings related to phone verification + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Warnings::fromJson))); + } + + /** + * Matches found for this phone number. Each match has a source: session (another verification session in your application matched on the same number, returned with session_id/session_number/vendor_data/verification_date) or list_entry (the number is on an org-managed allow/block list โ€” see /management-api/lists/overview). Cross-session matches use different vendor_data and are capped at 5. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Matches::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PhoneVerifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PhoneVerifications from) { + super(from); + } + + /** + * Unique identifier for this phone step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this phone verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.PhoneVerifications.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.PhoneVerifications.Status::of), status); + } + + /** + * Country calling code prefix + * + * @param phoneNumberPrefix the value + * @return this builder + */ + public Builder phoneNumberPrefix(String phoneNumberPrefix) { + return set("phone_number_prefix", Conv.STRING, phoneNumberPrefix); + } + + /** + * Phone number without country prefix + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * Complete phone number with country prefix + * + * @param fullNumber the value + * @return this builder + */ + public Builder fullNumber(String fullNumber) { + return set("full_number", Conv.STRING, fullNumber); + } + + /** + * Two-letter country code (ISO 3166-1 alpha-2) + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Full country name + * + * @param countryName the value + * @return this builder + */ + public Builder countryName(String countryName) { + return set("country_name", Conv.STRING, countryName); + } + + /** + * The carrier field. + * + * @param carrier the value + * @return this builder + */ + public Builder carrier(SessionsRetrieveDecisionResponse.PhoneVerifications.Carrier carrier) { + return set("carrier", Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Carrier::fromJson), carrier); + } + + /** + * Whether the phone number is from a disposable service + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * Whether the phone number is virtual + * + * @param isVirtual the value + * @return this builder + */ + public Builder isVirtual(boolean isVirtual) { + return set("is_virtual", Conv.BOOLEAN, isVirtual); + } + + /** + * Method used to verify the phone number + * + * @param verificationMethod the value + * @return this builder + */ + public Builder verificationMethod(String verificationMethod) { + return set("verification_method", Conv.STRING, verificationMethod); + } + + /** + * Number of verification attempts made + * + * @param verificationAttempts the value + * @return this builder + */ + public Builder verificationAttempts(long verificationAttempts) { + return set("verification_attempts", Conv.LONG, verificationAttempts); + } + + /** + * Timestamp when the phone was verified + * + * @param verifiedAt the value + * @return this builder + */ + public Builder verifiedAt(OffsetDateTime verifiedAt) { + return set("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * Chronological list of events in the phone verification lifecycle. + * + * @param lifecycle the value + * @return this builder + */ + public Builder lifecycle(List lifecycle) { + return set("lifecycle", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Lifecycle::fromJson)), lifecycle); + } + + /** + * List of warnings related to phone verification + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Warnings::fromJson)), warnings); + } + + /** + * Matches found for this phone number. Each match has a source: session (another verification session in your application matched on the same number, returned with session_id/session_number/vendor_data/verification_date) or list_entry (the number is on an org-managed allow/block list โ€” see /management-api/lists/overview). Cross-session matches use different vendor_data and are capped at 5. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Matches::fromJson)), matches); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PhoneVerifications} + */ + public PhoneVerifications build() { + return new PhoneVerifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this phone verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, EXPIRED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Carrier extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "type"); + + private Carrier(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Carrier} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Carrier fromJson(JsonNode json) { + return new Carrier(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Name of the phone carrier + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Type of phone line (mobile, landline, etc) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Carrier}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Carrier from) { + super(from); + } + + /** + * Name of the phone carrier + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Type of phone line (mobile, landline, etc) + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Carrier} + */ + public Carrier build() { + return new Carrier(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Lifecycle extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "timestamp", "details", "fee"); + + private Lifecycle(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Lifecycle} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Lifecycle fromJson(JsonNode json) { + return new Lifecycle(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * The timestamp field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timestamp() { + return Json.optional(json, "timestamp", Conv.DATE_TIME); + } + + /** + * Event-specific payload. Send events carry status, reason, channel, actual_channel; delivery events carry channel, status; code-check events carry code_tried, status; final status events carry reason โ€” or null when there is no reason to report (e.g. PHONE_VERIFICATION_APPROVED). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional details() { + return Json.optional(json, "details", Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Lifecycle.Details::fromJson)); + } + + /** + * The fee field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fee() { + return Json.optional(json, "fee", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Lifecycle}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Lifecycle from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * The timestamp field. + * + * @param timestamp the value + * @return this builder + */ + public Builder timestamp(OffsetDateTime timestamp) { + return set("timestamp", Conv.DATE_TIME, timestamp); + } + + /** + * Event-specific payload. Send events carry status, reason, channel, actual_channel; delivery events carry channel, status; code-check events carry code_tried, status; final status events carry reason โ€” or null when there is no reason to report (e.g. PHONE_VERIFICATION_APPROVED). + * + * @param details the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder details(SessionsRetrieveDecisionResponse.PhoneVerifications.Lifecycle.@Nullable Details details) { + return setNullable("details", Conv.model(SessionsRetrieveDecisionResponse.PhoneVerifications.Lifecycle.Details::fromJson), details); + } + + /** + * The fee field. + * + * @param fee the value + * @return this builder + */ + public Builder fee(double fee) { + return set("fee", Conv.DOUBLE, fee); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Lifecycle} + */ + public Lifecycle build() { + return new Lifecycle(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Event-specific payload. Send events carry status, reason, channel, actual_channel; delivery events carry channel, status; code-check events carry code_tried, status; final status events carry reason โ€” or null when there is no reason to report (e.g. PHONE_VERIFICATION_APPROVED). + */ + public static final class Details extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "reason", "channel", "actual_channel", "code_tried"); + + private Details(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Details} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Details fromJson(JsonNode json) { + return new Details(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The channel field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional channel() { + return Json.optional(json, "channel", Conv.STRING); + } + + /** + * The actual_channel field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actualChannel() { + return Json.optional(json, "actual_channel", Conv.STRING); + } + + /** + * The code_tried field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional codeTried() { + return Json.optional(json, "code_tried", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Details}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Details from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The channel field. + * + * @param channel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder channel(@Nullable String channel) { + return setNullable("channel", Conv.STRING, channel); + } + + /** + * The actual_channel field. + * + * @param actualChannel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actualChannel(@Nullable String actualChannel) { + return setNullable("actual_channel", Conv.STRING, actualChannel); + } + + /** + * The code_tried field. + * + * @param codeTried the value + * @return this builder + */ + public Builder codeTried(String codeTried) { + return set("code_tried", Conv.STRING, codeTried); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Details} + */ + public Details build() { + return new Details(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.PhoneVerifications.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.PhoneVerifications.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.PhoneVerifications.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "phone_number", "status", "is_blocklisted", "api_service", "source"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The session_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The session_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * The vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The verification_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * The phone_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The is_blocklisted field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * The api_service field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Where this match came from. session means another verification session in your application matched on this value. list_entry means the value was hit against an org-managed list (allowlist/blocklist) โ€” see the management API lists overview at /management-api/lists/overview for how to manage those lists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(SessionsRetrieveDecisionResponse.PhoneVerifications.Matches.Source::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * The session_id field. + * + * @param sessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionId(@Nullable String sessionId) { + return setNullable("session_id", Conv.STRING, sessionId); + } + + /** + * The session_number field. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * The vendor_data field. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The verification_date field. + * + * @param verificationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationDate(@Nullable OffsetDateTime verificationDate) { + return setNullable("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * The phone_number field. + * + * @param phoneNumber the value + * @return this builder + */ + public Builder phoneNumber(String phoneNumber) { + return set("phone_number", Conv.STRING, phoneNumber); + } + + /** + * The status field. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * The is_blocklisted field. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * The api_service field. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Where this match came from. session means another verification session in your application matched on this value. list_entry means the value was hit against an org-managed list (allowlist/blocklist) โ€” see the management API lists overview at /management-api/lists/overview for how to manage those lists. + * + * @param source the value + * @return this builder + */ + public Builder source(SessionsRetrieveDecisionResponse.PhoneVerifications.Matches.Source source) { + return set("source", Conv.enumeration(SessionsRetrieveDecisionResponse.PhoneVerifications.Matches.Source::of), source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Where this match came from. session means another verification session in your application matched on this value. list_entry means the value was hit against an org-managed list (allowlist/blocklist) โ€” see the management API lists overview at /management-api/lists/overview for how to manage those lists. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "session"}. */ + public static final Source SESSION = new Source("session"); + + /** The value {@code "list_entry"}. */ + public static final Source LIST_ENTRY = new Source("list_entry"); + + private static final List KNOWN_VALUES = List.of(SESSION, LIST_ENTRY); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class EmailVerifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "email", "is_breached", "breaches", "is_disposable", "is_undeliverable", "verification_attempts", "verified_at", "warnings", "lifecycle", "matches"); + + private EmailVerifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code EmailVerifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static EmailVerifications fromJson(JsonNode json) { + return new EmailVerifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this email step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this email verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.EmailVerifications.Status::of)); + } + + /** + * The email address being verified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * Indicates if the email was found in known data breaches + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBreached() { + return Json.optional(json, "is_breached", Conv.BOOLEAN); + } + + /** + * List of known breaches this email was found in + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> breaches() { + return Json.optional(json, "breaches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Breaches::fromJson))); + } + + /** + * Indicates if the email is from a disposable provider + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDisposable() { + return Json.optional(json, "is_disposable", Conv.BOOLEAN); + } + + /** + * Indicates if the email address is undeliverable + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isUndeliverable() { + return Json.optional(json, "is_undeliverable", Conv.BOOLEAN); + } + + /** + * Number of verification attempts for this email + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationAttempts() { + return Json.optional(json, "verification_attempts", Conv.LONG); + } + + /** + * Timestamp when the email was verified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifiedAt() { + return Json.optional(json, "verified_at", Conv.DATE_TIME); + } + + /** + * List of warnings related to email verification + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Warnings::fromJson))); + } + + /** + * Chronological list of events in the email verification lifecycle. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lifecycle() { + return Json.optional(json, "lifecycle", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Lifecycle::fromJson))); + } + + /** + * Matches found for this email address. Each match has a source: session (another verification session in your application matched on the same email, returned with session_id/session_number/vendor_data/verification_date) or list_entry (the email is on an org-managed allow/block list โ€” see /management-api/lists/overview). Cross-session matches use different vendor_data and are capped at 5. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Matches::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link EmailVerifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(EmailVerifications from) { + super(from); + } + + /** + * Unique identifier for this email step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this email verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.EmailVerifications.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.EmailVerifications.Status::of), status); + } + + /** + * The email address being verified + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Indicates if the email was found in known data breaches + * + * @param isBreached the value + * @return this builder + */ + public Builder isBreached(boolean isBreached) { + return set("is_breached", Conv.BOOLEAN, isBreached); + } + + /** + * List of known breaches this email was found in + * + * @param breaches the value + * @return this builder + */ + public Builder breaches(List breaches) { + return set("breaches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Breaches::fromJson)), breaches); + } + + /** + * Indicates if the email is from a disposable provider + * + * @param isDisposable the value + * @return this builder + */ + public Builder isDisposable(boolean isDisposable) { + return set("is_disposable", Conv.BOOLEAN, isDisposable); + } + + /** + * Indicates if the email address is undeliverable + * + * @param isUndeliverable the value + * @return this builder + */ + public Builder isUndeliverable(boolean isUndeliverable) { + return set("is_undeliverable", Conv.BOOLEAN, isUndeliverable); + } + + /** + * Number of verification attempts for this email + * + * @param verificationAttempts the value + * @return this builder + */ + public Builder verificationAttempts(long verificationAttempts) { + return set("verification_attempts", Conv.LONG, verificationAttempts); + } + + /** + * Timestamp when the email was verified + * + * @param verifiedAt the value + * @return this builder + */ + public Builder verifiedAt(OffsetDateTime verifiedAt) { + return set("verified_at", Conv.DATE_TIME, verifiedAt); + } + + /** + * List of warnings related to email verification + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Warnings::fromJson)), warnings); + } + + /** + * Chronological list of events in the email verification lifecycle. + * + * @param lifecycle the value + * @return this builder + */ + public Builder lifecycle(List lifecycle) { + return set("lifecycle", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Lifecycle::fromJson)), lifecycle); + } + + /** + * Matches found for this email address. Each match has a source: session (another verification session in your application matched on the same email, returned with session_id/session_number/vendor_data/verification_date) or list_entry (the email is on an org-managed allow/block list โ€” see /management-api/lists/overview). Cross-session matches use different vendor_data and are capped at 5. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Matches::fromJson)), matches); + } + + /** + * Builds the value. + * + * @return a new immutable {@code EmailVerifications} + */ + public EmailVerifications build() { + return new EmailVerifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this email verification step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Expired"}. */ + public static final Status EXPIRED = new Status("Expired"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, EXPIRED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Breaches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "domain", "logo_path", "breach_date", "description", "is_verified", "data_classes", "breach_emails_count"); + + private Breaches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Breaches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Breaches fromJson(JsonNode json) { + return new Breaches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Name of the breach + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Domain affected by the breach + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional domain() { + return Json.optional(json, "domain", Conv.STRING); + } + + /** + * URL to the logo of the breached service + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logoPath() { + return Json.optional(json, "logo_path", Conv.STRING); + } + + /** + * Date when the breach occurred + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachDate() { + return Json.optional(json, "breach_date", Conv.DATE); + } + + /** + * Description of the breach + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Whether the breach is verified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVerified() { + return Json.optional(json, "is_verified", Conv.BOOLEAN); + } + + /** + * Types of data exposed in the breach + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> dataClasses() { + return Json.optional(json, "data_classes", Conv.list(Conv.STRING)); + } + + /** + * Number of email addresses affected in the breach + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional breachEmailsCount() { + return Json.optional(json, "breach_emails_count", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Breaches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Breaches from) { + super(from); + } + + /** + * Name of the breach + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Domain affected by the breach + * + * @param domain the value + * @return this builder + */ + public Builder domain(String domain) { + return set("domain", Conv.STRING, domain); + } + + /** + * URL to the logo of the breached service + * + * @param logoPath the value + * @return this builder + */ + public Builder logoPath(String logoPath) { + return set("logo_path", Conv.STRING, logoPath); + } + + /** + * Date when the breach occurred + * + * @param breachDate the value + * @return this builder + */ + public Builder breachDate(LocalDate breachDate) { + return set("breach_date", Conv.DATE, breachDate); + } + + /** + * Description of the breach + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Whether the breach is verified + * + * @param isVerified the value + * @return this builder + */ + public Builder isVerified(boolean isVerified) { + return set("is_verified", Conv.BOOLEAN, isVerified); + } + + /** + * Types of data exposed in the breach + * + * @param dataClasses the value + * @return this builder + */ + public Builder dataClasses(List dataClasses) { + return set("data_classes", Conv.list(Conv.STRING), dataClasses); + } + + /** + * Number of email addresses affected in the breach + * + * @param breachEmailsCount the value + * @return this builder + */ + public Builder breachEmailsCount(long breachEmailsCount) { + return set("breach_emails_count", Conv.LONG, breachEmailsCount); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Breaches} + */ + public Breaches build() { + return new Breaches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.EmailVerifications.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.EmailVerifications.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.EmailVerifications.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Lifecycle extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "timestamp", "details", "fee"); + + private Lifecycle(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Lifecycle} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Lifecycle fromJson(JsonNode json) { + return new Lifecycle(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + /** + * The timestamp field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timestamp() { + return Json.optional(json, "timestamp", Conv.DATE_TIME); + } + + /** + * Event-specific payload. Send events carry status, reason; code-check events carry code_tried, status; final status events carry reason โ€” or null when there is no reason to report (e.g. EMAIL_VERIFICATION_APPROVED). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional details() { + return Json.optional(json, "details", Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Lifecycle.Details::fromJson)); + } + + /** + * The fee field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fee() { + return Json.optional(json, "fee", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Lifecycle}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Lifecycle from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * The timestamp field. + * + * @param timestamp the value + * @return this builder + */ + public Builder timestamp(OffsetDateTime timestamp) { + return set("timestamp", Conv.DATE_TIME, timestamp); + } + + /** + * Event-specific payload. Send events carry status, reason; code-check events carry code_tried, status; final status events carry reason โ€” or null when there is no reason to report (e.g. EMAIL_VERIFICATION_APPROVED). + * + * @param details the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder details(SessionsRetrieveDecisionResponse.EmailVerifications.Lifecycle.@Nullable Details details) { + return setNullable("details", Conv.model(SessionsRetrieveDecisionResponse.EmailVerifications.Lifecycle.Details::fromJson), details); + } + + /** + * The fee field. + * + * @param fee the value + * @return this builder + */ + public Builder fee(double fee) { + return set("fee", Conv.DOUBLE, fee); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Lifecycle} + */ + public Lifecycle build() { + return new Lifecycle(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Event-specific payload. Send events carry status, reason; code-check events carry code_tried, status; final status events carry reason โ€” or null when there is no reason to report (e.g. EMAIL_VERIFICATION_APPROVED). + */ + public static final class Details extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "reason", "code_tried"); + + private Details(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Details} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Details fromJson(JsonNode json) { + return new Details(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The reason field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * The code_tried field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional codeTried() { + return Json.optional(json, "code_tried", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Details}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Details from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The reason field. + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * The code_tried field. + * + * @param codeTried the value + * @return this builder + */ + public Builder codeTried(String codeTried) { + return set("code_tried", Conv.STRING, codeTried); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Details} + */ + public Details build() { + return new Details(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "email", "status", "is_blocklisted", "api_service", "source"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The session_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The session_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * The vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The verification_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The is_blocklisted field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * The api_service field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Where this match came from. session means another verification session in your application matched on this value. list_entry means the value was hit against an org-managed list (allowlist/blocklist) โ€” see the management API lists overview at /management-api/lists/overview for how to manage those lists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(SessionsRetrieveDecisionResponse.EmailVerifications.Matches.Source::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * The session_id field. + * + * @param sessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionId(@Nullable String sessionId) { + return setNullable("session_id", Conv.STRING, sessionId); + } + + /** + * The session_number field. + * + * @param sessionNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sessionNumber(@Nullable Long sessionNumber) { + return setNullable("session_number", Conv.LONG, sessionNumber); + } + + /** + * The vendor_data field. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The verification_date field. + * + * @param verificationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationDate(@Nullable OffsetDateTime verificationDate) { + return setNullable("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * The status field. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * The is_blocklisted field. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * The api_service field. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Where this match came from. session means another verification session in your application matched on this value. list_entry means the value was hit against an org-managed list (allowlist/blocklist) โ€” see the management API lists overview at /management-api/lists/overview for how to manage those lists. + * + * @param source the value + * @return this builder + */ + public Builder source(SessionsRetrieveDecisionResponse.EmailVerifications.Matches.Source source) { + return set("source", Conv.enumeration(SessionsRetrieveDecisionResponse.EmailVerifications.Matches.Source::of), source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Where this match came from. session means another verification session in your application matched on this value. list_entry means the value was hit against an org-managed list (allowlist/blocklist) โ€” see the management API lists overview at /management-api/lists/overview for how to manage those lists. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "session"}. */ + public static final Source SESSION = new Source("session"); + + /** The value {@code "list_entry"}. */ + public static final Source LIST_ENTRY = new Source("list_entry"); + + private static final List KNOWN_VALUES = List.of(SESSION, LIST_ENTRY); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class PoaVerifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "document_file", "issuing_state", "document_type", "document_subtype", "document_language", "document_metadata", "issuer", "issue_date", "expiration_date", "poa_address", "poa_formatted_address", "poa_parsed_address", "name_on_document", "name_match_score_expected_details", "name_match_score_id_verification", "expected_details_address", "expected_details_formatted_address", "expected_details_parsed_address", "extra_fields", "extra_files", "warnings", "detected_codes"); + + private PoaVerifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PoaVerifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PoaVerifications fromJson(JsonNode json) { + return new PoaVerifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this POA step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this Proof of Address step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.PoaVerifications.Status::of)); + } + + /** + * URL of the proof of address document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentFile() { + return Json.optional(json, "document_file", Conv.STRING); + } + + /** + * Two-letter country code of the issuing state + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * Type of proof of address document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * More specific classification of the POA document within its document_type, when one was detected. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * Language code of the document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLanguage() { + return Json.optional(json, "document_language", Conv.STRING); + } + + /** + * File-forensics metadata extracted from the uploaded POA document. Always contains the keys below (values are null when not applicable, e.g. EXIF dates for PDFs). null when no metadata could be extracted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentMetadata() { + return Json.optional(json, "document_metadata", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata::fromJson)); + } + + /** + * Name of the document issuer + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + /** + * Date when the document was issued + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issueDate() { + return Json.optional(json, "issue_date", Conv.DATE); + } + + /** + * Expiration date of the document, if available + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * Raw address from the proof of address document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaAddress() { + return Json.optional(json, "poa_address", Conv.STRING); + } + + /** + * Formatted address from the proof of address document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaFormattedAddress() { + return Json.optional(json, "poa_formatted_address", Conv.STRING); + } + + /** + * The poa_parsed_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaParsedAddress() { + return Json.optional(json, "poa_parsed_address", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.PoaParsedAddress::fromJson)); + } + + /** + * Account-holder / addressee name extracted from the POA document, used for name matching. null when no name could be extracted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameOnDocument() { + return Json.optional(json, "name_on_document", Conv.STRING); + } + + /** + * Similarity score (0-100) between name_on_document and the expected name supplied at session creation. null when either side is missing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameMatchScoreExpectedDetails() { + return Json.optional(json, "name_match_score_expected_details", Conv.DOUBLE); + } + + /** + * Similarity score (0-100) between name_on_document and the name extracted by the ID verification step. null when either side is missing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameMatchScoreIdVerification() { + return Json.optional(json, "name_match_score_id_verification", Conv.DOUBLE); + } + + /** + * Expected raw address for verification + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedDetailsAddress() { + return Json.optional(json, "expected_details_address", Conv.STRING); + } + + /** + * Expected formatted address for verification + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedDetailsFormattedAddress() { + return Json.optional(json, "expected_details_formatted_address", Conv.STRING); + } + + /** + * Expected parsed address details for verification + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> expectedDetailsParsedAddress() { + return Json.optional(json, "expected_details_parsed_address", Conv.OBJECT); + } + + /** + * Additional banking and contact details extracted from the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional extraFields() { + return Json.optional(json, "extra_fields", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.ExtraFields::fromJson)); + } + + /** + * Additional proof of address files + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFiles() { + return Json.optional(json, "extra_files", Conv.list(Conv.STRING)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.Warnings::fromJson))); + } + + /** + * QR codes and barcodes detected across every processed page of the document. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> detectedCodes() { + return Json.optional(json, "detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PoaVerifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PoaVerifications from) { + super(from); + } + + /** + * Unique identifier for this POA step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this Proof of Address step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.PoaVerifications.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.PoaVerifications.Status::of), status); + } + + /** + * URL of the proof of address document + * + * @param documentFile the value + * @return this builder + */ + public Builder documentFile(String documentFile) { + return set("document_file", Conv.STRING, documentFile); + } + + /** + * Two-letter country code of the issuing state + * + * @param issuingState the value + * @return this builder + */ + public Builder issuingState(String issuingState) { + return set("issuing_state", Conv.STRING, issuingState); + } + + /** + * Type of proof of address document + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * More specific classification of the POA document within its document_type, when one was detected. null otherwise. + * + * @param documentSubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSubtype(@Nullable String documentSubtype) { + return setNullable("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * Language code of the document + * + * @param documentLanguage the value + * @return this builder + */ + public Builder documentLanguage(String documentLanguage) { + return set("document_language", Conv.STRING, documentLanguage); + } + + /** + * File-forensics metadata extracted from the uploaded POA document. Always contains the keys below (values are null when not applicable, e.g. EXIF dates for PDFs). null when no metadata could be extracted. + * + * @param documentMetadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentMetadata(SessionsRetrieveDecisionResponse.PoaVerifications.@Nullable DocumentMetadata documentMetadata) { + return setNullable("document_metadata", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata::fromJson), documentMetadata); + } + + /** + * Name of the document issuer + * + * @param issuer the value + * @return this builder + */ + public Builder issuer(String issuer) { + return set("issuer", Conv.STRING, issuer); + } + + /** + * Date when the document was issued + * + * @param issueDate the value + * @return this builder + */ + public Builder issueDate(LocalDate issueDate) { + return set("issue_date", Conv.DATE, issueDate); + } + + /** + * Expiration date of the document, if available + * + * @param expirationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expirationDate(@Nullable LocalDate expirationDate) { + return setNullable("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Raw address from the proof of address document + * + * @param poaAddress the value + * @return this builder + */ + public Builder poaAddress(String poaAddress) { + return set("poa_address", Conv.STRING, poaAddress); + } + + /** + * Formatted address from the proof of address document + * + * @param poaFormattedAddress the value + * @return this builder + */ + public Builder poaFormattedAddress(String poaFormattedAddress) { + return set("poa_formatted_address", Conv.STRING, poaFormattedAddress); + } + + /** + * The poa_parsed_address field. + * + * @param poaParsedAddress the value + * @return this builder + */ + public Builder poaParsedAddress(SessionsRetrieveDecisionResponse.PoaVerifications.PoaParsedAddress poaParsedAddress) { + return set("poa_parsed_address", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.PoaParsedAddress::fromJson), poaParsedAddress); + } + + /** + * Account-holder / addressee name extracted from the POA document, used for name matching. null when no name could be extracted. + * + * @param nameOnDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameOnDocument(@Nullable String nameOnDocument) { + return setNullable("name_on_document", Conv.STRING, nameOnDocument); + } + + /** + * Similarity score (0-100) between name_on_document and the expected name supplied at session creation. null when either side is missing. + * + * @param nameMatchScoreExpectedDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameMatchScoreExpectedDetails(@Nullable Double nameMatchScoreExpectedDetails) { + return setNullable("name_match_score_expected_details", Conv.DOUBLE, nameMatchScoreExpectedDetails); + } + + /** + * Similarity score (0-100) between name_on_document and the name extracted by the ID verification step. null when either side is missing. + * + * @param nameMatchScoreIdVerification the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameMatchScoreIdVerification(@Nullable Double nameMatchScoreIdVerification) { + return setNullable("name_match_score_id_verification", Conv.DOUBLE, nameMatchScoreIdVerification); + } + + /** + * Expected raw address for verification + * + * @param expectedDetailsAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedDetailsAddress(@Nullable String expectedDetailsAddress) { + return setNullable("expected_details_address", Conv.STRING, expectedDetailsAddress); + } + + /** + * Expected formatted address for verification + * + * @param expectedDetailsFormattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedDetailsFormattedAddress(@Nullable String expectedDetailsFormattedAddress) { + return setNullable("expected_details_formatted_address", Conv.STRING, expectedDetailsFormattedAddress); + } + + /** + * Expected parsed address details for verification + * + * @param expectedDetailsParsedAddress the value + * @return this builder + */ + public Builder expectedDetailsParsedAddress(Map expectedDetailsParsedAddress) { + return setAny("expected_details_parsed_address", expectedDetailsParsedAddress); + } + + /** + * Additional banking and contact details extracted from the document. + * + * @param extraFields the value + * @return this builder + */ + public Builder extraFields(SessionsRetrieveDecisionResponse.PoaVerifications.ExtraFields extraFields) { + return set("extra_fields", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.ExtraFields::fromJson), extraFields); + } + + /** + * Additional proof of address files + * + * @param extraFiles the value + * @return this builder + */ + public Builder extraFiles(List extraFiles) { + return set("extra_files", Conv.list(Conv.STRING), extraFiles); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.Warnings::fromJson)), warnings); + } + + /** + * QR codes and barcodes detected across every processed page of the document. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @param detectedCodes the value + * @return this builder + */ + public Builder detectedCodes(List detectedCodes) { + return set("detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson)), detectedCodes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PoaVerifications} + */ + public PoaVerifications build() { + return new PoaVerifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this Proof of Address step. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * File-forensics metadata extracted from the uploaded POA document. Always contains the keys below (values are null when not applicable, e.g. EXIF dates for PDFs). null when no metadata could be extracted. + */ + public static final class DocumentMetadata extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("file_size", "content_type", "creation_date", "modified_date", "overlay_manipulation", "creator", "producer", "software", "encryption", "is_signed", "is_tampered", "signature_info", "exif_original_date", "exif_digitized_date", "processed_by_known_editor", "has_different_creation_mod_date"); + + private DocumentMetadata(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentMetadata} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentMetadata fromJson(JsonNode json) { + return new DocumentMetadata(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Size of the document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + /** + * Content type of the document + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentType() { + return Json.optional(json, "content_type", Conv.STRING); + } + + /** + * Date when the document was created + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional creationDate() { + return Json.optional(json, "creation_date", Conv.DATE); + } + + /** + * Date when the document was modified + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional modifiedDate() { + return Json.optional(json, "modified_date", Conv.DATE); + } + + /** + * PDF forensic analysis for suspected overlay-text manipulation. Null when no overlay manipulation evidence was found or the document was not a PDF. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overlayManipulation() { + return Json.optional(json, "overlay_manipulation", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata.OverlayManipulation::fromJson)); + } + + /** + * Creator application recorded in the document metadata. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional creator() { + return Json.optional(json, "creator", Conv.STRING); + } + + /** + * Producer software recorded in the PDF metadata. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional producer() { + return Json.optional(json, "producer", Conv.STRING); + } + + /** + * Editing/processing software recorded in the file metadata. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional software() { + return Json.optional(json, "software", Conv.STRING); + } + + /** + * Encryption scheme of the document, when encrypted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional encryption() { + return Json.optional(json, "encryption", Conv.STRING); + } + + /** + * Whether the PDF carries a digital signature. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSigned() { + return Json.optional(json, "is_signed", Conv.BOOLEAN); + } + + /** + * Whether signature validation indicates the file was modified after signing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isTampered() { + return Json.optional(json, "is_tampered", Conv.BOOLEAN); + } + + /** + * Details of the digital signature(s), when present. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signatureInfo() { + return Json.optional(json, "signature_info", Conv.OBJECT); + } + + /** + * EXIF original capture date, for image uploads. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exifOriginalDate() { + return Json.optional(json, "exif_original_date", Conv.STRING); + } + + /** + * EXIF digitization date, for image uploads. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exifDigitizedDate() { + return Json.optional(json, "exif_digitized_date", Conv.STRING); + } + + /** + * Whether the file metadata indicates processing by a known document editor. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processedByKnownEditor() { + return Json.optional(json, "processed_by_known_editor", Conv.BOOLEAN); + } + + /** + * Whether the creation and modification dates differ โ€” a common manipulation signal. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hasDifferentCreationModDate() { + return Json.optional(json, "has_different_creation_mod_date", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentMetadata}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentMetadata from) { + super(from); + } + + /** + * Size of the document + * + * @param fileSize the value + * @return this builder + */ + public Builder fileSize(long fileSize) { + return set("file_size", Conv.LONG, fileSize); + } + + /** + * Content type of the document + * + * @param contentType the value + * @return this builder + */ + public Builder contentType(String contentType) { + return set("content_type", Conv.STRING, contentType); + } + + /** + * Date when the document was created + * + * @param creationDate the value + * @return this builder + */ + public Builder creationDate(LocalDate creationDate) { + return set("creation_date", Conv.DATE, creationDate); + } + + /** + * Date when the document was modified + * + * @param modifiedDate the value + * @return this builder + */ + public Builder modifiedDate(LocalDate modifiedDate) { + return set("modified_date", Conv.DATE, modifiedDate); + } + + /** + * PDF forensic analysis for suspected overlay-text manipulation. Null when no overlay manipulation evidence was found or the document was not a PDF. + * + * @param overlayManipulation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder overlayManipulation(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata.@Nullable OverlayManipulation overlayManipulation) { + return setNullable("overlay_manipulation", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata.OverlayManipulation::fromJson), overlayManipulation); + } + + /** + * Creator application recorded in the document metadata. + * + * @param creator the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder creator(@Nullable String creator) { + return setNullable("creator", Conv.STRING, creator); + } + + /** + * Producer software recorded in the PDF metadata. + * + * @param producer the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder producer(@Nullable String producer) { + return setNullable("producer", Conv.STRING, producer); + } + + /** + * Editing/processing software recorded in the file metadata. + * + * @param software the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder software(@Nullable String software) { + return setNullable("software", Conv.STRING, software); + } + + /** + * Encryption scheme of the document, when encrypted. + * + * @param encryption the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder encryption(@Nullable String encryption) { + return setNullable("encryption", Conv.STRING, encryption); + } + + /** + * Whether the PDF carries a digital signature. + * + * @param isSigned the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isSigned(@Nullable Boolean isSigned) { + return setNullable("is_signed", Conv.BOOLEAN, isSigned); + } + + /** + * Whether signature validation indicates the file was modified after signing. + * + * @param isTampered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isTampered(@Nullable Boolean isTampered) { + return setNullable("is_tampered", Conv.BOOLEAN, isTampered); + } + + /** + * Details of the digital signature(s), when present. + * + * @param signatureInfo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder signatureInfo(@Nullable Map signatureInfo) { + return setAny("signature_info", signatureInfo); + } + + /** + * EXIF original capture date, for image uploads. + * + * @param exifOriginalDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder exifOriginalDate(@Nullable String exifOriginalDate) { + return setNullable("exif_original_date", Conv.STRING, exifOriginalDate); + } + + /** + * EXIF digitization date, for image uploads. + * + * @param exifDigitizedDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder exifDigitizedDate(@Nullable String exifDigitizedDate) { + return setNullable("exif_digitized_date", Conv.STRING, exifDigitizedDate); + } + + /** + * Whether the file metadata indicates processing by a known document editor. + * + * @param processedByKnownEditor the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder processedByKnownEditor(@Nullable Boolean processedByKnownEditor) { + return setNullable("processed_by_known_editor", Conv.BOOLEAN, processedByKnownEditor); + } + + /** + * Whether the creation and modification dates differ โ€” a common manipulation signal. + * + * @param hasDifferentCreationModDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder hasDifferentCreationModDate(@Nullable Boolean hasDifferentCreationModDate) { + return setNullable("has_different_creation_mod_date", Conv.BOOLEAN, hasDifferentCreationModDate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentMetadata} + */ + public DocumentMetadata build() { + return new DocumentMetadata(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * PDF forensic analysis for suspected overlay-text manipulation. Null when no overlay manipulation evidence was found or the document was not a PDF. + */ + public static final class OverlayManipulation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detected", "analyzed", "signals", "manipulated_regions"); + + private OverlayManipulation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code OverlayManipulation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static OverlayManipulation fromJson(JsonNode json) { + return new OverlayManipulation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Whether overlay-text manipulation evidence was detected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detected() { + return Json.optional(json, "detected", Conv.BOOLEAN); + } + + /** + * Whether the PDF could be analyzed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional analyzed() { + return Json.optional(json, "analyzed", Conv.BOOLEAN); + } + + /** + * Forensic signals that fired, such as duplicate_font_subset or glyph_fragmentation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signals() { + return Json.optional(json, "signals", Conv.list(Conv.STRING)); + } + + /** + * Suspected manipulated areas in PDF page coordinates. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> manipulatedRegions() { + return Json.optional(json, "manipulated_regions", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata.OverlayManipulation.ManipulatedRegions::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link OverlayManipulation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(OverlayManipulation from) { + super(from); + } + + /** + * Whether overlay-text manipulation evidence was detected. + * + * @param detected the value + * @return this builder + */ + public Builder detected(boolean detected) { + return set("detected", Conv.BOOLEAN, detected); + } + + /** + * Whether the PDF could be analyzed. + * + * @param analyzed the value + * @return this builder + */ + public Builder analyzed(boolean analyzed) { + return set("analyzed", Conv.BOOLEAN, analyzed); + } + + /** + * Forensic signals that fired, such as duplicate_font_subset or glyph_fragmentation. + * + * @param signals the value + * @return this builder + */ + public Builder signals(List signals) { + return set("signals", Conv.list(Conv.STRING), signals); + } + + /** + * Suspected manipulated areas in PDF page coordinates. + * + * @param manipulatedRegions the value + * @return this builder + */ + public Builder manipulatedRegions(List manipulatedRegions) { + return set("manipulated_regions", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.DocumentMetadata.OverlayManipulation.ManipulatedRegions::fromJson)), manipulatedRegions); + } + + /** + * Builds the value. + * + * @return a new immutable {@code OverlayManipulation} + */ + public OverlayManipulation build() { + return new OverlayManipulation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class ManipulatedRegions extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("page", "x", "y", "width", "height", "page_width", "page_height"); + + private ManipulatedRegions(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ManipulatedRegions} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ManipulatedRegions fromJson(JsonNode json) { + return new ManipulatedRegions(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The page field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional page() { + return Json.optional(json, "page", Conv.LONG); + } + + /** + * The x field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional x() { + return Json.optional(json, "x", Conv.DOUBLE); + } + + /** + * The y field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional y() { + return Json.optional(json, "y", Conv.DOUBLE); + } + + /** + * The width field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional width() { + return Json.optional(json, "width", Conv.DOUBLE); + } + + /** + * The height field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional height() { + return Json.optional(json, "height", Conv.DOUBLE); + } + + /** + * The page_width field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pageWidth() { + return Json.optional(json, "page_width", Conv.DOUBLE); + } + + /** + * The page_height field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pageHeight() { + return Json.optional(json, "page_height", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ManipulatedRegions}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ManipulatedRegions from) { + super(from); + } + + /** + * The page field. + * + * @param page the value + * @return this builder + */ + public Builder page(long page) { + return set("page", Conv.LONG, page); + } + + /** + * The x field. + * + * @param x the value + * @return this builder + */ + public Builder x(double x) { + return set("x", Conv.DOUBLE, x); + } + + /** + * The y field. + * + * @param y the value + * @return this builder + */ + public Builder y(double y) { + return set("y", Conv.DOUBLE, y); + } + + /** + * The width field. + * + * @param width the value + * @return this builder + */ + public Builder width(double width) { + return set("width", Conv.DOUBLE, width); + } + + /** + * The height field. + * + * @param height the value + * @return this builder + */ + public Builder height(double height) { + return set("height", Conv.DOUBLE, height); + } + + /** + * The page_width field. + * + * @param pageWidth the value + * @return this builder + */ + public Builder pageWidth(double pageWidth) { + return set("page_width", Conv.DOUBLE, pageWidth); + } + + /** + * The page_height field. + * + * @param pageHeight the value + * @return this builder + */ + public Builder pageHeight(double pageHeight) { + return set("page_height", Conv.DOUBLE, pageHeight); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ManipulatedRegions} + */ + public ManipulatedRegions build() { + return new ManipulatedRegions(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class PoaParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("address_type", "street_1", "street_2", "city", "region", "country", "postal_code", "document_location"); + + private PoaParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PoaParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PoaParsedAddress fromJson(JsonNode json) { + return new PoaParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Type of address (Street, Avenue, etc) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * Primary street address + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * Secondary street address + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * City name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * Region or state name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * Two-letter country code + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Postal code + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * The document_location field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLocation() { + return Json.optional(json, "document_location", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.PoaParsedAddress.DocumentLocation::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PoaParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PoaParsedAddress from) { + super(from); + } + + /** + * Type of address (Street, Avenue, etc) + * + * @param addressType the value + * @return this builder + */ + public Builder addressType(String addressType) { + return set("address_type", Conv.STRING, addressType); + } + + /** + * Primary street address + * + * @param street1 the value + * @return this builder + */ + public Builder street1(String street1) { + return set("street_1", Conv.STRING, street1); + } + + /** + * Secondary street address + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * City name + * + * @param city the value + * @return this builder + */ + public Builder city(String city) { + return set("city", Conv.STRING, city); + } + + /** + * Region or state name + * + * @param region the value + * @return this builder + */ + public Builder region(String region) { + return set("region", Conv.STRING, region); + } + + /** + * Two-letter country code + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * Postal code + * + * @param postalCode the value + * @return this builder + */ + public Builder postalCode(String postalCode) { + return set("postal_code", Conv.STRING, postalCode); + } + + /** + * The document_location field. + * + * @param documentLocation the value + * @return this builder + */ + public Builder documentLocation(SessionsRetrieveDecisionResponse.PoaVerifications.PoaParsedAddress.DocumentLocation documentLocation) { + return set("document_location", Conv.model(SessionsRetrieveDecisionResponse.PoaVerifications.PoaParsedAddress.DocumentLocation::fromJson), documentLocation); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PoaParsedAddress} + */ + public PoaParsedAddress build() { + return new PoaParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class DocumentLocation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private DocumentLocation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentLocation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentLocation fromJson(JsonNode json) { + return new DocumentLocation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Latitude coordinate + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Longitude coordinate + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentLocation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentLocation from) { + super(from); + } + + /** + * Latitude coordinate + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * Longitude coordinate + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentLocation} + */ + public DocumentLocation build() { + return new DocumentLocation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** Additional banking and contact details extracted from the document. */ + public static final class ExtraFields extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bank_account_number", "bank_iban", "bank_sort_code", "bank_routing_number", "bank_swift_bic", "bank_branch_name", "bank_branch_address", "document_phone_number", "additional_names"); + + private ExtraFields(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ExtraFields} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ExtraFields fromJson(JsonNode json) { + return new ExtraFields(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The bank_account_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankAccountNumber() { + return Json.optional(json, "bank_account_number", Conv.STRING); + } + + /** + * The bank_iban field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankIban() { + return Json.optional(json, "bank_iban", Conv.STRING); + } + + /** + * The bank_sort_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankSortCode() { + return Json.optional(json, "bank_sort_code", Conv.STRING); + } + + /** + * The bank_routing_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankRoutingNumber() { + return Json.optional(json, "bank_routing_number", Conv.STRING); + } + + /** + * The bank_swift_bic field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankSwiftBic() { + return Json.optional(json, "bank_swift_bic", Conv.STRING); + } + + /** + * The bank_branch_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankBranchName() { + return Json.optional(json, "bank_branch_name", Conv.STRING); + } + + /** + * The bank_branch_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bankBranchAddress() { + return Json.optional(json, "bank_branch_address", Conv.STRING); + } + + /** + * The document_phone_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentPhoneNumber() { + return Json.optional(json, "document_phone_number", Conv.STRING); + } + + /** + * The additional_names field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalNames() { + return Json.optional(json, "additional_names", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ExtraFields}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ExtraFields from) { + super(from); + } + + /** + * The bank_account_number field. + * + * @param bankAccountNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankAccountNumber(@Nullable String bankAccountNumber) { + return setNullable("bank_account_number", Conv.STRING, bankAccountNumber); + } + + /** + * The bank_iban field. + * + * @param bankIban the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankIban(@Nullable String bankIban) { + return setNullable("bank_iban", Conv.STRING, bankIban); + } + + /** + * The bank_sort_code field. + * + * @param bankSortCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankSortCode(@Nullable String bankSortCode) { + return setNullable("bank_sort_code", Conv.STRING, bankSortCode); + } + + /** + * The bank_routing_number field. + * + * @param bankRoutingNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankRoutingNumber(@Nullable String bankRoutingNumber) { + return setNullable("bank_routing_number", Conv.STRING, bankRoutingNumber); + } + + /** + * The bank_swift_bic field. + * + * @param bankSwiftBic the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankSwiftBic(@Nullable String bankSwiftBic) { + return setNullable("bank_swift_bic", Conv.STRING, bankSwiftBic); + } + + /** + * The bank_branch_name field. + * + * @param bankBranchName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankBranchName(@Nullable String bankBranchName) { + return setNullable("bank_branch_name", Conv.STRING, bankBranchName); + } + + /** + * The bank_branch_address field. + * + * @param bankBranchAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bankBranchAddress(@Nullable String bankBranchAddress) { + return setNullable("bank_branch_address", Conv.STRING, bankBranchAddress); + } + + /** + * The document_phone_number field. + * + * @param documentPhoneNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentPhoneNumber(@Nullable String documentPhoneNumber) { + return setNullable("document_phone_number", Conv.STRING, documentPhoneNumber); + } + + /** + * The additional_names field. + * + * @param additionalNames the value + * @return this builder + */ + public Builder additionalNames(List additionalNames) { + return set("additional_names", Conv.list(Conv.STRING), additionalNames); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ExtraFields} + */ + public ExtraFields build() { + return new ExtraFields(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.PoaVerifications.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.PoaVerifications.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.PoaVerifications.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + /** Document AI results grouped by workflow node. */ + public static final class DocumentAiDocuments extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "node_id", "items", "warnings"); + + private DocumentAiDocuments(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentAiDocuments} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentAiDocuments fromJson(JsonNode json) { + return new DocumentAiDocuments(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Aggregate Document AI status for this node, rolled up from its items[]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Status::of)); + } + + /** + * Unique identifier for this Document AI step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * The items field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> items() { + return Json.optional(json, "items", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items::fromJson))); + } + + /** + * Warning logs raised for this Document AI node. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.OBJECT)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentAiDocuments}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentAiDocuments from) { + super(from); + } + + /** + * Aggregate Document AI status for this node, rolled up from its items[]. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Status::of), status); + } + + /** + * Unique identifier for this Document AI step in the workflow graph. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * The items field. + * + * @param items the value + * @return this builder + */ + public Builder items(List items) { + return set("items", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items::fromJson)), items); + } + + /** + * Warning logs raised for this Document AI node. + * + * @param warnings the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder warnings(@Nullable List> warnings) { + return setAny("warnings", warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentAiDocuments} + */ + public DocumentAiDocuments build() { + return new DocumentAiDocuments(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Aggregate Document AI status for this node, rolled up from its items[]. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW, NOT_FINISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Items extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "node_id", "document_key", "original_filename", "file_size", "file_url", "status", "extracted_data", "detected_codes", "fields", "document_metadata", "cross_check_result", "created_at"); + + private Items(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Items} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Items fromJson(JsonNode json) { + return new Items(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Workflow graph node that produced this document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Key of the configured Document AI document this file corresponds to. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentKey() { + return Json.optional(json, "document_key", Conv.STRING); + } + + /** + * Filename as uploaded by the user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional originalFilename() { + return Json.optional(json, "original_filename", Conv.STRING); + } + + /** + * File size in bytes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + /** + * Short-lived presigned link to the uploaded file. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileUrl() { + return Json.optional(json, "file_url", Conv.STRING); + } + + /** + * Per-document Document AI status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Status::of)); + } + + /** + * Values extracted by Document AI, keyed by the configured field key. Each value is a string, number, or null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extractedData() { + return Json.optional(json, "extracted_data", Conv.OBJECT); + } + + /** + * QR codes and barcodes detected across every processed page. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> detectedCodes() { + return Json.optional(json, "detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson))); + } + + /** + * The configured extraction fields for this document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> fields() { + return Json.optional(json, "fields", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Fields::fromJson))); + } + + /** + * File-forensics metadata extracted from the uploaded document (e.g. is_tampered). null when nothing could be extracted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> documentMetadata() { + return Json.optional(json, "document_metadata", Conv.OBJECT); + } + + /** + * Cross-reference of the extracted document fields against other session data. null when no cross-check was performed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> crossCheckResult() { + return Json.optional(json, "cross_check_result", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Items}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Items from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Workflow graph node that produced this document. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * Key of the configured Document AI document this file corresponds to. + * + * @param documentKey the value + * @return this builder + */ + public Builder documentKey(String documentKey) { + return set("document_key", Conv.STRING, documentKey); + } + + /** + * Filename as uploaded by the user. + * + * @param originalFilename the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder originalFilename(@Nullable String originalFilename) { + return setNullable("original_filename", Conv.STRING, originalFilename); + } + + /** + * File size in bytes. + * + * @param fileSize the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileSize(@Nullable Long fileSize) { + return setNullable("file_size", Conv.LONG, fileSize); + } + + /** + * Short-lived presigned link to the uploaded file. + * + * @param fileUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileUrl(@Nullable String fileUrl) { + return setNullable("file_url", Conv.STRING, fileUrl); + } + + /** + * Per-document Document AI status. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Status::of), status); + } + + /** + * Values extracted by Document AI, keyed by the configured field key. Each value is a string, number, or null. + * + * @param extractedData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder extractedData(@Nullable Map extractedData) { + return setAny("extracted_data", extractedData); + } + + /** + * QR codes and barcodes detected across every processed page. Empty when none are found. A located but undecodable QR code has parsed_payload: null. + * + * @param detectedCodes the value + * @return this builder + */ + public Builder detectedCodes(List detectedCodes) { + return set("detected_codes", Conv.list(Conv.model(DocumentAIDetectedCode::fromJson)), detectedCodes); + } + + /** + * The configured extraction fields for this document. + * + * @param fields the value + * @return this builder + */ + public Builder fields(List fields) { + return set("fields", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Fields::fromJson)), fields); + } + + /** + * File-forensics metadata extracted from the uploaded document (e.g. is_tampered). null when nothing could be extracted. + * + * @param documentMetadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentMetadata(@Nullable Map documentMetadata) { + return setAny("document_metadata", documentMetadata); + } + + /** + * Cross-reference of the extracted document fields against other session data. null when no cross-check was performed. + * + * @param crossCheckResult the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder crossCheckResult(@Nullable Map crossCheckResult) { + return setAny("cross_check_result", crossCheckResult); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Items} + */ + public Items build() { + return new Items(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Per-document Document AI status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW, NOT_FINISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Fields extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("key", "name", "instruction", "type", "required"); + + private Fields(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Fields} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Fields fromJson(JsonNode json) { + return new Fields(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable field key used as the key in extracted_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional key() { + return Json.optional(json, "key", Conv.STRING); + } + + /** + * Human-readable field name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Extraction instruction shown to the model. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional instruction() { + return Json.optional(json, "instruction", Conv.STRING); + } + + /** + * Expected value type of the extracted field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Fields.Type::of)); + } + + /** + * Whether this field is required. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional required() { + return Json.optional(json, "required", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Fields}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Fields from) { + super(from); + } + + /** + * Stable field key used as the key in extracted_data. + * + * @param key the value + * @return this builder + */ + public Builder key(String key) { + return set("key", Conv.STRING, key); + } + + /** + * Human-readable field name. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Extraction instruction shown to the model. + * + * @param instruction the value + * @return this builder + */ + public Builder instruction(String instruction) { + return set("instruction", Conv.STRING, instruction); + } + + /** + * Expected value type of the extracted field. + * + * @param type the value + * @return this builder + */ + public Builder type(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Fields.Type type) { + return set("type", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentAiDocuments.Items.Fields.Type::of), type); + } + + /** + * Whether this field is required. + * + * @param required the value + * @return this builder + */ + public Builder required(boolean required) { + return set("required", Conv.BOOLEAN, required); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Fields} + */ + public Fields build() { + return new Fields(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Expected value type of the extracted field. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "text"}. */ + public static final Type TEXT = new Type("text"); + + /** The value {@code "number"}. */ + public static final Type NUMBER = new Type("number"); + + /** The value {@code "date"}. */ + public static final Type DATE = new Type("date"); + + private static final List KNOWN_VALUES = List.of(TEXT, NUMBER, DATE); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + } + + public static final class QuestionnaireResponses extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "questionnaire_id", "title", "description", "languages", "default_language", "is_active", "is_simple_questionnaire", "questionnaire_group_id", "version", "published_at", "sections", "status"); + + private QuestionnaireResponses(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code QuestionnaireResponses} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static QuestionnaireResponses fromJson(JsonNode json) { + return new QuestionnaireResponses(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this questionnaire step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Unique identifier for the questionnaire + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional questionnaireId() { + return Json.optional(json, "questionnaire_id", Conv.STRING); + } + + /** + * Title of the questionnaire + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * Description of the questionnaire + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Supported languages + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> languages() { + return Json.optional(json, "languages", Conv.list(Conv.STRING)); + } + + /** + * Default language + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultLanguage() { + return Json.optional(json, "default_language", Conv.STRING); + } + + /** + * Whether the questionnaire is active + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Whether the questionnaire is a simple linear form (no branching graph). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSimpleQuestionnaire() { + return Json.optional(json, "is_simple_questionnaire", Conv.BOOLEAN); + } + + /** + * Stable identifier of the questionnaire group across versions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional questionnaireGroupId() { + return Json.optional(json, "questionnaire_group_id", Conv.STRING); + } + + /** + * Version number of the questionnaire that was answered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * Timestamp at which this questionnaire version was published. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publishedAt() { + return Json.optional(json, "published_at", Conv.DATE_TIME); + } + + /** + * The sections field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sections() { + return Json.optional(json, "sections", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections::fromJson))); + } + + /** + * Status of the questionnaire + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link QuestionnaireResponses}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(QuestionnaireResponses from) { + super(from); + } + + /** + * Unique identifier for this questionnaire step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Unique identifier for the questionnaire + * + * @param questionnaireId the value + * @return this builder + */ + public Builder questionnaireId(String questionnaireId) { + return set("questionnaire_id", Conv.STRING, questionnaireId); + } + + /** + * Title of the questionnaire + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * Description of the questionnaire + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Supported languages + * + * @param languages the value + * @return this builder + */ + public Builder languages(List languages) { + return set("languages", Conv.list(Conv.STRING), languages); + } + + /** + * Default language + * + * @param defaultLanguage the value + * @return this builder + */ + public Builder defaultLanguage(String defaultLanguage) { + return set("default_language", Conv.STRING, defaultLanguage); + } + + /** + * Whether the questionnaire is active + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Whether the questionnaire is a simple linear form (no branching graph). + * + * @param isSimpleQuestionnaire the value + * @return this builder + */ + public Builder isSimpleQuestionnaire(boolean isSimpleQuestionnaire) { + return set("is_simple_questionnaire", Conv.BOOLEAN, isSimpleQuestionnaire); + } + + /** + * Stable identifier of the questionnaire group across versions. + * + * @param questionnaireGroupId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder questionnaireGroupId(@Nullable String questionnaireGroupId) { + return setNullable("questionnaire_group_id", Conv.STRING, questionnaireGroupId); + } + + /** + * Version number of the questionnaire that was answered. + * + * @param version the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder version(@Nullable Long version) { + return setNullable("version", Conv.LONG, version); + } + + /** + * Timestamp at which this questionnaire version was published. + * + * @param publishedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder publishedAt(@Nullable OffsetDateTime publishedAt) { + return setNullable("published_at", Conv.DATE_TIME, publishedAt); + } + + /** + * The sections field. + * + * @param sections the value + * @return this builder + */ + public Builder sections(List sections) { + return set("sections", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections::fromJson)), sections); + } + + /** + * Status of the questionnaire + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code QuestionnaireResponses} + */ + public QuestionnaireResponses build() { + return new QuestionnaireResponses(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Sections extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "description", "items"); + + private Sections(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Sections} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Sections fromJson(JsonNode json) { + return new Sections(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Section title + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * Section description + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The items field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> items() { + return Json.optional(json, "items", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Sections}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Sections from) { + super(from); + } + + /** + * Section title + * + * @param title the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder title(@Nullable String title) { + return setNullable("title", Conv.STRING, title); + } + + /** + * Section description + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The items field. + * + * @param items the value + * @return this builder + */ + public Builder items(List items) { + return set("items", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items::fromJson)), items); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Sections} + */ + public Sections build() { + return new Sections(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Items extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "value", "element_type", "is_required", "title", "description", "placeholder", "choices", "max_files", "answer", "required_if", "repeatable_config"); + + private Items(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Items} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Items fromJson(JsonNode json) { + return new Items(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for the item + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * Stable node identifier of this form element within the questionnaire graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional value() { + return Json.optional(json, "value", Conv.STRING); + } + + /** + * Type of the questionnaire element + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String elementType() { + return Json.required(json, "element_type", Conv.STRING); + } + + /** + * Whether the item is required + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isRequired() { + return Json.required(json, "is_required", Conv.BOOLEAN); + } + + /** + * Title of the item + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String title() { + return Json.required(json, "title", Conv.STRING); + } + + /** + * Description of the item + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Placeholder text + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeholder() { + return Json.optional(json, "placeholder", Conv.STRING); + } + + /** + * Choices for dropdown or single choice elements + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> choices() { + return Json.optional(json, "choices", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items.Choices::fromJson))); + } + + /** + * Maximum number of files allowed + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxFiles() { + return Json.optional(json, "max_files", Conv.LONG); + } + + /** + * Answer provided for the item + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional answer() { + return Json.optional(json, "answer", Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items.Answer::fromJson)); + } + + /** + * Conditional-requirement rule, when the element is only required for certain answers. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> requiredIf() { + return Json.optional(json, "required_if", Conv.OBJECT); + } + + /** + * Configuration for repeatable element groups, when applicable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> repeatableConfig() { + return Json.optional(json, "repeatable_config", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Items}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Items from) { + super(from); + } + + /** + * Unique identifier for the item + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Stable node identifier of this form element within the questionnaire graph. + * + * @param value the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder value(@Nullable String value) { + return setNullable("value", Conv.STRING, value); + } + + /** + * Type of the questionnaire element + * + * @param elementType the value + * @return this builder + */ + public Builder elementType(String elementType) { + return set("element_type", Conv.STRING, elementType); + } + + /** + * Whether the item is required + * + * @param isRequired the value + * @return this builder + */ + public Builder isRequired(boolean isRequired) { + return set("is_required", Conv.BOOLEAN, isRequired); + } + + /** + * Title of the item + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * Description of the item + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Placeholder text + * + * @param placeholder the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder placeholder(@Nullable String placeholder) { + return setNullable("placeholder", Conv.STRING, placeholder); + } + + /** + * Choices for dropdown or single choice elements + * + * @param choices the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder choices(@Nullable List choices) { + return setNullable("choices", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items.Choices::fromJson)), choices); + } + + /** + * Maximum number of files allowed + * + * @param maxFiles the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxFiles(@Nullable Long maxFiles) { + return setNullable("max_files", Conv.LONG, maxFiles); + } + + /** + * Answer provided for the item + * + * @param answer the value + * @return this builder + */ + public Builder answer(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items.Answer answer) { + return set("answer", Conv.model(SessionsRetrieveDecisionResponse.QuestionnaireResponses.Sections.Items.Answer::fromJson), answer); + } + + /** + * Conditional-requirement rule, when the element is only required for certain answers. + * + * @param requiredIf the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder requiredIf(@Nullable Map requiredIf) { + return setAny("required_if", requiredIf); + } + + /** + * Configuration for repeatable element groups, when applicable. + * + * @param repeatableConfig the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder repeatableConfig(@Nullable Map repeatableConfig) { + return setAny("repeatable_config", repeatableConfig); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Items} + * @throws IllegalStateException when a required field is missing + */ + public Items build() { + require("uuid", false); + require("value", true); + require("element_type", false); + require("is_required", false); + require("title", false); + return new Items(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Choices extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("label", "value", "requires_text_input"); + + private Choices(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Choices} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Choices fromJson(JsonNode json) { + return new Choices(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The label field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String label() { + return Json.required(json, "label", Conv.STRING); + } + + /** + * The value field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String value() { + return Json.required(json, "value", Conv.STRING); + } + + /** + * Whether this choice requires additional text input + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requiresTextInput() { + return Json.optional(json, "requires_text_input", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Choices}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Choices from) { + super(from); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The value field. + * + * @param value the value + * @return this builder + */ + public Builder value(String value) { + return set("value", Conv.STRING, value); + } + + /** + * Whether this choice requires additional text input + * + * @param requiresTextInput the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder requiresTextInput(@Nullable Boolean requiresTextInput) { + return setNullable("requires_text_input", Conv.BOOLEAN, requiresTextInput); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Choices} + * @throws IllegalStateException when a required field is missing + */ + public Choices build() { + require("label", false); + require("value", false); + return new Choices(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Answer provided for the item */ + public static final class Answer extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("value", "text", "files"); + + private Answer(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Answer} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Answer fromJson(JsonNode json) { + return new Answer(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The value field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional value() { + return Json.optional(json, "value", Conv.STRING); + } + + /** + * The text field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional text() { + return Json.optional(json, "text", Conv.STRING); + } + + /** + * The files field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> files() { + return Json.optional(json, "files", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Answer}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Answer from) { + super(from); + } + + /** + * The value field. + * + * @param value the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder value(@Nullable String value) { + return setNullable("value", Conv.STRING, value); + } + + /** + * The text field. + * + * @param text the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder text(@Nullable String text) { + return setNullable("text", Conv.STRING, text); + } + + /** + * The files field. + * + * @param files the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder files(@Nullable List files) { + return setNullable("files", Conv.list(Conv.STRING), files); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Answer} + */ + public Answer build() { + return new Answer(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + } + + public static final class AmlScreenings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "total_hits", "entity_type", "hits", "score", "screened_data", "is_ongoing_monitoring_enabled", "next_ongoing_monitoring_bill_date", "last_ongoing_screening_at", "last_ongoing_screening_datasets_updated_at", "warnings"); + + private AmlScreenings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AmlScreenings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AmlScreenings fromJson(JsonNode json) { + return new AmlScreenings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this AML step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this AML screening. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Status::of)); + } + + /** + * Total number of matches found + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalHits() { + return Json.optional(json, "total_hits", Conv.LONG); + } + + /** + * Type of entity screened: person or company + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * The hits field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> hits() { + return Json.optional(json, "hits", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits::fromJson))); + } + + /** + * Overall AML screening score โ€” the highest risk score across all hits (float, 0-100). null until computed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * The screened_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedData() { + return Json.optional(json, "screened_data", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.ScreenedData::fromJson)); + } + + /** + * Whether AML ongoing monitoring is enabled for this screening. When true, the entity is re-screened periodically and any new hits update the report. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isOngoingMonitoringEnabled() { + return Json.optional(json, "is_ongoing_monitoring_enabled", Conv.BOOLEAN); + } + + /** + * Date (YYYY-MM-DD) when this ongoing-monitoring subscription will next be billed. Computed as the date of the last ongoing-monitoring billing plus 365 days when is_ongoing_monitoring_enabled = true; otherwise null. This is a billing date, not a screening date - use last_ongoing_screening_at for that. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nextOngoingMonitoringBillDate() { + return Json.optional(json, "next_ongoing_monitoring_bill_date", Conv.DATE); + } + + /** + * When ongoing monitoring last completed a re-screening of this record, whether or not the result changed. null when the record has never been re-screened; it is never back-filled from the enablement or billing date. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastOngoingScreeningAt() { + return Json.optional(json, "last_ongoing_screening_at", Conv.DATE_TIME); + } + + /** + * The most recent AML dataset update date the provider reported at the time of that screening. null when the provider reported no dataset dates; never estimated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastOngoingScreeningDatasetsUpdatedAt() { + return Json.optional(json, "last_ongoing_screening_datasets_updated_at", Conv.DATE_TIME); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AmlScreenings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AmlScreenings from) { + super(from); + } + + /** + * Unique identifier for this AML step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this AML screening. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.AmlScreenings.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Status::of), status); + } + + /** + * Total number of matches found + * + * @param totalHits the value + * @return this builder + */ + public Builder totalHits(long totalHits) { + return set("total_hits", Conv.LONG, totalHits); + } + + /** + * Type of entity screened: person or company + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * The hits field. + * + * @param hits the value + * @return this builder + */ + public Builder hits(List hits) { + return set("hits", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits::fromJson)), hits); + } + + /** + * Overall AML screening score โ€” the highest risk score across all hits (float, 0-100). null until computed. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * The screened_data field. + * + * @param screenedData the value + * @return this builder + */ + public Builder screenedData(SessionsRetrieveDecisionResponse.AmlScreenings.ScreenedData screenedData) { + return set("screened_data", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.ScreenedData::fromJson), screenedData); + } + + /** + * Whether AML ongoing monitoring is enabled for this screening. When true, the entity is re-screened periodically and any new hits update the report. + * + * @param isOngoingMonitoringEnabled the value + * @return this builder + */ + public Builder isOngoingMonitoringEnabled(boolean isOngoingMonitoringEnabled) { + return set("is_ongoing_monitoring_enabled", Conv.BOOLEAN, isOngoingMonitoringEnabled); + } + + /** + * Date (YYYY-MM-DD) when this ongoing-monitoring subscription will next be billed. Computed as the date of the last ongoing-monitoring billing plus 365 days when is_ongoing_monitoring_enabled = true; otherwise null. This is a billing date, not a screening date - use last_ongoing_screening_at for that. + * + * @param nextOngoingMonitoringBillDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nextOngoingMonitoringBillDate(@Nullable LocalDate nextOngoingMonitoringBillDate) { + return setNullable("next_ongoing_monitoring_bill_date", Conv.DATE, nextOngoingMonitoringBillDate); + } + + /** + * When ongoing monitoring last completed a re-screening of this record, whether or not the result changed. null when the record has never been re-screened; it is never back-filled from the enablement or billing date. + * + * @param lastOngoingScreeningAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastOngoingScreeningAt(@Nullable OffsetDateTime lastOngoingScreeningAt) { + return setNullable("last_ongoing_screening_at", Conv.DATE_TIME, lastOngoingScreeningAt); + } + + /** + * The most recent AML dataset update date the provider reported at the time of that screening. null when the provider reported no dataset dates; never estimated. + * + * @param lastOngoingScreeningDatasetsUpdatedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastOngoingScreeningDatasetsUpdatedAt(@Nullable OffsetDateTime lastOngoingScreeningDatasetsUpdatedAt) { + return setNullable("last_ongoing_screening_datasets_updated_at", Conv.DATE_TIME, lastOngoingScreeningDatasetsUpdatedAt); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AmlScreenings} + */ + public AmlScreenings build() { + return new AmlScreenings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this AML screening. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Hits extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "url", "match", "score", "target", "caption", "datasets", "features", "rca_name", "last_seen", "risk_view", "first_seen", "properties", "match_score", "risk_score", "review_status", "score_breakdown", "pep_matches", "linked_entities", "warning_matches", "sanction_matches", "adverse_media_details", "adverse_media_matches", "additional_information"); + + private Hits(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Hits} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Hits fromJson(JsonNode json) { + return new Hits(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier of the match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * Source URL for the match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * Whether this is a confirmed match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional match() { + return Json.optional(json, "match", Conv.BOOLEAN); + } + + /** + * Deprecated weighted match score in the 0-1 range (e.g. 0.73). Use match_score (0-100) instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + * + * @deprecated Deprecated by the API. + */ + @Deprecated + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Whether the matched entity is the direct target of the listing (as opposed to a related party). null when the source does not specify it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional target() { + return Json.optional(json, "target", Conv.BOOLEAN); + } + + /** + * Caption or title of the match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caption() { + return Json.optional(json, "caption", Conv.STRING); + } + + /** + * List of dataset categories where the match was found. Indicates whether the entity appeared in PEP lists (with level), sanctions databases, adverse media, warnings/regulatory enforcement, or other compliance datasets. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> datasets() { + return Json.optional(json, "datasets", Conv.list(Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.Datasets::of))); + } + + /** + * Additional features of the match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.OBJECT); + } + + /** + * RCA name if applicable + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rcaName() { + return Json.optional(json, "rca_name", Conv.STRING); + } + + /** + * Date when match was last seen + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSeen() { + return Json.optional(json, "last_seen", Conv.DATE_TIME); + } + + /** + * The risk_view field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskView() { + return Json.optional(json, "risk_view", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView::fromJson)); + } + + /** + * Date when match was first seen + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSeen() { + return Json.optional(json, "first_seen", Conv.DATE_TIME); + } + + /** + * The properties field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional properties() { + return Json.optional(json, "properties", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.Properties::fromJson)); + } + + /** + * Weighted identity confidence score (0-100) calculated from name similarity, date of birth, and country matching. Used to determine if hit is a False Positive or Possible Match. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchScore() { + return Json.optional(json, "match_score", Conv.DOUBLE); + } + + /** + * Entity risk score (0-100). Used to determine final AML status (Approved/In Review/Declined) based on the highest risk_score among non-False-Positive hits. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskScore() { + return Json.optional(json, "risk_score", Conv.DOUBLE); + } + + /** + * Review status for this hit. Can be 'Unreviewed', 'Confirmed Match', 'False Positive', or 'Inconclusive'. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewStatus() { + return Json.optional(json, "review_status", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ReviewStatus::of)); + } + + /** + * Detailed breakdown of how the match_score was calculated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scoreBreakdown() { + return Json.optional(json, "score_breakdown", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ScoreBreakdown::fromJson)); + } + + /** + * The pep_matches field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> pepMatches() { + return Json.optional(json, "pep_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.PepMatches::fromJson))); + } + + /** + * The linked_entities field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> linkedEntities() { + return Json.optional(json, "linked_entities", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.LinkedEntities::fromJson))); + } + + /** + * List of warning and regulatory enforcement matches. Includes entries from categories: Warning, SIP, Warnings and Regulatory Enforcement, Fitness and Probity, SIE, and Insolvency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warningMatches() { + return Json.optional(json, "warning_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches::fromJson))); + } + + /** + * List of sanction list matches found for this entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sanctionMatches() { + return Json.optional(json, "sanction_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.SanctionMatches::fromJson))); + } + + /** + * The adverse_media_details field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional adverseMediaDetails() { + return Json.optional(json, "adverse_media_details", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.AdverseMediaDetails::fromJson)); + } + + /** + * The adverse_media_matches field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> adverseMediaMatches() { + return Json.optional(json, "adverse_media_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.AdverseMediaMatches::fromJson))); + } + + /** + * The additional_information field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalInformation() { + return Json.optional(json, "additional_information", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Hits}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Hits from) { + super(from); + } + + /** + * Unique identifier of the match + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * Source URL for the match + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Whether this is a confirmed match + * + * @param match the value + * @return this builder + */ + public Builder match(boolean match) { + return set("match", Conv.BOOLEAN, match); + } + + /** + * Deprecated weighted match score in the 0-1 range (e.g. 0.73). Use match_score (0-100) instead. + * + * @param score the value, or {@code null} to send JSON null + * @return this builder + * + * @deprecated Deprecated by the API. + */ + @Deprecated + public Builder score(@Nullable Double score) { + return setNullable("score", Conv.DOUBLE, score); + } + + /** + * Whether the matched entity is the direct target of the listing (as opposed to a related party). null when the source does not specify it. + * + * @param target the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder target(@Nullable Boolean target) { + return setNullable("target", Conv.BOOLEAN, target); + } + + /** + * Caption or title of the match + * + * @param caption the value + * @return this builder + */ + public Builder caption(String caption) { + return set("caption", Conv.STRING, caption); + } + + /** + * List of dataset categories where the match was found. Indicates whether the entity appeared in PEP lists (with level), sanctions databases, adverse media, warnings/regulatory enforcement, or other compliance datasets. + * + * @param datasets the value + * @return this builder + */ + public Builder datasets(List datasets) { + return set("datasets", Conv.list(Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.Datasets::of)), datasets); + } + + /** + * Additional features of the match + * + * @param features the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder features(@Nullable Map features) { + return setAny("features", features); + } + + /** + * RCA name if applicable + * + * @param rcaName the value + * @return this builder + */ + public Builder rcaName(String rcaName) { + return set("rca_name", Conv.STRING, rcaName); + } + + /** + * Date when match was last seen + * + * @param lastSeen the value + * @return this builder + */ + public Builder lastSeen(OffsetDateTime lastSeen) { + return set("last_seen", Conv.DATE_TIME, lastSeen); + } + + /** + * The risk_view field. + * + * @param riskView the value + * @return this builder + */ + public Builder riskView(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView riskView) { + return set("risk_view", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView::fromJson), riskView); + } + + /** + * Date when match was first seen + * + * @param firstSeen the value + * @return this builder + */ + public Builder firstSeen(OffsetDateTime firstSeen) { + return set("first_seen", Conv.DATE_TIME, firstSeen); + } + + /** + * The properties field. + * + * @param properties the value + * @return this builder + */ + public Builder properties(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.Properties properties) { + return set("properties", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.Properties::fromJson), properties); + } + + /** + * Weighted identity confidence score (0-100) calculated from name similarity, date of birth, and country matching. Used to determine if hit is a False Positive or Possible Match. + * + * @param matchScore the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchScore(@Nullable Double matchScore) { + return setNullable("match_score", Conv.DOUBLE, matchScore); + } + + /** + * Entity risk score (0-100). Used to determine final AML status (Approved/In Review/Declined) based on the highest risk_score among non-False-Positive hits. + * + * @param riskScore the value + * @return this builder + */ + public Builder riskScore(double riskScore) { + return set("risk_score", Conv.DOUBLE, riskScore); + } + + /** + * Review status for this hit. Can be 'Unreviewed', 'Confirmed Match', 'False Positive', or 'Inconclusive'. + * + * @param reviewStatus the value + * @return this builder + */ + public Builder reviewStatus(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ReviewStatus reviewStatus) { + return set("review_status", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ReviewStatus::of), reviewStatus); + } + + /** + * Detailed breakdown of how the match_score was calculated. + * + * @param scoreBreakdown the value + * @return this builder + */ + public Builder scoreBreakdown(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ScoreBreakdown scoreBreakdown) { + return set("score_breakdown", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ScoreBreakdown::fromJson), scoreBreakdown); + } + + /** + * The pep_matches field. + * + * @param pepMatches the value + * @return this builder + */ + public Builder pepMatches(List pepMatches) { + return set("pep_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.PepMatches::fromJson)), pepMatches); + } + + /** + * The linked_entities field. + * + * @param linkedEntities the value + * @return this builder + */ + public Builder linkedEntities(List linkedEntities) { + return set("linked_entities", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.LinkedEntities::fromJson)), linkedEntities); + } + + /** + * List of warning and regulatory enforcement matches. Includes entries from categories: Warning, SIP, Warnings and Regulatory Enforcement, Fitness and Probity, SIE, and Insolvency. + * + * @param warningMatches the value + * @return this builder + */ + public Builder warningMatches(List warningMatches) { + return set("warning_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches::fromJson)), warningMatches); + } + + /** + * List of sanction list matches found for this entity. + * + * @param sanctionMatches the value + * @return this builder + */ + public Builder sanctionMatches(List sanctionMatches) { + return set("sanction_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.SanctionMatches::fromJson)), sanctionMatches); + } + + /** + * The adverse_media_details field. + * + * @param adverseMediaDetails the value + * @return this builder + */ + public Builder adverseMediaDetails(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.AdverseMediaDetails adverseMediaDetails) { + return set("adverse_media_details", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.AdverseMediaDetails::fromJson), adverseMediaDetails); + } + + /** + * The adverse_media_matches field. + * + * @param adverseMediaMatches the value + * @return this builder + */ + public Builder adverseMediaMatches(List adverseMediaMatches) { + return set("adverse_media_matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.AdverseMediaMatches::fromJson)), adverseMediaMatches); + } + + /** + * The additional_information field. + * + * @param additionalInformation the value + * @return this builder + */ + public Builder additionalInformation(Map additionalInformation) { + return setAny("additional_information", additionalInformation); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Hits} + */ + public Hits build() { + return new Hits(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Datasets extends StringEnum { + /** The value {@code "PEP"}. */ + public static final Datasets PEP = new Datasets("PEP"); + + /** The value {@code "PEP Level 1"}. */ + public static final Datasets PEP_LEVEL_1 = new Datasets("PEP Level 1"); + + /** The value {@code "PEP Level 2"}. */ + public static final Datasets PEP_LEVEL_2 = new Datasets("PEP Level 2"); + + /** The value {@code "PEP Level 3"}. */ + public static final Datasets PEP_LEVEL_3 = new Datasets("PEP Level 3"); + + /** The value {@code "PEP Level 4"}. */ + public static final Datasets PEP_LEVEL_4 = new Datasets("PEP Level 4"); + + /** The value {@code "Sanctions"}. */ + public static final Datasets SANCTIONS = new Datasets("Sanctions"); + + /** The value {@code "Adverse Media"}. */ + public static final Datasets ADVERSE_MEDIA = new Datasets("Adverse Media"); + + /** The value {@code "Warnings and Regulatory Enforcement"}. */ + public static final Datasets WARNINGS_AND_REGULATORY_ENFORCEMENT = new Datasets("Warnings and Regulatory Enforcement"); + + /** The value {@code "Fitness and Probity"}. */ + public static final Datasets FITNESS_AND_PROBITY = new Datasets("Fitness and Probity"); + + /** The value {@code "SIP"}. */ + public static final Datasets SIP = new Datasets("SIP"); + + /** The value {@code "SIE"}. */ + public static final Datasets SIE = new Datasets("SIE"); + + /** The value {@code "Insolvency"}. */ + public static final Datasets INSOLVENCY = new Datasets("Insolvency"); + + private static final List KNOWN_VALUES = List.of(PEP, PEP_LEVEL_1, PEP_LEVEL_2, PEP_LEVEL_3, PEP_LEVEL_4, SANCTIONS, ADVERSE_MEDIA, WARNINGS_AND_REGULATORY_ENFORCEMENT, FITNESS_AND_PROBITY, SIP, SIE, INSOLVENCY); + + private Datasets(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Datasets of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Datasets::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class RiskView extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("crimes", "countries", "categories", "custom_list"); + + private RiskView(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RiskView} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RiskView fromJson(JsonNode json) { + return new RiskView(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The crimes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional crimes() { + return Json.optional(json, "crimes", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Crimes::fromJson)); + } + + /** + * The countries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countries() { + return Json.optional(json, "countries", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Countries::fromJson)); + } + + /** + * The categories field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional categories() { + return Json.optional(json, "categories", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Categories::fromJson)); + } + + /** + * The custom_list field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> customList() { + return Json.optional(json, "custom_list", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RiskView}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RiskView from) { + super(from); + } + + /** + * The crimes field. + * + * @param crimes the value + * @return this builder + */ + public Builder crimes(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Crimes crimes) { + return set("crimes", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Crimes::fromJson), crimes); + } + + /** + * The countries field. + * + * @param countries the value + * @return this builder + */ + public Builder countries(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Countries countries) { + return set("countries", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Countries::fromJson), countries); + } + + /** + * The categories field. + * + * @param categories the value + * @return this builder + */ + public Builder categories(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Categories categories) { + return set("categories", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.RiskView.Categories::fromJson), categories); + } + + /** + * The custom_list field. + * + * @param customList the value + * @return this builder + */ + public Builder customList(Map customList) { + return setAny("custom_list", customList); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RiskView} + */ + public RiskView build() { + return new RiskView(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Crimes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "weightage", "risk_level", "risk_scores"); + + private Crimes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Crimes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Crimes fromJson(JsonNode json) { + return new Crimes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * The weightage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional weightage() { + return Json.optional(json, "weightage", Conv.LONG); + } + + /** + * The risk_level field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * The risk_scores field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskScores() { + return Json.optional(json, "risk_scores", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Crimes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Crimes from) { + super(from); + } + + /** + * The score field. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * The weightage field. + * + * @param weightage the value + * @return this builder + */ + public Builder weightage(long weightage) { + return set("weightage", Conv.LONG, weightage); + } + + /** + * The risk_level field. + * + * @param riskLevel the value + * @return this builder + */ + public Builder riskLevel(String riskLevel) { + return set("risk_level", Conv.STRING, riskLevel); + } + + /** + * The risk_scores field. + * + * @param riskScores the value + * @return this builder + */ + public Builder riskScores(Map riskScores) { + return setAny("risk_scores", riskScores); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Crimes} + */ + public Crimes build() { + return new Crimes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Countries extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "weightage", "risk_level", "risk_scores"); + + private Countries(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Countries} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Countries fromJson(JsonNode json) { + return new Countries(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * The weightage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional weightage() { + return Json.optional(json, "weightage", Conv.LONG); + } + + /** + * The risk_level field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * The risk_scores field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskScores() { + return Json.optional(json, "risk_scores", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Countries}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Countries from) { + super(from); + } + + /** + * The score field. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * The weightage field. + * + * @param weightage the value + * @return this builder + */ + public Builder weightage(long weightage) { + return set("weightage", Conv.LONG, weightage); + } + + /** + * The risk_level field. + * + * @param riskLevel the value + * @return this builder + */ + public Builder riskLevel(String riskLevel) { + return set("risk_level", Conv.STRING, riskLevel); + } + + /** + * The risk_scores field. + * + * @param riskScores the value + * @return this builder + */ + public Builder riskScores(Map riskScores) { + return setAny("risk_scores", riskScores); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Countries} + */ + public Countries build() { + return new Countries(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Categories extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("score", "weightage", "risk_level", "risk_scores"); + + private Categories(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Categories} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Categories fromJson(JsonNode json) { + return new Categories(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * The weightage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional weightage() { + return Json.optional(json, "weightage", Conv.LONG); + } + + /** + * The risk_level field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * The risk_scores field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskScores() { + return Json.optional(json, "risk_scores", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Categories}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Categories from) { + super(from); + } + + /** + * The score field. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * The weightage field. + * + * @param weightage the value + * @return this builder + */ + public Builder weightage(long weightage) { + return set("weightage", Conv.LONG, weightage); + } + + /** + * The risk_level field. + * + * @param riskLevel the value + * @return this builder + */ + public Builder riskLevel(String riskLevel) { + return set("risk_level", Conv.STRING, riskLevel); + } + + /** + * The risk_scores field. + * + * @param riskScores the value + * @return this builder + */ + public Builder riskScores(Map riskScores) { + return setAny("risk_scores", riskScores); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Categories} + */ + public Categories build() { + return new Categories(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Properties extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "alias", "notes", "title", "gender", "height", "topics", "weight", "address", "country", "website", "eyeColor", "keywords", "lastName", "position", "religion", "birthDate", "education", "ethnicity", "firstName", "hairColor", "weakAlias", "birthPlace", "modifiedAt", "wikidataId", "citizenship", "nationality"); + + private Properties(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Properties} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Properties fromJson(JsonNode json) { + return new Properties(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> name() { + return Json.optional(json, "name", Conv.list(Conv.STRING)); + } + + /** + * The alias field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> alias() { + return Json.optional(json, "alias", Conv.list(Conv.STRING)); + } + + /** + * The notes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> notes() { + return Json.optional(json, "notes", Conv.list(Conv.STRING)); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The gender field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> gender() { + return Json.optional(json, "gender", Conv.list(Conv.STRING)); + } + + /** + * The height field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional height() { + return Json.optional(json, "height", Conv.STRING); + } + + /** + * The topics field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional topics() { + return Json.optional(json, "topics", Conv.STRING); + } + + /** + * The weight field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional weight() { + return Json.optional(json, "weight", Conv.STRING); + } + + /** + * The address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * The country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The website field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * The eyeColor field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional eyeColor() { + return Json.optional(json, "eyeColor", Conv.STRING); + } + + /** + * The keywords field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional keywords() { + return Json.optional(json, "keywords", Conv.STRING); + } + + /** + * The lastName field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> lastName() { + return Json.optional(json, "lastName", Conv.list(Conv.STRING)); + } + + /** + * The position field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional position() { + return Json.optional(json, "position", Conv.STRING); + } + + /** + * The religion field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional religion() { + return Json.optional(json, "religion", Conv.STRING); + } + + /** + * The birthDate field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> birthDate() { + return Json.optional(json, "birthDate", Conv.list(Conv.STRING)); + } + + /** + * The education field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> education() { + return Json.optional(json, "education", Conv.list(Conv.STRING)); + } + + /** + * The ethnicity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ethnicity() { + return Json.optional(json, "ethnicity", Conv.STRING); + } + + /** + * The firstName field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> firstName() { + return Json.optional(json, "firstName", Conv.list(Conv.STRING)); + } + + /** + * The hairColor field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hairColor() { + return Json.optional(json, "hairColor", Conv.STRING); + } + + /** + * The weakAlias field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional weakAlias() { + return Json.optional(json, "weakAlias", Conv.STRING); + } + + /** + * The birthPlace field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> birthPlace() { + return Json.optional(json, "birthPlace", Conv.list(Conv.STRING)); + } + + /** + * The modifiedAt field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional modifiedAt() { + return Json.optional(json, "modifiedAt", Conv.STRING); + } + + /** + * The wikidataId field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional wikidataId() { + return Json.optional(json, "wikidataId", Conv.STRING); + } + + /** + * The citizenship field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional citizenship() { + return Json.optional(json, "citizenship", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Properties}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Properties from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(List name) { + return set("name", Conv.list(Conv.STRING), name); + } + + /** + * The alias field. + * + * @param alias the value + * @return this builder + */ + public Builder alias(List alias) { + return set("alias", Conv.list(Conv.STRING), alias); + } + + /** + * The notes field. + * + * @param notes the value + * @return this builder + */ + public Builder notes(List notes) { + return set("notes", Conv.list(Conv.STRING), notes); + } + + /** + * The title field. + * + * @param title the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder title(@Nullable String title) { + return setNullable("title", Conv.STRING, title); + } + + /** + * The gender field. + * + * @param gender the value + * @return this builder + */ + public Builder gender(List gender) { + return set("gender", Conv.list(Conv.STRING), gender); + } + + /** + * The height field. + * + * @param height the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder height(@Nullable String height) { + return setNullable("height", Conv.STRING, height); + } + + /** + * The topics field. + * + * @param topics the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder topics(@Nullable String topics) { + return setNullable("topics", Conv.STRING, topics); + } + + /** + * The weight field. + * + * @param weight the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder weight(@Nullable String weight) { + return setNullable("weight", Conv.STRING, weight); + } + + /** + * The address field. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * The country field. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * The website field. + * + * @param website the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder website(@Nullable String website) { + return setNullable("website", Conv.STRING, website); + } + + /** + * The eyeColor field. + * + * @param eyeColor the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder eyeColor(@Nullable String eyeColor) { + return setNullable("eyeColor", Conv.STRING, eyeColor); + } + + /** + * The keywords field. + * + * @param keywords the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder keywords(@Nullable String keywords) { + return setNullable("keywords", Conv.STRING, keywords); + } + + /** + * The lastName field. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(List lastName) { + return set("lastName", Conv.list(Conv.STRING), lastName); + } + + /** + * The position field. + * + * @param position the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder position(@Nullable String position) { + return setNullable("position", Conv.STRING, position); + } + + /** + * The religion field. + * + * @param religion the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder religion(@Nullable String religion) { + return setNullable("religion", Conv.STRING, religion); + } + + /** + * The birthDate field. + * + * @param birthDate the value + * @return this builder + */ + public Builder birthDate(List birthDate) { + return set("birthDate", Conv.list(Conv.STRING), birthDate); + } + + /** + * The education field. + * + * @param education the value + * @return this builder + */ + public Builder education(List education) { + return set("education", Conv.list(Conv.STRING), education); + } + + /** + * The ethnicity field. + * + * @param ethnicity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ethnicity(@Nullable String ethnicity) { + return setNullable("ethnicity", Conv.STRING, ethnicity); + } + + /** + * The firstName field. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(List firstName) { + return set("firstName", Conv.list(Conv.STRING), firstName); + } + + /** + * The hairColor field. + * + * @param hairColor the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder hairColor(@Nullable String hairColor) { + return setNullable("hairColor", Conv.STRING, hairColor); + } + + /** + * The weakAlias field. + * + * @param weakAlias the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder weakAlias(@Nullable String weakAlias) { + return setNullable("weakAlias", Conv.STRING, weakAlias); + } + + /** + * The birthPlace field. + * + * @param birthPlace the value + * @return this builder + */ + public Builder birthPlace(List birthPlace) { + return set("birthPlace", Conv.list(Conv.STRING), birthPlace); + } + + /** + * The modifiedAt field. + * + * @param modifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder modifiedAt(@Nullable String modifiedAt) { + return setNullable("modifiedAt", Conv.STRING, modifiedAt); + } + + /** + * The wikidataId field. + * + * @param wikidataId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder wikidataId(@Nullable String wikidataId) { + return setNullable("wikidataId", Conv.STRING, wikidataId); + } + + /** + * The citizenship field. + * + * @param citizenship the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder citizenship(@Nullable String citizenship) { + return setNullable("citizenship", Conv.STRING, citizenship); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Properties} + */ + public Properties build() { + return new Properties(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Review status for this hit. Can be 'Unreviewed', 'Confirmed Match', 'False Positive', or 'Inconclusive'. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReviewStatus extends StringEnum { + /** The value {@code "Unreviewed"}. */ + public static final ReviewStatus UNREVIEWED = new ReviewStatus("Unreviewed"); + + /** The value {@code "Confirmed Match"}. */ + public static final ReviewStatus CONFIRMED_MATCH = new ReviewStatus("Confirmed Match"); + + /** The value {@code "False Positive"}. */ + public static final ReviewStatus FALSE_POSITIVE = new ReviewStatus("False Positive"); + + /** The value {@code "Inconclusive"}. */ + public static final ReviewStatus INCONCLUSIVE = new ReviewStatus("Inconclusive"); + + private static final List KNOWN_VALUES = List.of(UNREVIEWED, CONFIRMED_MATCH, FALSE_POSITIVE, INCONCLUSIVE); + + private ReviewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReviewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReviewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Detailed breakdown of how the match_score was calculated. */ + public static final class ScoreBreakdown extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name_score", "name_weight", "name_weight_normalized", "name_contribution", "dob_score", "dob_weight", "dob_weight_normalized", "dob_contribution", "country_score", "country_weight", "country_weight_normalized", "country_contribution", "document_number_match_type", "document_number_effect", "total_score"); + + private ScoreBreakdown(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScoreBreakdown} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScoreBreakdown fromJson(JsonNode json) { + return new ScoreBreakdown(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Raw name similarity percentage (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameScore() { + return Json.optional(json, "name_score", Conv.LONG); + } + + /** + * Original weight for name from config (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameWeight() { + return Json.optional(json, "name_weight", Conv.LONG); + } + + /** + * Normalized weight for name after re-weighting for missing data (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameWeightNormalized() { + return Json.optional(json, "name_weight_normalized", Conv.DOUBLE); + } + + /** + * Points contributed by name to the total score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameContribution() { + return Json.optional(json, "name_contribution", Conv.DOUBLE); + } + + /** + * DOB match score (-100 to 100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobScore() { + return Json.optional(json, "dob_score", Conv.LONG); + } + + /** + * Original weight for DOB from config (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobWeight() { + return Json.optional(json, "dob_weight", Conv.LONG); + } + + /** + * Normalized weight for DOB after re-weighting for missing data (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobWeightNormalized() { + return Json.optional(json, "dob_weight_normalized", Conv.DOUBLE); + } + + /** + * Points contributed by DOB to the total score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dobContribution() { + return Json.optional(json, "dob_contribution", Conv.DOUBLE); + } + + /** + * Country match score (-100 to 100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryScore() { + return Json.optional(json, "country_score", Conv.LONG); + } + + /** + * Original weight for country from config (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryWeight() { + return Json.optional(json, "country_weight", Conv.LONG); + } + + /** + * Normalized weight for country after re-weighting for missing data (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryWeightNormalized() { + return Json.optional(json, "country_weight_normalized", Conv.DOUBLE); + } + + /** + * Points contributed by country to the total score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryContribution() { + return Json.optional(json, "country_contribution", Conv.DOUBLE); + } + + /** + * Result of document number 'Golden Key' evaluation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumberMatchType() { + return Json.optional(json, "document_number_match_type", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ScoreBreakdown.DocumentNumberMatchType::of)); + } + + /** + * Human-readable description of the document number effect on the score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumberEffect() { + return Json.optional(json, "document_number_effect", Conv.STRING); + } + + /** + * Final weighted match score (0-100). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalScore() { + return Json.optional(json, "total_score", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScoreBreakdown}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScoreBreakdown from) { + super(from); + } + + /** + * Raw name similarity percentage (0-100). + * + * @param nameScore the value + * @return this builder + */ + public Builder nameScore(long nameScore) { + return set("name_score", Conv.LONG, nameScore); + } + + /** + * Original weight for name from config (0-100). + * + * @param nameWeight the value + * @return this builder + */ + public Builder nameWeight(long nameWeight) { + return set("name_weight", Conv.LONG, nameWeight); + } + + /** + * Normalized weight for name after re-weighting for missing data (0-100). + * + * @param nameWeightNormalized the value + * @return this builder + */ + public Builder nameWeightNormalized(double nameWeightNormalized) { + return set("name_weight_normalized", Conv.DOUBLE, nameWeightNormalized); + } + + /** + * Points contributed by name to the total score. + * + * @param nameContribution the value + * @return this builder + */ + public Builder nameContribution(double nameContribution) { + return set("name_contribution", Conv.DOUBLE, nameContribution); + } + + /** + * DOB match score (-100 to 100). + * + * @param dobScore the value + * @return this builder + */ + public Builder dobScore(long dobScore) { + return set("dob_score", Conv.LONG, dobScore); + } + + /** + * Original weight for DOB from config (0-100). + * + * @param dobWeight the value + * @return this builder + */ + public Builder dobWeight(long dobWeight) { + return set("dob_weight", Conv.LONG, dobWeight); + } + + /** + * Normalized weight for DOB after re-weighting for missing data (0-100). + * + * @param dobWeightNormalized the value + * @return this builder + */ + public Builder dobWeightNormalized(double dobWeightNormalized) { + return set("dob_weight_normalized", Conv.DOUBLE, dobWeightNormalized); + } + + /** + * Points contributed by DOB to the total score. + * + * @param dobContribution the value + * @return this builder + */ + public Builder dobContribution(double dobContribution) { + return set("dob_contribution", Conv.DOUBLE, dobContribution); + } + + /** + * Country match score (-100 to 100). + * + * @param countryScore the value + * @return this builder + */ + public Builder countryScore(long countryScore) { + return set("country_score", Conv.LONG, countryScore); + } + + /** + * Original weight for country from config (0-100). + * + * @param countryWeight the value + * @return this builder + */ + public Builder countryWeight(long countryWeight) { + return set("country_weight", Conv.LONG, countryWeight); + } + + /** + * Normalized weight for country after re-weighting for missing data (0-100). + * + * @param countryWeightNormalized the value + * @return this builder + */ + public Builder countryWeightNormalized(double countryWeightNormalized) { + return set("country_weight_normalized", Conv.DOUBLE, countryWeightNormalized); + } + + /** + * Points contributed by country to the total score. + * + * @param countryContribution the value + * @return this builder + */ + public Builder countryContribution(double countryContribution) { + return set("country_contribution", Conv.DOUBLE, countryContribution); + } + + /** + * Result of document number 'Golden Key' evaluation. + * + * @param documentNumberMatchType the value + * @return this builder + */ + public Builder documentNumberMatchType(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ScoreBreakdown.DocumentNumberMatchType documentNumberMatchType) { + return set("document_number_match_type", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.ScoreBreakdown.DocumentNumberMatchType::of), documentNumberMatchType); + } + + /** + * Human-readable description of the document number effect on the score. + * + * @param documentNumberEffect the value + * @return this builder + */ + public Builder documentNumberEffect(String documentNumberEffect) { + return set("document_number_effect", Conv.STRING, documentNumberEffect); + } + + /** + * Final weighted match score (0-100). + * + * @param totalScore the value + * @return this builder + */ + public Builder totalScore(long totalScore) { + return set("total_score", Conv.LONG, totalScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScoreBreakdown} + */ + public ScoreBreakdown build() { + return new ScoreBreakdown(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Result of document number 'Golden Key' evaluation. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentNumberMatchType extends StringEnum { + /** The value {@code "MATCH"}. */ + public static final DocumentNumberMatchType MATCH = new DocumentNumberMatchType("MATCH"); + + /** The value {@code "NEUTRAL"}. */ + public static final DocumentNumberMatchType NEUTRAL = new DocumentNumberMatchType("NEUTRAL"); + + /** The value {@code "HARD_MISMATCH"}. */ + public static final DocumentNumberMatchType HARD_MISMATCH = new DocumentNumberMatchType("HARD_MISMATCH"); + + private static final List KNOWN_VALUES = List.of(MATCH, NEUTRAL, HARD_MISMATCH); + + private DocumentNumberMatchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentNumberMatchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentNumberMatchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class PepMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("aliases", "education", "list_name", "publisher", "source_url", "description", "matched_name", "pep_position", "date_of_birth", "other_sources", "place_of_birth"); + + private PepMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PepMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PepMatches fromJson(JsonNode json) { + return new PepMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The aliases field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aliases() { + return Json.optional(json, "aliases", Conv.list(Conv.STRING)); + } + + /** + * The education field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> education() { + return Json.optional(json, "education", Conv.list(Conv.STRING)); + } + + /** + * The list_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional listName() { + return Json.optional(json, "list_name", Conv.STRING); + } + + /** + * The publisher field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publisher() { + return Json.optional(json, "publisher", Conv.STRING); + } + + /** + * The source_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceUrl() { + return Json.optional(json, "source_url", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The matched_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchedName() { + return Json.optional(json, "matched_name", Conv.STRING); + } + + /** + * The pep_position field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pepPosition() { + return Json.optional(json, "pep_position", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.STRING); + } + + /** + * The other_sources field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> otherSources() { + return Json.optional(json, "other_sources", Conv.list(Conv.STRING)); + } + + /** + * The place_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PepMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PepMatches from) { + super(from); + } + + /** + * The aliases field. + * + * @param aliases the value + * @return this builder + */ + public Builder aliases(List aliases) { + return set("aliases", Conv.list(Conv.STRING), aliases); + } + + /** + * The education field. + * + * @param education the value + * @return this builder + */ + public Builder education(List education) { + return set("education", Conv.list(Conv.STRING), education); + } + + /** + * The list_name field. + * + * @param listName the value + * @return this builder + */ + public Builder listName(String listName) { + return set("list_name", Conv.STRING, listName); + } + + /** + * The publisher field. + * + * @param publisher the value + * @return this builder + */ + public Builder publisher(String publisher) { + return set("publisher", Conv.STRING, publisher); + } + + /** + * The source_url field. + * + * @param sourceUrl the value + * @return this builder + */ + public Builder sourceUrl(String sourceUrl) { + return set("source_url", Conv.STRING, sourceUrl); + } + + /** + * The description field. + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * The matched_name field. + * + * @param matchedName the value + * @return this builder + */ + public Builder matchedName(String matchedName) { + return set("matched_name", Conv.STRING, matchedName); + } + + /** + * The pep_position field. + * + * @param pepPosition the value + * @return this builder + */ + public Builder pepPosition(String pepPosition) { + return set("pep_position", Conv.STRING, pepPosition); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(String dateOfBirth) { + return set("date_of_birth", Conv.STRING, dateOfBirth); + } + + /** + * The other_sources field. + * + * @param otherSources the value + * @return this builder + */ + public Builder otherSources(List otherSources) { + return set("other_sources", Conv.list(Conv.STRING), otherSources); + } + + /** + * The place_of_birth field. + * + * @param placeOfBirth the value + * @return this builder + */ + public Builder placeOfBirth(String placeOfBirth) { + return set("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PepMatches} + */ + public PepMatches build() { + return new PepMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class LinkedEntities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "active", "status", "details", "relation"); + + private LinkedEntities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code LinkedEntities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static LinkedEntities fromJson(JsonNode json) { + return new LinkedEntities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> name() { + return Json.optional(json, "name", Conv.list(Conv.STRING)); + } + + /** + * The active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> active() { + return Json.optional(json, "active", Conv.list(Conv.STRING)); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> status() { + return Json.optional(json, "status", Conv.list(Conv.STRING)); + } + + /** + * The details field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.list(Conv.STRING)); + } + + /** + * The relation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> relation() { + return Json.optional(json, "relation", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link LinkedEntities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(LinkedEntities from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(List name) { + return set("name", Conv.list(Conv.STRING), name); + } + + /** + * The active field. + * + * @param active the value + * @return this builder + */ + public Builder active(List active) { + return set("active", Conv.list(Conv.STRING), active); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(List status) { + return set("status", Conv.list(Conv.STRING), status); + } + + /** + * The details field. + * + * @param details the value + * @return this builder + */ + public Builder details(List details) { + return set("details", Conv.list(Conv.STRING), details); + } + + /** + * The relation field. + * + * @param relation the value + * @return this builder + */ + public Builder relation(List relation) { + return set("relation", Conv.list(Conv.STRING), relation); + } + + /** + * Builds the value. + * + * @return a new immutable {@code LinkedEntities} + */ + public LinkedEntities build() { + return new LinkedEntities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class WarningMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("list_name", "matched_name", "description", "publisher", "source_url", "other_sources", "countries", "created_at", "updated_at", "additional_data"); + + private WarningMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WarningMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WarningMatches fromJson(JsonNode json) { + return new WarningMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Name of the warning list publisher + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional listName() { + return Json.optional(json, "list_name", Conv.STRING); + } + + /** + * Name matched in the warning list + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchedName() { + return Json.optional(json, "matched_name", Conv.STRING); + } + + /** + * Description of the warning entry + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Publisher or source of the warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publisher() { + return Json.optional(json, "publisher", Conv.STRING); + } + + /** + * URL to the source of the warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceUrl() { + return Json.optional(json, "source_url", Conv.STRING); + } + + /** + * Additional source URLs + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> otherSources() { + return Json.optional(json, "other_sources", Conv.list(Conv.STRING)); + } + + /** + * Countries associated with the warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> countries() { + return Json.optional(json, "countries", Conv.list(Conv.STRING)); + } + + /** + * Date the warning entry was created + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.STRING); + } + + /** + * Date the warning entry was last updated + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.STRING); + } + + /** + * Additional data from the warning source. May contain a data object with case_details array. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional additionalData() { + return Json.optional(json, "additional_data", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WarningMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WarningMatches from) { + super(from); + } + + /** + * Name of the warning list publisher + * + * @param listName the value + * @return this builder + */ + public Builder listName(String listName) { + return set("list_name", Conv.STRING, listName); + } + + /** + * Name matched in the warning list + * + * @param matchedName the value + * @return this builder + */ + public Builder matchedName(String matchedName) { + return set("matched_name", Conv.STRING, matchedName); + } + + /** + * Description of the warning entry + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Publisher or source of the warning + * + * @param publisher the value + * @return this builder + */ + public Builder publisher(String publisher) { + return set("publisher", Conv.STRING, publisher); + } + + /** + * URL to the source of the warning + * + * @param sourceUrl the value + * @return this builder + */ + public Builder sourceUrl(String sourceUrl) { + return set("source_url", Conv.STRING, sourceUrl); + } + + /** + * Additional source URLs + * + * @param otherSources the value + * @return this builder + */ + public Builder otherSources(List otherSources) { + return set("other_sources", Conv.list(Conv.STRING), otherSources); + } + + /** + * Countries associated with the warning + * + * @param countries the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countries(@Nullable List countries) { + return setNullable("countries", Conv.list(Conv.STRING), countries); + } + + /** + * Date the warning entry was created + * + * @param createdAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder createdAt(@Nullable String createdAt) { + return setNullable("created_at", Conv.STRING, createdAt); + } + + /** + * Date the warning entry was last updated + * + * @param updatedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder updatedAt(@Nullable String updatedAt) { + return setNullable("updated_at", Conv.STRING, updatedAt); + } + + /** + * Additional data from the warning source. May contain a data object with case_details array. + * + * @param additionalData the value + * @return this builder + */ + public Builder additionalData(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData additionalData) { + return set("additional_data", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData::fromJson), additionalData); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WarningMatches} + */ + public WarningMatches build() { + return new WarningMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Additional data from the warning source. May contain a data object with case_details array. + */ + public static final class AdditionalData extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("data"); + + private AdditionalData(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AdditionalData} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AdditionalData fromJson(JsonNode json) { + return new AdditionalData(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional data() { + return Json.optional(json, "data", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AdditionalData}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AdditionalData from) { + super(from); + } + + /** + * The data field. + * + * @param data the value + * @return this builder + */ + public Builder data(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data data) { + return set("data", Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data::fromJson), data); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AdditionalData} + */ + public AdditionalData build() { + return new AdditionalData(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Data extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case_details"); + + private Data(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Data} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Data fromJson(JsonNode json) { + return new Data(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Details of warning cases associated with this match + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> caseDetails() { + return Json.optional(json, "case_details", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data.CaseDetails::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Data}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Data from) { + super(from); + } + + /** + * Details of warning cases associated with this match + * + * @param caseDetails the value + * @return this builder + */ + public Builder caseDetails(List caseDetails) { + return set("case_details", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data.CaseDetails::fromJson)), caseDetails); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Data} + */ + public Data build() { + return new Data(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class CaseDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("case_type"); + + private CaseDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CaseDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CaseDetails fromJson(JsonNode json) { + return new CaseDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Type of the warning case + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional caseType() { + return Json.optional(json, "case_type", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data.CaseDetails.CaseType::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CaseDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CaseDetails from) { + super(from); + } + + /** + * Type of the warning case + * + * @param caseType the value + * @return this builder + */ + public Builder caseType(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data.CaseDetails.CaseType caseType) { + return set("case_type", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Hits.WarningMatches.AdditionalData.Data.CaseDetails.CaseType::of), caseType); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CaseDetails} + */ + public CaseDetails build() { + return new CaseDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Type of the warning case + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class CaseType extends StringEnum { + /** The value {@code "Accusation"}. */ + public static final CaseType ACCUSATION = new CaseType("Accusation"); + + /** The value {@code "Arrest"}. */ + public static final CaseType ARREST = new CaseType("Arrest"); + + /** The value {@code "Bribery"}. */ + public static final CaseType BRIBERY = new CaseType("Bribery"); + + /** The value {@code "Criminal"}. */ + public static final CaseType CRIMINAL = new CaseType("Criminal"); + + /** The value {@code "Fraud"}. */ + public static final CaseType FRAUD = new CaseType("Fraud"); + + /** The value {@code "Illegal Fundraising"}. */ + public static final CaseType ILLEGAL_FUNDRAISING = new CaseType("Illegal Fundraising"); + + /** The value {@code "Non-conviction Terror"}. */ + public static final CaseType NON_CONVICTION_TERROR = new CaseType("Non-conviction Terror"); + + /** The value {@code "Proclaimed Offender"}. */ + public static final CaseType PROCLAIMED_OFFENDER = new CaseType("Proclaimed Offender"); + + /** The value {@code "Regulatory Enforcement"}. */ + public static final CaseType REGULATORY_ENFORCEMENT = new CaseType("Regulatory Enforcement"); + + /** The value {@code "Terrorism"}. */ + public static final CaseType TERRORISM = new CaseType("Terrorism"); + + /** The value {@code "Terrorism-related"}. */ + public static final CaseType TERRORISM_RELATED = new CaseType("Terrorism-related"); + + /** The value {@code "Terrorism-related listing"}. */ + public static final CaseType TERRORISM_RELATED_LISTING = new CaseType("Terrorism-related listing"); + + private static final List KNOWN_VALUES = List.of(ACCUSATION, ARREST, BRIBERY, CRIMINAL, FRAUD, ILLEGAL_FUNDRAISING, NON_CONVICTION_TERROR, PROCLAIMED_OFFENDER, REGULATORY_ENFORCEMENT, TERRORISM, TERRORISM_RELATED, TERRORISM_RELATED_LISTING); + + private CaseType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CaseType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CaseType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + } + } + + public static final class SanctionMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("list_name", "matched_name", "description", "reason", "source_url", "other_sources", "details", "legal_basis", "listed_on", "sanction_list", "sanction_program", "sanctioning_authority", "updated_on", "additional_data"); + + private SanctionMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SanctionMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SanctionMatches fromJson(JsonNode json) { + return new SanctionMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Name(s) of the sanction list(s) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> listName() { + return Json.optional(json, "list_name", Conv.list(Conv.STRING)); + } + + /** + * Name matched in the sanction list + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchedName() { + return Json.optional(json, "matched_name", Conv.STRING); + } + + /** + * Description of the sanction entry + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Free-text reason why the entity was sanctioned. Joined from the sanction list's reason entries. Examples: 'Executive Order 13224 (Terrorism)', 'Support for actions undermining Ukraine's sovereignty', 'Listed due to national security concerns.' + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reason() { + return Json.optional(json, "reason", Conv.STRING); + } + + /** + * URL to the source of the sanction + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceUrl() { + return Json.optional(json, "source_url", Conv.STRING); + } + + /** + * Additional source URLs + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> otherSources() { + return Json.optional(json, "other_sources", Conv.list(Conv.STRING)); + } + + /** + * Additional details about the sanction + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.list(Conv.STRING)); + } + + /** + * Legal basis for the sanction + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> legalBasis() { + return Json.optional(json, "legal_basis", Conv.list(Conv.STRING)); + } + + /** + * Date(s) when the entity was listed + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> listedOn() { + return Json.optional(json, "listed_on", Conv.list(Conv.STRING)); + } + + /** + * Sanction list identifier(s) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sanctionList() { + return Json.optional(json, "sanction_list", Conv.list(Conv.STRING)); + } + + /** + * Sanction program(s) the entity is listed under + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sanctionProgram() { + return Json.optional(json, "sanction_program", Conv.list(Conv.STRING)); + } + + /** + * Authority/authorities that imposed the sanction + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sanctioningAuthority() { + return Json.optional(json, "sanctioning_authority", Conv.list(Conv.STRING)); + } + + /** + * Date(s) when the sanction entry was last updated + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> updatedOn() { + return Json.optional(json, "updated_on", Conv.list(Conv.STRING)); + } + + /** + * Additional data from the sanction source not captured in the main fields + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SanctionMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SanctionMatches from) { + super(from); + } + + /** + * Name(s) of the sanction list(s) + * + * @param listName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder listName(@Nullable List listName) { + return setNullable("list_name", Conv.list(Conv.STRING), listName); + } + + /** + * Name matched in the sanction list + * + * @param matchedName the value + * @return this builder + */ + public Builder matchedName(String matchedName) { + return set("matched_name", Conv.STRING, matchedName); + } + + /** + * Description of the sanction entry + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Free-text reason why the entity was sanctioned. Joined from the sanction list's reason entries. Examples: 'Executive Order 13224 (Terrorism)', 'Support for actions undermining Ukraine's sovereignty', 'Listed due to national security concerns.' + * + * @param reason the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reason(@Nullable String reason) { + return setNullable("reason", Conv.STRING, reason); + } + + /** + * URL to the source of the sanction + * + * @param sourceUrl the value + * @return this builder + */ + public Builder sourceUrl(String sourceUrl) { + return set("source_url", Conv.STRING, sourceUrl); + } + + /** + * Additional source URLs + * + * @param otherSources the value + * @return this builder + */ + public Builder otherSources(List otherSources) { + return set("other_sources", Conv.list(Conv.STRING), otherSources); + } + + /** + * Additional details about the sanction + * + * @param details the value + * @return this builder + */ + public Builder details(List details) { + return set("details", Conv.list(Conv.STRING), details); + } + + /** + * Legal basis for the sanction + * + * @param legalBasis the value + * @return this builder + */ + public Builder legalBasis(List legalBasis) { + return set("legal_basis", Conv.list(Conv.STRING), legalBasis); + } + + /** + * Date(s) when the entity was listed + * + * @param listedOn the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder listedOn(@Nullable List listedOn) { + return setNullable("listed_on", Conv.list(Conv.STRING), listedOn); + } + + /** + * Sanction list identifier(s) + * + * @param sanctionList the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sanctionList(@Nullable List sanctionList) { + return setNullable("sanction_list", Conv.list(Conv.STRING), sanctionList); + } + + /** + * Sanction program(s) the entity is listed under + * + * @param sanctionProgram the value + * @return this builder + */ + public Builder sanctionProgram(List sanctionProgram) { + return set("sanction_program", Conv.list(Conv.STRING), sanctionProgram); + } + + /** + * Authority/authorities that imposed the sanction + * + * @param sanctioningAuthority the value + * @return this builder + */ + public Builder sanctioningAuthority(List sanctioningAuthority) { + return set("sanctioning_authority", Conv.list(Conv.STRING), sanctioningAuthority); + } + + /** + * Date(s) when the sanction entry was last updated + * + * @param updatedOn the value + * @return this builder + */ + public Builder updatedOn(List updatedOn) { + return set("updated_on", Conv.list(Conv.STRING), updatedOn); + } + + /** + * Additional data from the sanction source not captured in the main fields + * + * @param additionalData the value + * @return this builder + */ + public Builder additionalData(Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SanctionMatches} + */ + public SanctionMatches build() { + return new SanctionMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class AdverseMediaDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("sentiment", "entity_type", "sentiment_score", "adverse_keywords"); + + private AdverseMediaDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AdverseMediaDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AdverseMediaDetails fromJson(JsonNode json) { + return new AdverseMediaDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The sentiment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentiment() { + return Json.optional(json, "sentiment", Conv.STRING); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * The sentiment_score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentimentScore() { + return Json.optional(json, "sentiment_score", Conv.LONG); + } + + /** + * The adverse_keywords field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> adverseKeywords() { + return Json.optional(json, "adverse_keywords", Conv.map(Conv.LONG)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AdverseMediaDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AdverseMediaDetails from) { + super(from); + } + + /** + * The sentiment field. + * + * @param sentiment the value + * @return this builder + */ + public Builder sentiment(String sentiment) { + return set("sentiment", Conv.STRING, sentiment); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * The sentiment_score field. + * + * @param sentimentScore the value + * @return this builder + */ + public Builder sentimentScore(long sentimentScore) { + return set("sentiment_score", Conv.LONG, sentimentScore); + } + + /** + * The adverse_keywords field. + * + * @param adverseKeywords the value + * @return this builder + */ + public Builder adverseKeywords(Map adverseKeywords) { + return set("adverse_keywords", Conv.map(Conv.LONG), adverseKeywords); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AdverseMediaDetails} + */ + public AdverseMediaDetails build() { + return new AdverseMediaDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class AdverseMediaMatches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("country", "summary", "headline", "sentiment", "thumbnail", "source_url", "author_name", "other_sources", "adverse_keywords", "sentiment_score", "publication_date"); + + private AdverseMediaMatches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AdverseMediaMatches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AdverseMediaMatches fromJson(JsonNode json) { + return new AdverseMediaMatches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.STRING); + } + + /** + * The headline field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional headline() { + return Json.optional(json, "headline", Conv.STRING); + } + + /** + * The sentiment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentiment() { + return Json.optional(json, "sentiment", Conv.STRING); + } + + /** + * The thumbnail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional thumbnail() { + return Json.optional(json, "thumbnail", Conv.STRING); + } + + /** + * The source_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sourceUrl() { + return Json.optional(json, "source_url", Conv.STRING); + } + + /** + * The author_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional authorName() { + return Json.optional(json, "author_name", Conv.STRING); + } + + /** + * The other_sources field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> otherSources() { + return Json.optional(json, "other_sources", Conv.list(Conv.STRING)); + } + + /** + * The adverse_keywords field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> adverseKeywords() { + return Json.optional(json, "adverse_keywords", Conv.list(Conv.STRING)); + } + + /** + * The sentiment_score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentimentScore() { + return Json.optional(json, "sentiment_score", Conv.LONG); + } + + /** + * The publication_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional publicationDate() { + return Json.optional(json, "publication_date", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AdverseMediaMatches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AdverseMediaMatches from) { + super(from); + } + + /** + * The country field. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * The summary field. + * + * @param summary the value + * @return this builder + */ + public Builder summary(String summary) { + return set("summary", Conv.STRING, summary); + } + + /** + * The headline field. + * + * @param headline the value + * @return this builder + */ + public Builder headline(String headline) { + return set("headline", Conv.STRING, headline); + } + + /** + * The sentiment field. + * + * @param sentiment the value + * @return this builder + */ + public Builder sentiment(String sentiment) { + return set("sentiment", Conv.STRING, sentiment); + } + + /** + * The thumbnail field. + * + * @param thumbnail the value + * @return this builder + */ + public Builder thumbnail(String thumbnail) { + return set("thumbnail", Conv.STRING, thumbnail); + } + + /** + * The source_url field. + * + * @param sourceUrl the value + * @return this builder + */ + public Builder sourceUrl(String sourceUrl) { + return set("source_url", Conv.STRING, sourceUrl); + } + + /** + * The author_name field. + * + * @param authorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder authorName(@Nullable String authorName) { + return setNullable("author_name", Conv.STRING, authorName); + } + + /** + * The other_sources field. + * + * @param otherSources the value + * @return this builder + */ + public Builder otherSources(List otherSources) { + return set("other_sources", Conv.list(Conv.STRING), otherSources); + } + + /** + * The adverse_keywords field. + * + * @param adverseKeywords the value + * @return this builder + */ + public Builder adverseKeywords(List adverseKeywords) { + return set("adverse_keywords", Conv.list(Conv.STRING), adverseKeywords); + } + + /** + * The sentiment_score field. + * + * @param sentimentScore the value + * @return this builder + */ + public Builder sentimentScore(long sentimentScore) { + return set("sentiment_score", Conv.LONG, sentimentScore); + } + + /** + * The publication_date field. + * + * @param publicationDate the value + * @return this builder + */ + public Builder publicationDate(OffsetDateTime publicationDate) { + return set("publication_date", Conv.DATE_TIME, publicationDate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AdverseMediaMatches} + */ + public AdverseMediaMatches build() { + return new AdverseMediaMatches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class ScreenedData extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "nationality", "date_of_birth", "document_number"); + + private ScreenedData(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScreenedData} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScreenedData fromJson(JsonNode json) { + return new ScreenedData(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * The document_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScreenedData}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScreenedData from) { + super(from); + } + + /** + * The full_name field. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * The nationality field. + * + * @param nationality the value + * @return this builder + */ + public Builder nationality(String nationality) { + return set("nationality", Conv.STRING, nationality); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * The document_number field. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScreenedData} + */ + public ScreenedData build() { + return new ScreenedData(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Within an AML screening this is typically AML, but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Within an AML screening this is typically AML, but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.AmlScreenings.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.AmlScreenings.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Within an AML screening this is typically AML, but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class IpAnalyses extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "status", "device_brand", "device_model", "browser_family", "os_family", "platform", "device_fingerprint", "ip_country", "ip_country_code", "ip_state", "ip_city", "latitude", "longitude", "ip_address", "isp", "organization", "is_vpn_or_tor", "is_data_center", "time_zone", "time_zone_offset", "ip", "id_document", "poa_document", "warnings", "matches"); + + private IpAnalyses(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IpAnalyses} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IpAnalyses fromJson(JsonNode json) { + return new IpAnalyses(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this Device & IP Analysis step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature-level status of this Device & IP Analysis entry. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Status::of)); + } + + /** + * Brand of the device used + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceBrand() { + return Json.optional(json, "device_brand", Conv.STRING); + } + + /** + * Model of the device used + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceModel() { + return Json.optional(json, "device_model", Conv.STRING); + } + + /** + * Browser family used + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserFamily() { + return Json.optional(json, "browser_family", Conv.STRING); + } + + /** + * Operating system family + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osFamily() { + return Json.optional(json, "os_family", Conv.STRING); + } + + /** + * Platform type (mobile, desktop, etc) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platform() { + return Json.optional(json, "platform", Conv.STRING); + } + + /** + * Unique device fingerprint identifier + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceFingerprint() { + return Json.optional(json, "device_fingerprint", Conv.STRING); + } + + /** + * Country detected from IP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountry() { + return Json.optional(json, "ip_country", Conv.STRING); + } + + /** + * Two-letter country code from IP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * State/region detected from IP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipState() { + return Json.optional(json, "ip_state", Conv.STRING); + } + + /** + * City detected from IP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCity() { + return Json.optional(json, "ip_city", Conv.STRING); + } + + /** + * Latitude coordinate of IP location + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Longitude coordinate of IP location + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + /** + * IP address + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Internet Service Provider + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isp() { + return Json.optional(json, "isp", Conv.STRING); + } + + /** + * Organization associated with IP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organization() { + return Json.optional(json, "organization", Conv.STRING); + } + + /** + * Whether IP is from VPN or Tor network + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVpnOrTor() { + return Json.optional(json, "is_vpn_or_tor", Conv.BOOLEAN); + } + + /** + * Whether IP is from a data center + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDataCenter() { + return Json.optional(json, "is_data_center", Conv.BOOLEAN); + } + + /** + * Time zone detected from IP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZone() { + return Json.optional(json, "time_zone", Conv.STRING); + } + + /** + * Time zone offset + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZoneOffset() { + return Json.optional(json, "time_zone_offset", Conv.STRING); + } + + /** + * IP geolocation of this entry plus great-circle distances (km) to the ID document address and the POA document address. Distances are null when either side has no resolvable location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ip() { + return Json.optional(json, "ip", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Ip::fromJson)); + } + + /** + * Location extracted from the ID document address plus distances (km) to the IP geolocation and the POA document address. location is null when no document address could be geocoded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional idDocument() { + return Json.optional(json, "id_document", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.IdDocument::fromJson)); + } + + /** + * Location extracted from the Proof of Address document plus distances (km) to the IP geolocation and the ID document address. location is null when the session has no POA step or the address could not be geocoded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaDocument() { + return Json.optional(json, "poa_document", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.PoaDocument::fromJson)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Warnings::fromJson))); + } + + /** + * Cross-session matches found for this entry's IP address or device identity. Every match is another verification session in your application (source is always session) that shares the same value, always belonging to a different vendor user / vendor_data than the current session, capped at 5 per collector (device_fingerprint sums two independently capped collectors, so up to 10 entries are possible). Every item carries match_source, confidence, match_mode, device_info and location_info; the keys recovery_similarity, tls_ja4_corroborated and recovery_gate_reason are present only when match_source is recovered_high. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> matches() { + return Json.optional(json, "matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Matches::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IpAnalyses}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IpAnalyses from) { + super(from); + } + + /** + * Unique identifier for this Device & IP Analysis step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature-level status of this Device & IP Analysis entry. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.IpAnalyses.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Status::of), status); + } + + /** + * Brand of the device used + * + * @param deviceBrand the value + * @return this builder + */ + public Builder deviceBrand(String deviceBrand) { + return set("device_brand", Conv.STRING, deviceBrand); + } + + /** + * Model of the device used + * + * @param deviceModel the value + * @return this builder + */ + public Builder deviceModel(String deviceModel) { + return set("device_model", Conv.STRING, deviceModel); + } + + /** + * Browser family used + * + * @param browserFamily the value + * @return this builder + */ + public Builder browserFamily(String browserFamily) { + return set("browser_family", Conv.STRING, browserFamily); + } + + /** + * Operating system family + * + * @param osFamily the value + * @return this builder + */ + public Builder osFamily(String osFamily) { + return set("os_family", Conv.STRING, osFamily); + } + + /** + * Platform type (mobile, desktop, etc) + * + * @param platform the value + * @return this builder + */ + public Builder platform(String platform) { + return set("platform", Conv.STRING, platform); + } + + /** + * Unique device fingerprint identifier + * + * @param deviceFingerprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deviceFingerprint(@Nullable String deviceFingerprint) { + return setNullable("device_fingerprint", Conv.STRING, deviceFingerprint); + } + + /** + * Country detected from IP + * + * @param ipCountry the value + * @return this builder + */ + public Builder ipCountry(String ipCountry) { + return set("ip_country", Conv.STRING, ipCountry); + } + + /** + * Two-letter country code from IP + * + * @param ipCountryCode the value + * @return this builder + */ + public Builder ipCountryCode(String ipCountryCode) { + return set("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * State/region detected from IP + * + * @param ipState the value + * @return this builder + */ + public Builder ipState(String ipState) { + return set("ip_state", Conv.STRING, ipState); + } + + /** + * City detected from IP + * + * @param ipCity the value + * @return this builder + */ + public Builder ipCity(String ipCity) { + return set("ip_city", Conv.STRING, ipCity); + } + + /** + * Latitude coordinate of IP location + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * Longitude coordinate of IP location + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * IP address + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Internet Service Provider + * + * @param isp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isp(@Nullable String isp) { + return setNullable("isp", Conv.STRING, isp); + } + + /** + * Organization associated with IP + * + * @param organization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder organization(@Nullable String organization) { + return setNullable("organization", Conv.STRING, organization); + } + + /** + * Whether IP is from VPN or Tor network + * + * @param isVpnOrTor the value + * @return this builder + */ + public Builder isVpnOrTor(boolean isVpnOrTor) { + return set("is_vpn_or_tor", Conv.BOOLEAN, isVpnOrTor); + } + + /** + * Whether IP is from a data center + * + * @param isDataCenter the value + * @return this builder + */ + public Builder isDataCenter(boolean isDataCenter) { + return set("is_data_center", Conv.BOOLEAN, isDataCenter); + } + + /** + * Time zone detected from IP + * + * @param timeZone the value + * @return this builder + */ + public Builder timeZone(String timeZone) { + return set("time_zone", Conv.STRING, timeZone); + } + + /** + * Time zone offset + * + * @param timeZoneOffset the value + * @return this builder + */ + public Builder timeZoneOffset(String timeZoneOffset) { + return set("time_zone_offset", Conv.STRING, timeZoneOffset); + } + + /** + * IP geolocation of this entry plus great-circle distances (km) to the ID document address and the POA document address. Distances are null when either side has no resolvable location. + * + * @param ip the value + * @return this builder + */ + public Builder ip(SessionsRetrieveDecisionResponse.IpAnalyses.Ip ip) { + return set("ip", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Ip::fromJson), ip); + } + + /** + * Location extracted from the ID document address plus distances (km) to the IP geolocation and the POA document address. location is null when no document address could be geocoded. + * + * @param idDocument the value + * @return this builder + */ + public Builder idDocument(SessionsRetrieveDecisionResponse.IpAnalyses.IdDocument idDocument) { + return set("id_document", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.IdDocument::fromJson), idDocument); + } + + /** + * Location extracted from the Proof of Address document plus distances (km) to the IP geolocation and the ID document address. location is null when the session has no POA step or the address could not be geocoded. + * + * @param poaDocument the value + * @return this builder + */ + public Builder poaDocument(SessionsRetrieveDecisionResponse.IpAnalyses.PoaDocument poaDocument) { + return set("poa_document", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.PoaDocument::fromJson), poaDocument); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Warnings::fromJson)), warnings); + } + + /** + * Cross-session matches found for this entry's IP address or device identity. Every match is another verification session in your application (source is always session) that shares the same value, always belonging to a different vendor user / vendor_data than the current session, capped at 5 per collector (device_fingerprint sums two independently capped collectors, so up to 10 entries are possible). Every item carries match_source, confidence, match_mode, device_info and location_info; the keys recovery_similarity, tls_ja4_corroborated and recovery_gate_reason are present only when match_source is recovered_high. + * + * @param matches the value + * @return this builder + */ + public Builder matches(List matches) { + return set("matches", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Matches::fromJson)), matches); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IpAnalyses} + */ + public IpAnalyses build() { + return new IpAnalyses(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status of this Device & IP Analysis entry. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * IP geolocation of this entry plus great-circle distances (km) to the ID document address and the POA document address. Distances are null when either side has no resolvable location. + */ + public static final class Ip extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("location", "distance_from_id_document", "distance_from_poa_document"); + + private Ip(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Ip} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Ip fromJson(JsonNode json) { + return new Ip(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Coordinates, or null when unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional location() { + return Json.optional(json, "location", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Ip.Location::fromJson)); + } + + /** + * The distance_from_id_document field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional distanceFromIdDocument() { + return Json.optional(json, "distance_from_id_document", Conv.DOUBLE); + } + + /** + * The distance_from_poa_document field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional distanceFromPoaDocument() { + return Json.optional(json, "distance_from_poa_document", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Ip}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Ip from) { + super(from); + } + + /** + * Coordinates, or null when unavailable. + * + * @param location the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder location(SessionsRetrieveDecisionResponse.IpAnalyses.Ip.@Nullable Location location) { + return setNullable("location", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Ip.Location::fromJson), location); + } + + /** + * The distance_from_id_document field. + * + * @param distanceFromIdDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder distanceFromIdDocument(@Nullable Double distanceFromIdDocument) { + return setNullable("distance_from_id_document", Conv.DOUBLE, distanceFromIdDocument); + } + + /** + * The distance_from_poa_document field. + * + * @param distanceFromPoaDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder distanceFromPoaDocument(@Nullable Double distanceFromPoaDocument) { + return setNullable("distance_from_poa_document", Conv.DOUBLE, distanceFromPoaDocument); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Ip} + */ + public Ip build() { + return new Ip(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Coordinates, or null when unavailable. */ + public static final class Location extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private Location(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Location} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Location fromJson(JsonNode json) { + return new Location(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Location}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Location from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Location} + */ + public Location build() { + return new Location(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Location extracted from the ID document address plus distances (km) to the IP geolocation and the POA document address. location is null when no document address could be geocoded. + */ + public static final class IdDocument extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("location", "distance_from_ip", "distance_from_poa_document"); + + private IdDocument(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code IdDocument} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static IdDocument fromJson(JsonNode json) { + return new IdDocument(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Coordinates, or null when unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional location() { + return Json.optional(json, "location", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.IdDocument.Location::fromJson)); + } + + /** + * The distance_from_ip field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional distanceFromIp() { + return Json.optional(json, "distance_from_ip", Conv.DOUBLE); + } + + /** + * The distance_from_poa_document field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional distanceFromPoaDocument() { + return Json.optional(json, "distance_from_poa_document", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link IdDocument}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(IdDocument from) { + super(from); + } + + /** + * Coordinates, or null when unavailable. + * + * @param location the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder location(SessionsRetrieveDecisionResponse.IpAnalyses.IdDocument.@Nullable Location location) { + return setNullable("location", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.IdDocument.Location::fromJson), location); + } + + /** + * The distance_from_ip field. + * + * @param distanceFromIp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder distanceFromIp(@Nullable Double distanceFromIp) { + return setNullable("distance_from_ip", Conv.DOUBLE, distanceFromIp); + } + + /** + * The distance_from_poa_document field. + * + * @param distanceFromPoaDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder distanceFromPoaDocument(@Nullable Double distanceFromPoaDocument) { + return setNullable("distance_from_poa_document", Conv.DOUBLE, distanceFromPoaDocument); + } + + /** + * Builds the value. + * + * @return a new immutable {@code IdDocument} + */ + public IdDocument build() { + return new IdDocument(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Coordinates, or null when unavailable. */ + public static final class Location extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private Location(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Location} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Location fromJson(JsonNode json) { + return new Location(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Location}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Location from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Location} + */ + public Location build() { + return new Location(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Location extracted from the Proof of Address document plus distances (km) to the IP geolocation and the ID document address. location is null when the session has no POA step or the address could not be geocoded. + */ + public static final class PoaDocument extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("location", "distance_from_ip", "distance_from_id_document"); + + private PoaDocument(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PoaDocument} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PoaDocument fromJson(JsonNode json) { + return new PoaDocument(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Coordinates, or null when unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional location() { + return Json.optional(json, "location", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.PoaDocument.Location::fromJson)); + } + + /** + * The distance_from_ip field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional distanceFromIp() { + return Json.optional(json, "distance_from_ip", Conv.DOUBLE); + } + + /** + * The distance_from_id_document field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional distanceFromIdDocument() { + return Json.optional(json, "distance_from_id_document", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PoaDocument}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PoaDocument from) { + super(from); + } + + /** + * Coordinates, or null when unavailable. + * + * @param location the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder location(SessionsRetrieveDecisionResponse.IpAnalyses.PoaDocument.@Nullable Location location) { + return setNullable("location", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.PoaDocument.Location::fromJson), location); + } + + /** + * The distance_from_ip field. + * + * @param distanceFromIp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder distanceFromIp(@Nullable Double distanceFromIp) { + return setNullable("distance_from_ip", Conv.DOUBLE, distanceFromIp); + } + + /** + * The distance_from_id_document field. + * + * @param distanceFromIdDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder distanceFromIdDocument(@Nullable Double distanceFromIdDocument) { + return setNullable("distance_from_id_document", Conv.DOUBLE, distanceFromIdDocument); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PoaDocument} + */ + public PoaDocument build() { + return new PoaDocument(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Coordinates, or null when unavailable. */ + public static final class Location extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("latitude", "longitude"); + + private Location(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Location} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Location fromJson(JsonNode json) { + return new Location(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The latitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * The longitude field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Location}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Location from) { + super(from); + } + + /** + * The latitude field. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * The longitude field. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Location} + */ + public Location build() { + return new Location(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.IpAnalyses.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Matches extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_number", "vendor_data", "verification_date", "match_type", "match_source", "matched_value", "status", "is_blocklisted", "api_service", "source", "device_info", "location_info", "confidence", "match_mode", "recovery_similarity", "tls_ja4_corroborated", "recovery_gate_reason"); + + private Matches(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Matches} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Matches fromJson(JsonNode json) { + return new Matches(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Session ID of the matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Sequential number of the matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionNumber() { + return Json.optional(json, "session_number", Conv.LONG); + } + + /** + * vendor_data of the matching session โ€” always different from the current session's vendor user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Creation date of the matching session (YYYY-MM-DDTHH:MM:SSZ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationDate() { + return Json.optional(json, "verification_date", Conv.DATE_TIME); + } + + /** + * Whether the match was on IP address or device fingerprint + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchType() { + return Json.optional(json, "match_type", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchType::of)); + } + + /** + * How this match was reached: ip_address (shared IP address โ€” network co-location, not a device-identity claim), persistent_id (exact stored persistent device identifier), legacy_fp (legacy didit-fp-* device-fingerprint hash), or recovered_high (high-confidence fuzzy fingerprint-recovery hit). Lower-confidence recovery candidates surface as risk warnings only, never in this array. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchSource() { + return Json.optional(json, "match_source", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchSource::of)); + } + + /** + * The value that matched: the shared IP address, the persistent device identifier or legacy fingerprint hash, or โ€” for recovered_high โ€” the UUID of the recovered device. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchedValue() { + return Json.optional(json, "matched_value", Conv.STRING); + } + + /** + * Lifecycle status of the matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Whether the matched value is on a blocklist. Currently always false for device/IP matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isBlocklisted() { + return Json.optional(json, "is_blocklisted", Conv.BOOLEAN); + } + + /** + * Standalone API service of the matching session; null for workflow sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional apiService() { + return Json.optional(json, "api_service", Conv.STRING); + } + + /** + * Always session for device/IP matches โ€” every match is another verification session in your application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.Source::of)); + } + + /** + * Device details observed on the matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceInfo() { + return Json.optional(json, "device_info", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.DeviceInfo::fromJson)); + } + + /** + * Network and geolocation details observed on the matching session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationInfo() { + return Json.optional(json, "location_info", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.LocationInfo::fromJson)); + } + + /** + * Server-side identification confidence, computed as 1 - P(false positive): 1.0 for deterministic matches (persistent_id, or hardware-rooted recovered_high), 0.5 for legacy_fp, 0.0 for ip_address (co-location only), and a corroboration-adjusted value below 1.0 for probabilistic recovered matches (higher when the TLS JA4 fingerprint and IP country independently agree). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confidence() { + return Json.optional(json, "confidence", Conv.DOUBLE); + } + + /** + * Evidence class of the match: deterministic (exact stored or hardware-rooted identifier that cannot collide between physical devices), probabilistic (fuzzy fingerprint evidence), or co_occurrence (shared network only, no device-identity claim). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchMode() { + return Json.optional(json, "match_mode", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchMode::of)); + } + + /** + * Cosine similarity of the fingerprint-recovery match, rounded to 4 decimals. Present only when match_source is recovered_high. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional recoverySimilarity() { + return Json.optional(json, "recovery_similarity", Conv.DOUBLE); + } + + /** + * Whether the TLS JA4 fingerprints of the two observations agree โ€” a server-observed signal the browser cannot spoof. Present only when match_source is recovered_high. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tlsJa4Corroborated() { + return Json.optional(json, "tls_ja4_corroborated", Conv.BOOLEAN); + } + + /** + * Why the recovery match passed the false-positive hard gate: hardware_root_match (a hardware-rooted device identifier matched exactly) or, on configurations that admit probe-only evidence, exact_composite_plus_<n>_families / very_high_similarity_plus_<n>_families. Present only when match_source is recovered_high. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional recoveryGateReason() { + return Json.optional(json, "recovery_gate_reason", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Matches}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Matches from) { + super(from); + } + + /** + * Session ID of the matching session. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Sequential number of the matching session. + * + * @param sessionNumber the value + * @return this builder + */ + public Builder sessionNumber(long sessionNumber) { + return set("session_number", Conv.LONG, sessionNumber); + } + + /** + * vendor_data of the matching session โ€” always different from the current session's vendor user. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Creation date of the matching session (YYYY-MM-DDTHH:MM:SSZ). + * + * @param verificationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationDate(@Nullable OffsetDateTime verificationDate) { + return setNullable("verification_date", Conv.DATE_TIME, verificationDate); + } + + /** + * Whether the match was on IP address or device fingerprint + * + * @param matchType the value + * @return this builder + */ + public Builder matchType(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchType matchType) { + return set("match_type", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchType::of), matchType); + } + + /** + * How this match was reached: ip_address (shared IP address โ€” network co-location, not a device-identity claim), persistent_id (exact stored persistent device identifier), legacy_fp (legacy didit-fp-* device-fingerprint hash), or recovered_high (high-confidence fuzzy fingerprint-recovery hit). Lower-confidence recovery candidates surface as risk warnings only, never in this array. + * + * @param matchSource the value + * @return this builder + */ + public Builder matchSource(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchSource matchSource) { + return set("match_source", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchSource::of), matchSource); + } + + /** + * The value that matched: the shared IP address, the persistent device identifier or legacy fingerprint hash, or โ€” for recovered_high โ€” the UUID of the recovered device. + * + * @param matchedValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchedValue(@Nullable String matchedValue) { + return setNullable("matched_value", Conv.STRING, matchedValue); + } + + /** + * Lifecycle status of the matching session. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Whether the matched value is on a blocklist. Currently always false for device/IP matches. + * + * @param isBlocklisted the value + * @return this builder + */ + public Builder isBlocklisted(boolean isBlocklisted) { + return set("is_blocklisted", Conv.BOOLEAN, isBlocklisted); + } + + /** + * Standalone API service of the matching session; null for workflow sessions. + * + * @param apiService the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder apiService(@Nullable String apiService) { + return setNullable("api_service", Conv.STRING, apiService); + } + + /** + * Always session for device/IP matches โ€” every match is another verification session in your application. + * + * @param source the value + * @return this builder + */ + public Builder source(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.Source source) { + return set("source", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.Source::of), source); + } + + /** + * Device details observed on the matching session. + * + * @param deviceInfo the value + * @return this builder + */ + public Builder deviceInfo(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.DeviceInfo deviceInfo) { + return set("device_info", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.DeviceInfo::fromJson), deviceInfo); + } + + /** + * Network and geolocation details observed on the matching session. + * + * @param locationInfo the value + * @return this builder + */ + public Builder locationInfo(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.LocationInfo locationInfo) { + return set("location_info", Conv.model(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.LocationInfo::fromJson), locationInfo); + } + + /** + * Server-side identification confidence, computed as 1 - P(false positive): 1.0 for deterministic matches (persistent_id, or hardware-rooted recovered_high), 0.5 for legacy_fp, 0.0 for ip_address (co-location only), and a corroboration-adjusted value below 1.0 for probabilistic recovered matches (higher when the TLS JA4 fingerprint and IP country independently agree). + * + * @param confidence the value + * @return this builder + */ + public Builder confidence(double confidence) { + return set("confidence", Conv.DOUBLE, confidence); + } + + /** + * Evidence class of the match: deterministic (exact stored or hardware-rooted identifier that cannot collide between physical devices), probabilistic (fuzzy fingerprint evidence), or co_occurrence (shared network only, no device-identity claim). + * + * @param matchMode the value + * @return this builder + */ + public Builder matchMode(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchMode matchMode) { + return set("match_mode", Conv.enumeration(SessionsRetrieveDecisionResponse.IpAnalyses.Matches.MatchMode::of), matchMode); + } + + /** + * Cosine similarity of the fingerprint-recovery match, rounded to 4 decimals. Present only when match_source is recovered_high. + * + * @param recoverySimilarity the value + * @return this builder + */ + public Builder recoverySimilarity(double recoverySimilarity) { + return set("recovery_similarity", Conv.DOUBLE, recoverySimilarity); + } + + /** + * Whether the TLS JA4 fingerprints of the two observations agree โ€” a server-observed signal the browser cannot spoof. Present only when match_source is recovered_high. + * + * @param tlsJa4Corroborated the value + * @return this builder + */ + public Builder tlsJa4Corroborated(boolean tlsJa4Corroborated) { + return set("tls_ja4_corroborated", Conv.BOOLEAN, tlsJa4Corroborated); + } + + /** + * Why the recovery match passed the false-positive hard gate: hardware_root_match (a hardware-rooted device identifier matched exactly) or, on configurations that admit probe-only evidence, exact_composite_plus_<n>_families / very_high_similarity_plus_<n>_families. Present only when match_source is recovered_high. + * + * @param recoveryGateReason the value + * @return this builder + */ + public Builder recoveryGateReason(String recoveryGateReason) { + return set("recovery_gate_reason", Conv.STRING, recoveryGateReason); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Matches} + */ + public Matches build() { + return new Matches(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the match was on IP address or device fingerprint + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MatchType extends StringEnum { + /** The value {@code "ip_address"}. */ + public static final MatchType IP_ADDRESS = new MatchType("ip_address"); + + /** The value {@code "device_fingerprint"}. */ + public static final MatchType DEVICE_FINGERPRINT = new MatchType("device_fingerprint"); + + private static final List KNOWN_VALUES = List.of(IP_ADDRESS, DEVICE_FINGERPRINT); + + private MatchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MatchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MatchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * How this match was reached: ip_address (shared IP address โ€” network co-location, not a device-identity claim), persistent_id (exact stored persistent device identifier), legacy_fp (legacy didit-fp-* device-fingerprint hash), or recovered_high (high-confidence fuzzy fingerprint-recovery hit). Lower-confidence recovery candidates surface as risk warnings only, never in this array. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MatchSource extends StringEnum { + /** The value {@code "ip_address"}. */ + public static final MatchSource IP_ADDRESS = new MatchSource("ip_address"); + + /** The value {@code "persistent_id"}. */ + public static final MatchSource PERSISTENT_ID = new MatchSource("persistent_id"); + + /** The value {@code "legacy_fp"}. */ + public static final MatchSource LEGACY_FP = new MatchSource("legacy_fp"); + + /** The value {@code "recovered_high"}. */ + public static final MatchSource RECOVERED_HIGH = new MatchSource("recovered_high"); + + private static final List KNOWN_VALUES = List.of(IP_ADDRESS, PERSISTENT_ID, LEGACY_FP, RECOVERED_HIGH); + + private MatchSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MatchSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MatchSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Always session for device/IP matches โ€” every match is another verification session in your application. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "session"}. */ + public static final Source SESSION = new Source("session"); + + private static final List KNOWN_VALUES = List.of(SESSION); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Device details observed on the matching session. */ + public static final class DeviceInfo extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("device_brand", "device_model", "browser_family", "os_family", "platform", "device_fingerprint"); + + private DeviceInfo(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DeviceInfo} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DeviceInfo fromJson(JsonNode json) { + return new DeviceInfo(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The device_brand field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceBrand() { + return Json.optional(json, "device_brand", Conv.STRING); + } + + /** + * The device_model field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceModel() { + return Json.optional(json, "device_model", Conv.STRING); + } + + /** + * The browser_family field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserFamily() { + return Json.optional(json, "browser_family", Conv.STRING); + } + + /** + * The os_family field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osFamily() { + return Json.optional(json, "os_family", Conv.STRING); + } + + /** + * The platform field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platform() { + return Json.optional(json, "platform", Conv.STRING); + } + + /** + * The device_fingerprint field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceFingerprint() { + return Json.optional(json, "device_fingerprint", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DeviceInfo}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DeviceInfo from) { + super(from); + } + + /** + * The device_brand field. + * + * @param deviceBrand the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deviceBrand(@Nullable String deviceBrand) { + return setNullable("device_brand", Conv.STRING, deviceBrand); + } + + /** + * The device_model field. + * + * @param deviceModel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deviceModel(@Nullable String deviceModel) { + return setNullable("device_model", Conv.STRING, deviceModel); + } + + /** + * The browser_family field. + * + * @param browserFamily the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder browserFamily(@Nullable String browserFamily) { + return setNullable("browser_family", Conv.STRING, browserFamily); + } + + /** + * The os_family field. + * + * @param osFamily the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder osFamily(@Nullable String osFamily) { + return setNullable("os_family", Conv.STRING, osFamily); + } + + /** + * The platform field. + * + * @param platform the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder platform(@Nullable String platform) { + return setNullable("platform", Conv.STRING, platform); + } + + /** + * The device_fingerprint field. + * + * @param deviceFingerprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deviceFingerprint(@Nullable String deviceFingerprint) { + return setNullable("device_fingerprint", Conv.STRING, deviceFingerprint); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DeviceInfo} + */ + public DeviceInfo build() { + return new DeviceInfo(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Network and geolocation details observed on the matching session. */ + public static final class LocationInfo extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip_address", "ip_country", "ip_country_code", "ip_state", "ip_city", "is_vpn_or_tor", "is_data_center"); + + private LocationInfo(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code LocationInfo} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static LocationInfo fromJson(JsonNode json) { + return new LocationInfo(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The ip_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * The ip_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountry() { + return Json.optional(json, "ip_country", Conv.STRING); + } + + /** + * The ip_country_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * The ip_state field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipState() { + return Json.optional(json, "ip_state", Conv.STRING); + } + + /** + * The ip_city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCity() { + return Json.optional(json, "ip_city", Conv.STRING); + } + + /** + * The is_vpn_or_tor field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isVpnOrTor() { + return Json.optional(json, "is_vpn_or_tor", Conv.BOOLEAN); + } + + /** + * The is_data_center field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDataCenter() { + return Json.optional(json, "is_data_center", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link LocationInfo}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(LocationInfo from) { + super(from); + } + + /** + * The ip_address field. + * + * @param ipAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipAddress(@Nullable String ipAddress) { + return setNullable("ip_address", Conv.STRING, ipAddress); + } + + /** + * The ip_country field. + * + * @param ipCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCountry(@Nullable String ipCountry) { + return setNullable("ip_country", Conv.STRING, ipCountry); + } + + /** + * The ip_country_code field. + * + * @param ipCountryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCountryCode(@Nullable String ipCountryCode) { + return setNullable("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * The ip_state field. + * + * @param ipState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipState(@Nullable String ipState) { + return setNullable("ip_state", Conv.STRING, ipState); + } + + /** + * The ip_city field. + * + * @param ipCity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ipCity(@Nullable String ipCity) { + return setNullable("ip_city", Conv.STRING, ipCity); + } + + /** + * The is_vpn_or_tor field. + * + * @param isVpnOrTor the value + * @return this builder + */ + public Builder isVpnOrTor(boolean isVpnOrTor) { + return set("is_vpn_or_tor", Conv.BOOLEAN, isVpnOrTor); + } + + /** + * The is_data_center field. + * + * @param isDataCenter the value + * @return this builder + */ + public Builder isDataCenter(boolean isDataCenter) { + return set("is_data_center", Conv.BOOLEAN, isDataCenter); + } + + /** + * Builds the value. + * + * @return a new immutable {@code LocationInfo} + */ + public LocationInfo build() { + return new LocationInfo(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Evidence class of the match: deterministic (exact stored or hardware-rooted identifier that cannot collide between physical devices), probabilistic (fuzzy fingerprint evidence), or co_occurrence (shared network only, no device-identity claim). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MatchMode extends StringEnum { + /** The value {@code "deterministic"}. */ + public static final MatchMode DETERMINISTIC = new MatchMode("deterministic"); + + /** The value {@code "probabilistic"}. */ + public static final MatchMode PROBABILISTIC = new MatchMode("probabilistic"); + + /** The value {@code "co_occurrence"}. */ + public static final MatchMode CO_OCCURRENCE = new MatchMode("co_occurrence"); + + private static final List KNOWN_VALUES = List.of(DETERMINISTIC, PROBABILISTIC, CO_OCCURRENCE); + + private MatchMode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MatchMode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MatchMode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class DatabaseValidations extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "issuing_state", "validation_type", "screened_data", "validations", "errors", "match_type", "status", "warnings"); + + private DatabaseValidations(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DatabaseValidations} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DatabaseValidations fromJson(JsonNode json) { + return new DatabaseValidations(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique identifier for this database validation step in the workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 code of the country whose government/registry sources were queried (e.g. BRA, MEX, ESP, NGA, IDN). Database Validation covers 60+ countries across the Americas, Europe, Africa, the Middle East and Asia-Pacific, plus global multi-country sources โ€” coverage expands regularly, so treat the value as an open set rather than a fixed enum. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * How the result was corroborated: one_by_one (single-service outcome), two_by_two (two or more distinct services independently full-matched the identification number), or not_enabled (persisted when no service produced a usable match). The value is never null. Dedicated biometric 2x2 validation modes are currently available for ECU and PER. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validationType() { + return Json.optional(json, "validation_type", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.ValidationType::of)); + } + + /** + * The input data used for validation. Fields vary by country โ€” see the Database Validation docs (/core-technology/database-validation/overview) for country-specific formats. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedData() { + return Json.optional(json, "screened_data", Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.ScreenedData::fromJson)); + } + + /** + * One entry per registry service that returned a validation payload. Each entry identifies the service (service_id, service_name) and carries the per-field validation comparison, the service outcome_code / outcome_detail when reported, and the normalised registry record in source_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> validations() { + return Json.optional(json, "validations", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Validations::fromJson))); + } + + /** + * Errors returned by registry services while validating, each tagged with the service_id that produced it. This key is omitted entirely when there are no errors. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> errors() { + return Json.optional(json, "errors", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Errors::fromJson))); + } + + /** + * The aggregate match outcome across the queried services. null until the validation has been evaluated. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matchType() { + return Json.optional(json, "match_type", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.MatchType::of)); + } + + /** + * Feature-level status of this database validation. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.Status::of)); + } + + /** + * Warnings related to the database validation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Warnings::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DatabaseValidations}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DatabaseValidations from) { + super(from); + } + + /** + * Unique identifier for this database validation step in the workflow graph. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * ISO 3166-1 alpha-3 code of the country whose government/registry sources were queried (e.g. BRA, MEX, ESP, NGA, IDN). Database Validation covers 60+ countries across the Americas, Europe, Africa, the Middle East and Asia-Pacific, plus global multi-country sources โ€” coverage expands regularly, so treat the value as an open set rather than a fixed enum. + * + * @param issuingState the value + * @return this builder + */ + public Builder issuingState(String issuingState) { + return set("issuing_state", Conv.STRING, issuingState); + } + + /** + * How the result was corroborated: one_by_one (single-service outcome), two_by_two (two or more distinct services independently full-matched the identification number), or not_enabled (persisted when no service produced a usable match). The value is never null. Dedicated biometric 2x2 validation modes are currently available for ECU and PER. + * + * @param validationType the value + * @return this builder + */ + public Builder validationType(SessionsRetrieveDecisionResponse.DatabaseValidations.ValidationType validationType) { + return set("validation_type", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.ValidationType::of), validationType); + } + + /** + * The input data used for validation. Fields vary by country โ€” see the Database Validation docs (/core-technology/database-validation/overview) for country-specific formats. + * + * @param screenedData the value + * @return this builder + */ + public Builder screenedData(SessionsRetrieveDecisionResponse.DatabaseValidations.ScreenedData screenedData) { + return set("screened_data", Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.ScreenedData::fromJson), screenedData); + } + + /** + * One entry per registry service that returned a validation payload. Each entry identifies the service (service_id, service_name) and carries the per-field validation comparison, the service outcome_code / outcome_detail when reported, and the normalised registry record in source_data. + * + * @param validations the value + * @return this builder + */ + public Builder validations(List validations) { + return set("validations", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Validations::fromJson)), validations); + } + + /** + * Errors returned by registry services while validating, each tagged with the service_id that produced it. This key is omitted entirely when there are no errors. + * + * @param errors the value + * @return this builder + */ + public Builder errors(List errors) { + return set("errors", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Errors::fromJson)), errors); + } + + /** + * The aggregate match outcome across the queried services. null until the validation has been evaluated. + * + * @param matchType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder matchType(SessionsRetrieveDecisionResponse.DatabaseValidations.@Nullable MatchType matchType) { + return setNullable("match_type", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.MatchType::of), matchType); + } + + /** + * Feature-level status of this database validation. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.DatabaseValidations.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.Status::of), status); + } + + /** + * Warnings related to the database validation. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List warnings) { + return set("warnings", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Warnings::fromJson)), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DatabaseValidations} + */ + public DatabaseValidations build() { + return new DatabaseValidations(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * How the result was corroborated: one_by_one (single-service outcome), two_by_two (two or more distinct services independently full-matched the identification number), or not_enabled (persisted when no service produced a usable match). The value is never null. Dedicated biometric 2x2 validation modes are currently available for ECU and PER. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ValidationType extends StringEnum { + /** The value {@code "one_by_one"}. */ + public static final ValidationType ONE_BY_ONE = new ValidationType("one_by_one"); + + /** The value {@code "two_by_two"}. */ + public static final ValidationType TWO_BY_TWO = new ValidationType("two_by_two"); + + /** The value {@code "not_enabled"}. */ + public static final ValidationType NOT_ENABLED = new ValidationType("not_enabled"); + + private static final List KNOWN_VALUES = List.of(ONE_BY_ONE, TWO_BY_TWO, NOT_ENABLED); + + private ValidationType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ValidationType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ValidationType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The input data used for validation. Fields vary by country โ€” see the Database Validation docs (/core-technology/database-validation/overview) for country-specific formats. + */ + public static final class ScreenedData extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("last_name", "first_name", "tax_number", "personal_number", "document_number", "date_of_birth", "document_type", "expiration_date"); + + private ScreenedData(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ScreenedData} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ScreenedData fromJson(JsonNode json) { + return new ScreenedData(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Brazil: CPF (11 digits) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * Chile: RUT, DOM: Cรฉdula (11 digits), ECU: Cรฉdula (10 digits), ESP: DNI/NIE, MEX: CURP (18 chars), PER: DNI (8 digits), URY: CI + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * ARG: DNI, BOL: CI, COL: Cรฉdula, GTM: DPI, HND: DNI, PAN: Cรฉdula, PRY: CI, SLV: DUI, VEN: Cรฉdula + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * COL: CC/CE/TI/NIT, ESP: ID/PASSPORT + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.STRING); + } + + /** + * Required for ESP + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ScreenedData}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ScreenedData from) { + super(from); + } + + /** + * The last_name field. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * The first_name field. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * Brazil: CPF (11 digits) + * + * @param taxNumber the value + * @return this builder + */ + public Builder taxNumber(String taxNumber) { + return set("tax_number", Conv.STRING, taxNumber); + } + + /** + * Chile: RUT, DOM: Cรฉdula (11 digits), ECU: Cรฉdula (10 digits), ESP: DNI/NIE, MEX: CURP (18 chars), PER: DNI (8 digits), URY: CI + * + * @param personalNumber the value + * @return this builder + */ + public Builder personalNumber(String personalNumber) { + return set("personal_number", Conv.STRING, personalNumber); + } + + /** + * ARG: DNI, BOL: CI, COL: Cรฉdula, GTM: DPI, HND: DNI, PAN: Cรฉdula, PRY: CI, SLV: DUI, VEN: Cรฉdula + * + * @param documentNumber the value + * @return this builder + */ + public Builder documentNumber(String documentNumber) { + return set("document_number", Conv.STRING, documentNumber); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * COL: CC/CE/TI/NIT, ESP: ID/PASSPORT + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(String documentType) { + return set("document_type", Conv.STRING, documentType); + } + + /** + * Required for ESP + * + * @param expirationDate the value + * @return this builder + */ + public Builder expirationDate(LocalDate expirationDate) { + return set("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ScreenedData} + */ + public ScreenedData build() { + return new ScreenedData(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Validations extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("service_id", "service_name", "validation", "outcome_code", "outcome_detail", "source_data"); + + private Validations(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Validations} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Validations fromJson(JsonNode json) { + return new Validations(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Identifier of the registry service that produced this validation result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serviceId() { + return Json.optional(json, "service_id", Conv.STRING); + } + + /** + * Human-readable name of the registry service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serviceName() { + return Json.optional(json, "service_name", Conv.STRING); + } + + /** + * The results of the field validations. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validation() { + return Json.optional(json, "validation", Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Validations.Validation::fromJson)); + } + + /** + * Machine-readable outcome of the registry lookup (e.g. MATCH, NO_MATCH, PARTIAL_MATCH, INCONCLUSIVE, source-specific codes). Present when the service reports one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomeCode() { + return Json.optional(json, "outcome_code", Conv.STRING); + } + + /** + * Human-readable explanation of outcome_code, when provided by the service. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomeDetail() { + return Json.optional(json, "outcome_detail", Conv.STRING); + } + + /** + * The data returned from the government database. Common fields: identification_number, first_name, last_name, full_name, date_of_birth, gender. Additional fields by country: BRA always includes lgpd_minor, minor_under_18, and minor_under_16 on successful CPF matches; it also includes the upstream HTTP status when CPF data is withheld under LGPD (HTTP 422/451). ECU adds street, formatted_address, nationality, education, marital_status, spouse, mother_name, father_name, profession. PER adds paternal_name, maternal_name, verification_number, verification_letter. ESP adds document_type, expiration_date. VEN/COL add document_type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> sourceData() { + return Json.optional(json, "source_data", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Validations}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Validations from) { + super(from); + } + + /** + * Identifier of the registry service that produced this validation result. + * + * @param serviceId the value + * @return this builder + */ + public Builder serviceId(String serviceId) { + return set("service_id", Conv.STRING, serviceId); + } + + /** + * Human-readable name of the registry service. + * + * @param serviceName the value + * @return this builder + */ + public Builder serviceName(String serviceName) { + return set("service_name", Conv.STRING, serviceName); + } + + /** + * The results of the field validations. + * + * @param validation the value + * @return this builder + */ + public Builder validation(SessionsRetrieveDecisionResponse.DatabaseValidations.Validations.Validation validation) { + return set("validation", Conv.model(SessionsRetrieveDecisionResponse.DatabaseValidations.Validations.Validation::fromJson), validation); + } + + /** + * Machine-readable outcome of the registry lookup (e.g. MATCH, NO_MATCH, PARTIAL_MATCH, INCONCLUSIVE, source-specific codes). Present when the service reports one. + * + * @param outcomeCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder outcomeCode(@Nullable String outcomeCode) { + return setNullable("outcome_code", Conv.STRING, outcomeCode); + } + + /** + * Human-readable explanation of outcome_code, when provided by the service. + * + * @param outcomeDetail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder outcomeDetail(@Nullable String outcomeDetail) { + return setNullable("outcome_detail", Conv.STRING, outcomeDetail); + } + + /** + * The data returned from the government database. Common fields: identification_number, first_name, last_name, full_name, date_of_birth, gender. Additional fields by country: BRA always includes lgpd_minor, minor_under_18, and minor_under_16 on successful CPF matches; it also includes the upstream HTTP status when CPF data is withheld under LGPD (HTTP 422/451). ECU adds street, formatted_address, nationality, education, marital_status, spouse, mother_name, father_name, profession. PER adds paternal_name, maternal_name, verification_number, verification_letter. ESP adds document_type, expiration_date. VEN/COL add document_type. + * + * @param sourceData the value + * @return this builder + */ + public Builder sourceData(Map sourceData) { + return setAny("source_data", sourceData); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Validations} + */ + public Validations build() { + return new Validations(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** The results of the field validations. */ + public static final class Validation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "date_of_birth", "identification_number"); + + private Validation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Validation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Validation fromJson(JsonNode json) { + return new Validation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Match result for full name (e.g., 'full_match', 'partial_match', 'no_match'). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * Match result for date of birth. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.STRING); + } + + /** + * Match result for identification number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional identificationNumber() { + return Json.optional(json, "identification_number", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Validation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Validation from) { + super(from); + } + + /** + * Match result for full name (e.g., 'full_match', 'partial_match', 'no_match'). + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * Match result for date of birth. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(String dateOfBirth) { + return set("date_of_birth", Conv.STRING, dateOfBirth); + } + + /** + * Match result for identification number. + * + * @param identificationNumber the value + * @return this builder + */ + public Builder identificationNumber(String identificationNumber) { + return set("identification_number", Conv.STRING, identificationNumber); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Validation} + */ + public Validation build() { + return new Validation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * The upstream service's error object spread as-is โ€” its keys vary by service (commonly a message/code and any provider-specific details) โ€” plus service_id identifying the service that errored. + */ + public static final class Errors extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("service_id"); + + private Errors(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Errors} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Errors fromJson(JsonNode json) { + return new Errors(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Identifier of the registry service that errored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional serviceId() { + return Json.optional(json, "service_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Errors}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Errors from) { + super(from); + } + + /** + * Identifier of the registry service that errored. + * + * @param serviceId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder serviceId(@Nullable String serviceId) { + return setNullable("service_id", Conv.STRING, serviceId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Errors} + */ + public Errors build() { + return new Errors(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * The aggregate match outcome across the queried services. null until the validation has been evaluated. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MatchType extends StringEnum { + /** The value {@code "no_match"}. */ + public static final MatchType NO_MATCH = new MatchType("no_match"); + + /** The value {@code "partial_match"}. */ + public static final MatchType PARTIAL_MATCH = new MatchType("partial_match"); + + /** The value {@code "full_match"}. */ + public static final MatchType FULL_MATCH = new MatchType("full_match"); + + private static final List KNOWN_VALUES = List.of(NO_MATCH, PARTIAL_MATCH, FULL_MATCH); + + private MatchType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MatchType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MatchType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Feature-level status of this database validation. Independent of the top-level session status โ€” a session can reach its overall decision while an individual feature stays In Review. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Warnings extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "risk", "additional_data", "log_type", "short_description", "long_description", "node_id"); + + private Warnings(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Warnings} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Warnings fromJson(JsonNode json) { + return new Warnings(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.Warnings.Feature::of)); + } + + /** + * The risk field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional risk() { + return Json.optional(json, "risk", Conv.STRING); + } + + /** + * The additional_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> additionalData() { + return Json.optional(json, "additional_data", Conv.OBJECT); + } + + /** + * The log_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional logType() { + return Json.optional(json, "log_type", Conv.STRING); + } + + /** + * The short_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shortDescription() { + return Json.optional(json, "short_description", Conv.STRING); + } + + /** + * The long_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longDescription() { + return Json.optional(json, "long_description", Conv.STRING); + } + + /** + * The workflow graph node ID that generated this warning + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Warnings}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Warnings from) { + super(from); + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsRetrieveDecisionResponse.DatabaseValidations.Warnings.Feature feature) { + return set("feature", Conv.enumeration(SessionsRetrieveDecisionResponse.DatabaseValidations.Warnings.Feature::of), feature); + } + + /** + * The risk field. + * + * @param risk the value + * @return this builder + */ + public Builder risk(String risk) { + return set("risk", Conv.STRING, risk); + } + + /** + * The additional_data field. + * + * @param additionalData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder additionalData(@Nullable Map additionalData) { + return setAny("additional_data", additionalData); + } + + /** + * The log_type field. + * + * @param logType the value + * @return this builder + */ + public Builder logType(String logType) { + return set("log_type", Conv.STRING, logType); + } + + /** + * The short_description field. + * + * @param shortDescription the value + * @return this builder + */ + public Builder shortDescription(String shortDescription) { + return set("short_description", Conv.STRING, shortDescription); + } + + /** + * The long_description field. + * + * @param longDescription the value + * @return this builder + */ + public Builder longDescription(String longDescription) { + return set("long_description", Conv.STRING, longDescription); + } + + /** + * The workflow graph node ID that generated this warning + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Warnings} + */ + public Warnings build() { + return new Warnings(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The feature that generated this warning. The value identifies the feature block the warning belongs to. Each module's warnings array typically uses the value matching its module (e.g. PHONE inside phone_verifications[].warnings), but the enum above is authoritative across all feature warnings on the decision payload. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACEMATCH"}. */ + public static final Feature FACEMATCH = new Feature("FACEMATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "LOCATION"}. */ + public static final Feature LOCATION = new Feature("LOCATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(ID_VERIFICATION, NFC, LIVENESS, FACEMATCH, PROOF_OF_ADDRESS, PHONE, EMAIL, AML, LOCATION, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class Reviews extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user", "new_status", "comment", "created_at"); + + private Reviews(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Reviews} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Reviews fromJson(JsonNode json) { + return new Reviews(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Who performed the review. Usually the console reviewer's identifier (their email), but the value is "API Client" for status updates made with an API key and "Unknown" when no actor could be resolved โ€” so do not parse this field as an email address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional user() { + return Json.optional(json, "user", Conv.STRING); + } + + /** + * The new_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.STRING); + } + + /** + * The comment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Reviews}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Reviews from) { + super(from); + } + + /** + * Who performed the review. Usually the console reviewer's identifier (their email), but the value is "API Client" for status updates made with an API key and "Unknown" when no actor could be resolved โ€” so do not parse this field as an email address. + * + * @param user the value + * @return this builder + */ + public Builder user(String user) { + return set("user", Conv.STRING, user); + } + + /** + * The new_status field. + * + * @param newStatus the value + * @return this builder + */ + public Builder newStatus(String newStatus) { + return set("new_status", Conv.STRING, newStatus); + } + + /** + * The comment field. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Reviews} + */ + public Reviews build() { + return new Reviews(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * One company registry check โ€” the full company-registry payload enriched with ownership structure and warnings. Present only when session_kind = business. + */ + public static final class RegistryChecks extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "node_id", "data_resolved", "company", "ownership_structure", "warnings"); + + private RegistryChecks(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RegistryChecks} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RegistryChecks fromJson(JsonNode json) { + return new RegistryChecks(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature lifecycle status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * The data_resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataResolved() { + return Json.optional(json, "data_resolved", Conv.BOOLEAN); + } + + /** + * Full registry payload for the company (registry record merged with any user-provided or console-edited data). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional company() { + return Json.optional(json, "company", Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks.Company::fromJson)); + } + + /** + * Raw ownership snapshot kept for reviewers; its shape differs by registry source and is not a stable contract. Read company.beneficial_owners and company.ownership instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> ownershipStructure() { + return Json.optional(json, "ownership_structure", Conv.OBJECT); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.OBJECT)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RegistryChecks}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RegistryChecks from) { + super(from); + } + + /** + * Feature lifecycle status. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The node_id field. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * The data_resolved field. + * + * @param dataResolved the value + * @return this builder + */ + public Builder dataResolved(boolean dataResolved) { + return set("data_resolved", Conv.BOOLEAN, dataResolved); + } + + /** + * Full registry payload for the company (registry record merged with any user-provided or console-edited data). + * + * @param company the value + * @return this builder + */ + public Builder company(SessionsRetrieveDecisionResponse.RegistryChecks.Company company) { + return set("company", Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks.Company::fromJson), company); + } + + /** + * Raw ownership snapshot kept for reviewers; its shape differs by registry source and is not a stable contract. Read company.beneficial_owners and company.ownership instead. + * + * @param ownershipStructure the value + * @return this builder + */ + public Builder ownershipStructure(Map ownershipStructure) { + return setAny("ownership_structure", ownershipStructure); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List> warnings) { + return setAny("warnings", warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RegistryChecks} + */ + public RegistryChecks build() { + return new RegistryChecks(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Full registry payload for the company (registry record merged with any user-provided or console-edited data). + */ + public static final class Company extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "node_id", "status", "registry_status", "data_resolved", "company_name", "registration_number", "country_code", "region", "company_type", "incorporation_date", "registered_address", "tax_number", "risk_level", "verification_status", "is_from_registry", "fetch_status", "alternative_names", "nature_of_business", "registered_capital", "registered_capital_amount", "registered_capital_currency", "website", "email", "phone", "legal_entity_identifier", "location_of_registration", "vat_number", "vat_validation_status", "vat_validated_number", "vat_validation_source", "vat_validated_name", "vat_validated_address", "vat_checked_at", "financial_summary", "officers", "beneficial_owners", "addresses", "industries", "accounts", "registry_data", "user_provided_data", "confirmed_by_user_at", "last_console_edit_at", "is_editable", "ownership", "registry_tier", "registry_tier_delivered", "registry_ownership_status"); + + private Company(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Company} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Company fromJson(JsonNode json) { + return new Company(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The registry_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryStatus() { + return Json.optional(json, "registry_status", Conv.STRING); + } + + /** + * The data_resolved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataResolved() { + return Json.optional(json, "data_resolved", Conv.BOOLEAN); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, DE, US). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * ISO 3166-2 subdivision code when applicable (e.g. CA, NY for US states). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The company_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyType() { + return Json.optional(json, "company_type", Conv.STRING); + } + + /** + * The incorporation_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional incorporationDate() { + return Json.optional(json, "incorporation_date", Conv.DATE); + } + + /** + * The registered_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredAddress() { + return Json.optional(json, "registered_address", Conv.STRING); + } + + /** + * The tax_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * The risk_level field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.RiskLevel::of)); + } + + /** + * The verification_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationStatus() { + return Json.optional(json, "verification_status", Conv.STRING); + } + + /** + * The is_from_registry field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFromRegistry() { + return Json.optional(json, "is_from_registry", Conv.BOOLEAN); + } + + /** + * The fetch_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fetchStatus() { + return Json.optional(json, "fetch_status", Conv.STRING); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alternativeNames() { + return Json.optional(json, "alternative_names", Conv.STRING); + } + + /** + * The nature_of_business field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional natureOfBusiness() { + return Json.optional(json, "nature_of_business", Conv.STRING); + } + + /** + * The registered_capital field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapital() { + return Json.optional(json, "registered_capital", Conv.STRING); + } + + /** + * Registered/share capital amount as a decimal string (e.g. "100.00"), parsed from the registry filing. null when not available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalAmount() { + return Json.optional(json, "registered_capital_amount", Conv.STRING); + } + + /** + * ISO 4217 currency code of registered_capital_amount (e.g. "GBP"). null when not available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalCurrency() { + return Json.optional(json, "registered_capital_currency", Conv.STRING); + } + + /** + * The website field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The phone field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * The legal_entity_identifier field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalEntityIdentifier() { + return Json.optional(json, "legal_entity_identifier", Conv.STRING); + } + + /** + * The location_of_registration field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationOfRegistration() { + return Json.optional(json, "location_of_registration", Conv.STRING); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatNumber() { + return Json.optional(json, "vat_number", Conv.STRING); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationStatus() { + return Json.optional(json, "vat_validation_status", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.VatValidationStatus::of)); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedNumber() { + return Json.optional(json, "vat_validated_number", Conv.STRING); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationSource() { + return Json.optional(json, "vat_validation_source", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.VatValidationSource::of)); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedName() { + return Json.optional(json, "vat_validated_name", Conv.STRING); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedAddress() { + return Json.optional(json, "vat_validated_address", Conv.STRING); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatCheckedAt() { + return Json.optional(json, "vat_checked_at", Conv.DATE_TIME); + } + + /** + * The financial_summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> financialSummary() { + return Json.optional(json, "financial_summary", Conv.OBJECT); + } + + /** + * The officers field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> officers() { + return Json.optional(json, "officers", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks.Company.Officers::fromJson))); + } + + /** + * The beneficial_owners field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficialOwners() { + return Json.optional(json, "beneficial_owners", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners::fromJson))); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> addresses() { + return Json.optional(json, "addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson))); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> industries() { + return Json.optional(json, "industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson))); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> accounts() { + return Json.optional(json, "accounts", Conv.OBJECT); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registryData() { + return Json.optional(json, "registry_data", Conv.OBJECT); + } + + /** + * Data confirmed or edited by the end user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> userProvidedData() { + return Json.optional(json, "user_provided_data", Conv.OBJECT); + } + + /** + * The confirmed_by_user_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmedByUserAt() { + return Json.optional(json, "confirmed_by_user_at", Conv.DATE_TIME); + } + + /** + * The last_console_edit_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastConsoleEditAt() { + return Json.optional(json, "last_console_edit_at", Conv.DATE_TIME); + } + + /** + * The is_editable field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownership() { + return Json.optional(json, "ownership", Conv.model(KYBRegistryOwnership::fromJson)); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTier() { + return Json.optional(json, "registry_tier", Conv.STRING); + } + + /** + * The tier the registry delivered and that is billed. Also in ownership.tier_delivered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryTierDelivered() { + return Json.optional(json, "registry_tier_delivered", Conv.STRING); + } + + /** + * not_requested, pending, delivered or unavailable. Also in ownership.status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryOwnershipStatus() { + return Json.optional(json, "registry_ownership_status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Company}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Company from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The node_id field. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The registry_status field. + * + * @param registryStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryStatus(@Nullable String registryStatus) { + return setNullable("registry_status", Conv.STRING, registryStatus); + } + + /** + * The data_resolved field. + * + * @param dataResolved the value + * @return this builder + */ + public Builder dataResolved(boolean dataResolved) { + return set("data_resolved", Conv.BOOLEAN, dataResolved); + } + + /** + * The company_name field. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country of incorporation (ISO 3166-1 alpha-2, e.g. GB, DE, US). + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * ISO 3166-2 subdivision code when applicable (e.g. CA, NY for US states). + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The company_type field. + * + * @param companyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyType(@Nullable String companyType) { + return setNullable("company_type", Conv.STRING, companyType); + } + + /** + * The incorporation_date field. + * + * @param incorporationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder incorporationDate(@Nullable LocalDate incorporationDate) { + return setNullable("incorporation_date", Conv.DATE, incorporationDate); + } + + /** + * The registered_address field. + * + * @param registeredAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredAddress(@Nullable String registeredAddress) { + return setNullable("registered_address", Conv.STRING, registeredAddress); + } + + /** + * The tax_number field. + * + * @param taxNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder taxNumber(@Nullable String taxNumber) { + return setNullable("tax_number", Conv.STRING, taxNumber); + } + + /** + * The risk_level field. + * + * @param riskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskLevel(SessionsRetrieveDecisionResponse.RegistryChecks.Company.@Nullable RiskLevel riskLevel) { + return setNullable("risk_level", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.RiskLevel::of), riskLevel); + } + + /** + * The verification_status field. + * + * @param verificationStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationStatus(@Nullable String verificationStatus) { + return setNullable("verification_status", Conv.STRING, verificationStatus); + } + + /** + * The is_from_registry field. + * + * @param isFromRegistry the value + * @return this builder + */ + public Builder isFromRegistry(boolean isFromRegistry) { + return set("is_from_registry", Conv.BOOLEAN, isFromRegistry); + } + + /** + * The fetch_status field. + * + * @param fetchStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fetchStatus(@Nullable String fetchStatus) { + return setNullable("fetch_status", Conv.STRING, fetchStatus); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @param alternativeNames the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder alternativeNames(@Nullable String alternativeNames) { + return setNullable("alternative_names", Conv.STRING, alternativeNames); + } + + /** + * The nature_of_business field. + * + * @param natureOfBusiness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder natureOfBusiness(@Nullable String natureOfBusiness) { + return setNullable("nature_of_business", Conv.STRING, natureOfBusiness); + } + + /** + * The registered_capital field. + * + * @param registeredCapital the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapital(@Nullable String registeredCapital) { + return setNullable("registered_capital", Conv.STRING, registeredCapital); + } + + /** + * Registered/share capital amount as a decimal string (e.g. "100.00"), parsed from the registry filing. null when not available. + * + * @param registeredCapitalAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalAmount(@Nullable String registeredCapitalAmount) { + return setNullable("registered_capital_amount", Conv.STRING, registeredCapitalAmount); + } + + /** + * ISO 4217 currency code of registered_capital_amount (e.g. "GBP"). null when not available. + * + * @param registeredCapitalCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalCurrency(@Nullable String registeredCapitalCurrency) { + return setNullable("registered_capital_currency", Conv.STRING, registeredCapitalCurrency); + } + + /** + * The website field. + * + * @param website the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder website(@Nullable String website) { + return setNullable("website", Conv.STRING, website); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The phone field. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(@Nullable String phone) { + return setNullable("phone", Conv.STRING, phone); + } + + /** + * The legal_entity_identifier field. + * + * @param legalEntityIdentifier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalEntityIdentifier(@Nullable String legalEntityIdentifier) { + return setNullable("legal_entity_identifier", Conv.STRING, legalEntityIdentifier); + } + + /** + * The location_of_registration field. + * + * @param locationOfRegistration the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder locationOfRegistration(@Nullable String locationOfRegistration) { + return setNullable("location_of_registration", Conv.STRING, locationOfRegistration); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. + * + * @param vatNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatNumber(@Nullable String vatNumber) { + return setNullable("vat_number", Conv.STRING, vatNumber); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @param vatValidationStatus the value + * @return this builder + */ + public Builder vatValidationStatus(SessionsRetrieveDecisionResponse.RegistryChecks.Company.VatValidationStatus vatValidationStatus) { + return set("vat_validation_status", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.VatValidationStatus::of), vatValidationStatus); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @param vatValidatedNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedNumber(@Nullable String vatValidatedNumber) { + return setNullable("vat_validated_number", Conv.STRING, vatValidatedNumber); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @param vatValidationSource the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidationSource(SessionsRetrieveDecisionResponse.RegistryChecks.Company.@Nullable VatValidationSource vatValidationSource) { + return setNullable("vat_validation_source", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.VatValidationSource::of), vatValidationSource); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedName(@Nullable String vatValidatedName) { + return setNullable("vat_validated_name", Conv.STRING, vatValidatedName); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedAddress(@Nullable String vatValidatedAddress) { + return setNullable("vat_validated_address", Conv.STRING, vatValidatedAddress); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @param vatCheckedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatCheckedAt(@Nullable OffsetDateTime vatCheckedAt) { + return setNullable("vat_checked_at", Conv.DATE_TIME, vatCheckedAt); + } + + /** + * The financial_summary field. + * + * @param financialSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder financialSummary(@Nullable Map financialSummary) { + return setAny("financial_summary", financialSummary); + } + + /** + * The officers field. + * + * @param officers the value + * @return this builder + */ + public Builder officers(List officers) { + return set("officers", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks.Company.Officers::fromJson)), officers); + } + + /** + * The beneficial_owners field. + * + * @param beneficialOwners the value + * @return this builder + */ + public Builder beneficialOwners(List beneficialOwners) { + return set("beneficial_owners", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners::fromJson)), beneficialOwners); + } + + /** + * Every address the registry states, one canonical shape. Null when it states none. + * + * @param addresses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addresses(@Nullable List addresses) { + return setNullable("addresses", Conv.list(Conv.model(KYBRegistryAddress::fromJson)), addresses); + } + + /** + * The activities the registry classifies the company under, one canonical shape. Null when it states none. + * + * @param industries the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder industries(@Nullable List industries) { + return setNullable("industries", Conv.list(Conv.model(KYBRegistryIndustry::fromJson)), industries); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @param accounts the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder accounts(@Nullable Map accounts) { + return setAny("accounts", accounts); + } + + /** + * Raw record returned by the registry source, kept for reviewers. Its shape differs by country and source and is not a stable contract: read the canonical fields (addresses, industries, ownership, beneficial_owners[].shareholding) instead. + * + * @param registryData the value + * @return this builder + */ + public Builder registryData(Map registryData) { + return setAny("registry_data", registryData); + } + + /** + * Data confirmed or edited by the end user. + * + * @param userProvidedData the value + * @return this builder + */ + public Builder userProvidedData(Map userProvidedData) { + return setAny("user_provided_data", userProvidedData); + } + + /** + * The confirmed_by_user_at field. + * + * @param confirmedByUserAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder confirmedByUserAt(@Nullable OffsetDateTime confirmedByUserAt) { + return setNullable("confirmed_by_user_at", Conv.DATE_TIME, confirmedByUserAt); + } + + /** + * The last_console_edit_at field. + * + * @param lastConsoleEditAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastConsoleEditAt(@Nullable OffsetDateTime lastConsoleEditAt) { + return setNullable("last_console_edit_at", Conv.DATE_TIME, lastConsoleEditAt); + } + + /** + * The is_editable field. + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * The outcome of the ownership (Shareholders / UBO) tier, in the same shape for every country and registry source. + * + * @param ownership the value + * @return this builder + */ + public Builder ownership(KYBRegistryOwnership ownership) { + return set("ownership", Conv.model(KYBRegistryOwnership::fromJson), ownership); + } + + /** + * The registry tier the workflow ordered: basic, shareholders or ubo. Also in ownership.tier_requested. + * + * @param registryTier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTier(@Nullable String registryTier) { + return setNullable("registry_tier", Conv.STRING, registryTier); + } + + /** + * The tier the registry delivered and that is billed. Also in ownership.tier_delivered. + * + * @param registryTierDelivered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryTierDelivered(@Nullable String registryTierDelivered) { + return setNullable("registry_tier_delivered", Conv.STRING, registryTierDelivered); + } + + /** + * not_requested, pending, delivered or unavailable. Also in ownership.status. + * + * @param registryOwnershipStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryOwnershipStatus(@Nullable String registryOwnershipStatus) { + return setNullable("registry_ownership_status", Conv.STRING, registryOwnershipStatus); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Company} + */ + public Company build() { + return new Company(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RiskLevel extends StringEnum { + /** The value {@code "LOW"}. */ + public static final RiskLevel LOW = new RiskLevel("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final RiskLevel MEDIUM = new RiskLevel("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final RiskLevel HIGH = new RiskLevel("HIGH"); + + private static final List KNOWN_VALUES = List.of(LOW, MEDIUM, HIGH); + + private RiskLevel(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RiskLevel of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RiskLevel::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationStatus extends StringEnum { + /** The value {@code "valid"}. */ + public static final VatValidationStatus VALID = new VatValidationStatus("valid"); + + /** The value {@code "invalid"}. */ + public static final VatValidationStatus INVALID = new VatValidationStatus("invalid"); + + /** The value {@code "format_valid"}. */ + public static final VatValidationStatus FORMAT_VALID = new VatValidationStatus("format_valid"); + + /** The value {@code "invalid_format"}. */ + public static final VatValidationStatus INVALID_FORMAT = new VatValidationStatus("invalid_format"); + + /** The value {@code "could_not_validate"}. */ + public static final VatValidationStatus COULD_NOT_VALIDATE = new VatValidationStatus("could_not_validate"); + + /** The value {@code "not_applicable"}. */ + public static final VatValidationStatus NOT_APPLICABLE = new VatValidationStatus("not_applicable"); + + private static final List KNOWN_VALUES = List.of(VALID, INVALID, FORMAT_VALID, INVALID_FORMAT, COULD_NOT_VALIDATE, NOT_APPLICABLE); + + private VatValidationStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationSource extends StringEnum { + /** The value {@code "eu_vies"}. */ + public static final VatValidationSource EU_VIES = new VatValidationSource("eu_vies"); + + /** The value {@code "pl_vat_white_list"}. */ + public static final VatValidationSource PL_VAT_WHITE_LIST = new VatValidationSource("pl_vat_white_list"); + + /** The value {@code "no_brreg"}. */ + public static final VatValidationSource NO_BRREG = new VatValidationSource("no_brreg"); + + /** The value {@code "ch_uid_register"}. */ + public static final VatValidationSource CH_UID_REGISTER = new VatValidationSource("ch_uid_register"); + + /** The value {@code "br_receita_federal"}. */ + public static final VatValidationSource BR_RECEITA_FEDERAL = new VatValidationSource("br_receita_federal"); + + /** The value {@code "co_rues"}. */ + public static final VatValidationSource CO_RUES = new VatValidationSource("co_rues"); + + /** The value {@code "cr_hacienda"}. */ + public static final VatValidationSource CR_HACIENDA = new VatValidationSource("cr_hacienda"); + + /** The value {@code "ec_sri"}. */ + public static final VatValidationSource EC_SRI = new VatValidationSource("ec_sri"); + + /** The value {@code "py_dnit"}. */ + public static final VatValidationSource PY_DNIT = new VatValidationSource("py_dnit"); + + /** The value {@code "format_rules"}. */ + public static final VatValidationSource FORMAT_RULES = new VatValidationSource("format_rules"); + + private static final List KNOWN_VALUES = List.of(EU_VIES, PL_VAT_WHITE_LIST, NO_BRREG, CH_UID_REGISTER, BR_RECEITA_FEDERAL, CO_RUES, CR_HACIENDA, EC_SRI, PY_DNIT, FORMAT_RULES); + + private VatValidationSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Officers extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "designation", "role", "nationality", "is_active", "kyc_status", "kyc_session_url", "first_name", "last_name", "address", "appointment_date", "termination_date", "date_of_birth", "date_of_birth_year", "date_of_birth_month"); + + private Officers(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Officers} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Officers fromJson(JsonNode json) { + return new Officers(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The designation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * The role field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The kyc_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.Officers.KycStatus::of)); + } + + /** + * The kyc_session_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name when explicitly reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Officer address reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Date the officer was appointed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * Date the appointment ended, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional terminationDate() { + return Json.optional(json, "termination_date", Conv.DATE); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthYear() { + return Json.optional(json, "date_of_birth_year", Conv.LONG); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthMonth() { + return Json.optional(json, "date_of_birth_month", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Officers}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Officers from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The designation field. + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * The role field. + * + * @param role the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder role(@Nullable String role) { + return setNullable("role", Conv.STRING, role); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The kyc_status field. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(SessionsRetrieveDecisionResponse.RegistryChecks.Company.Officers.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.Officers.KycStatus::of), kycStatus); + } + + /** + * The kyc_session_url field. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name when explicitly reported by the registry. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Officer address reported by the registry. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Date the officer was appointed. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * Date the appointment ended, when reported. + * + * @param terminationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder terminationDate(@Nullable LocalDate terminationDate) { + return setNullable("termination_date", Conv.DATE, terminationDate); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @param dateOfBirthYear the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthYear(@Nullable Long dateOfBirthYear) { + return setNullable("date_of_birth_year", Conv.LONG, dateOfBirthYear); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @param dateOfBirthMonth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthMonth(@Nullable Long dateOfBirthMonth) { + return setNullable("date_of_birth_month", Conv.LONG, dateOfBirthMonth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Officers} + */ + public Officers build() { + return new Officers(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class BeneficialOwners extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "first_name", "last_name", "entity_type", "roles", "ownership_min_shares", "ownership_max_shares", "is_active", "kyc_status", "kyc_session_url", "effective_ownership_percent", "company_name", "registration_number", "country_of_birth", "email", "nationality", "designation", "voting_min_shares", "voting_max_shares", "date_of_birth", "appointment_date", "shareholding"); + + private BeneficialOwners(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BeneficialOwners} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BeneficialOwners fromJson(JsonNode json) { + return new BeneficialOwners(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners.EntityType::of)); + } + + /** + * The roles field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> roles() { + return Json.optional(json, "roles", Conv.list(Conv.STRING)); + } + + /** + * Lower bound of the ownership percentage as reported by the registry. Free-form string (e.g. "25.00", "50"); use effective_ownership_percent for a parsed numeric value. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMinShares() { + return Json.optional(json, "ownership_min_shares", Conv.STRING); + } + + /** + * Upper bound of the ownership percentage as reported by the registry. Free-form string; use effective_ownership_percent for a parsed numeric value. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMaxShares() { + return Json.optional(json, "ownership_max_shares", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The kyc_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners.KycStatus::of)); + } + + /** + * The kyc_session_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * The effective_ownership_percent field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveOwnershipPercent() { + return Json.optional(json, "effective_ownership_percent", Conv.DOUBLE); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * The country_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryOfBirth() { + return Json.optional(json, "country_of_birth", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The designation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * The voting_min_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMinShares() { + return Json.optional(json, "voting_min_shares", Conv.STRING); + } + + /** + * The voting_max_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMaxShares() { + return Json.optional(json, "voting_max_shares", Conv.STRING); + } + + /** + * Complete birth date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Appointment date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shareholding() { + return Json.optional(json, "shareholding", Conv.model(KYBRegistryShareholding::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BeneficialOwners}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BeneficialOwners from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners.EntityType entityType) { + return set("entity_type", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners.EntityType::of), entityType); + } + + /** + * The roles field. + * + * @param roles the value + * @return this builder + */ + public Builder roles(List roles) { + return set("roles", Conv.list(Conv.STRING), roles); + } + + /** + * Lower bound of the ownership percentage as reported by the registry. Free-form string (e.g. "25.00", "50"); use effective_ownership_percent for a parsed numeric value. + * + * @param ownershipMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMinShares(@Nullable String ownershipMinShares) { + return setNullable("ownership_min_shares", Conv.STRING, ownershipMinShares); + } + + /** + * Upper bound of the ownership percentage as reported by the registry. Free-form string; use effective_ownership_percent for a parsed numeric value. + * + * @param ownershipMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMaxShares(@Nullable String ownershipMaxShares) { + return setNullable("ownership_max_shares", Conv.STRING, ownershipMaxShares); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The kyc_status field. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.RegistryChecks.Company.BeneficialOwners.KycStatus::of), kycStatus); + } + + /** + * The kyc_session_url field. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * The effective_ownership_percent field. + * + * @param effectiveOwnershipPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveOwnershipPercent(@Nullable Double effectiveOwnershipPercent) { + return setNullable("effective_ownership_percent", Conv.DOUBLE, effectiveOwnershipPercent); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * The country_of_birth field. + * + * @param countryOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryOfBirth(@Nullable String countryOfBirth) { + return setNullable("country_of_birth", Conv.STRING, countryOfBirth); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The designation field. + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * The voting_min_shares field. + * + * @param votingMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMinShares(@Nullable String votingMinShares) { + return setNullable("voting_min_shares", Conv.STRING, votingMinShares); + } + + /** + * The voting_max_shares field. + * + * @param votingMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMaxShares(@Nullable String votingMaxShares) { + return setNullable("voting_max_shares", Conv.STRING, votingMaxShares); + } + + /** + * Complete birth date when reported. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Appointment date when reported. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * What an owner holds, in the same shape for every country and registry source. Null when the registry states no holding. A band (for example a UK PSC's 25-50%) is not a stake: percentage is null and the band stays in ownership_min_shares / ownership_max_shares. + * + * @param shareholding the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder shareholding(@Nullable KYBRegistryShareholding shareholding) { + return setNullable("shareholding", Conv.model(KYBRegistryShareholding::fromJson), shareholding); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BeneficialOwners} + */ + public BeneficialOwners build() { + return new BeneficialOwners(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "Pending"}. */ + public static final KycStatus PENDING = new KycStatus("Pending"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, PENDING); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + } + + /** + * Aggregate check over the company's officers + UBOs. Uses the registry / submitted shape. Present only when session_kind = business. + */ + public static final class KeyPeopleChecks extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "node_id", "registry", "submitted", "ubo_kyc_summary", "warnings"); + + private KeyPeopleChecks(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KeyPeopleChecks} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KeyPeopleChecks fromJson(JsonNode json) { + return new KeyPeopleChecks(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Parties discovered via the registry check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registry() { + return Json.optional(json, "registry", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry::fromJson)); + } + + /** + * Parties submitted by the business admin during the Key People flow (BusinessParty rows where source=USER). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional submitted() { + return Json.optional(json, "submitted", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted::fromJson)); + } + + /** + * Aggregate UBO KYC progress, or null when no UBOs have linked KYC sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uboKycSummary() { + return Json.optional(json, "ubo_kyc_summary", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.UboKycSummary::fromJson)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.OBJECT)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KeyPeopleChecks}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KeyPeopleChecks from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The node_id field. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * Parties discovered via the registry check. + * + * @param registry the value + * @return this builder + */ + public Builder registry(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry registry) { + return set("registry", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry::fromJson), registry); + } + + /** + * Parties submitted by the business admin during the Key People flow (BusinessParty rows where source=USER). + * + * @param submitted the value + * @return this builder + */ + public Builder submitted(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted submitted) { + return set("submitted", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted::fromJson), submitted); + } + + /** + * Aggregate UBO KYC progress, or null when no UBOs have linked KYC sessions. + * + * @param uboKycSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder uboKycSummary(SessionsRetrieveDecisionResponse.KeyPeopleChecks.@Nullable UboKycSummary uboKycSummary) { + return setNullable("ubo_kyc_summary", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.UboKycSummary::fromJson), uboKycSummary); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List> warnings) { + return setAny("warnings", warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KeyPeopleChecks} + */ + public KeyPeopleChecks build() { + return new KeyPeopleChecks(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Parties discovered via the registry check. */ + public static final class Registry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("officers", "beneficial_owners"); + + private Registry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Registry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Registry fromJson(JsonNode json) { + return new Registry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Officers discovered via the registry check, each enriched with the status of any child KYC session and AML screening spawned for them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> officers() { + return Json.optional(json, "officers", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers::fromJson))); + } + + /** + * Beneficial owners discovered via the registry check, each enriched with the status of any child KYC session and AML screening spawned for them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficialOwners() { + return Json.optional(json, "beneficial_owners", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Registry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Registry from) { + super(from); + } + + /** + * Officers discovered via the registry check, each enriched with the status of any child KYC session and AML screening spawned for them. + * + * @param officers the value + * @return this builder + */ + public Builder officers(List officers) { + return set("officers", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers::fromJson)), officers); + } + + /** + * Beneficial owners discovered via the registry check, each enriched with the status of any child KYC session and AML screening spawned for them. + * + * @param beneficialOwners the value + * @return this builder + */ + public Builder beneficialOwners(List beneficialOwners) { + return set("beneficial_owners", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners::fromJson)), beneficialOwners); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Registry} + */ + public Registry build() { + return new Registry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Officers extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "designation", "role", "nationality", "appointment_date", "termination_date", "is_active", "address", "aml_status", "kyc_status", "kyc_session_url", "kyc_session_id", "verification_workflow_type", "verification_workflow_id", "verification_workflow_label", "verification_workflow_features", "didit_internal_id", "kyc_document_type", "kyc_nationality", "kyc_liveness_passed", "kyc_verified_at", "kyc_aml_categories", "kyc_notification_sent_at", "first_name", "last_name", "date_of_birth", "date_of_birth_year", "date_of_birth_month"); + + private Officers(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Officers} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Officers fromJson(JsonNode json) { + return new Officers(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Officer's full name as recorded in the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Free-text designation from the registry (e.g. Director, Company Secretary). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * Normalized officer role. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.Role::of)); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Date the officer was appointed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + /** + * Date the appointment ended, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional terminationDate() { + return Json.optional(json, "termination_date", Conv.DATE); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Officer address reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Status of the AML screening run for this officer. null when no AML screening was run. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlStatus() { + return Json.optional(json, "aml_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.AmlStatus::of)); + } + + /** + * Raw lifecycle status of the child KYC session spawned for this officer. This is the full session status enum (not a reduced Approved/Declined/Pending set). null when no child KYC session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycStatus::of)); + } + + /** + * Shareable URL of the child KYC session. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Session id of the child KYC session. Pass it to this same decision endpoint to fetch the person's full KYC report. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionId() { + return Json.optional(json, "kyc_session_id", Conv.STRING); + } + + /** + * Base workflow type of the child session's workflow (e.g. kyc). null for graph-based workflows or when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowType() { + return Json.optional(json, "verification_workflow_type", Conv.STRING); + } + + /** + * Workflow id used by the child session. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowId() { + return Json.optional(json, "verification_workflow_id", Conv.STRING); + } + + /** + * Human-readable label of the child session's workflow. null when unset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowLabel() { + return Json.optional(json, "verification_workflow_label", Conv.STRING); + } + + /** + * Per-feature progress of the child verification session, e.g. [{"feature": "ID_VERIFICATION", "status": "Approved"}]. null when the child session has no resolvable feature list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> verificationWorkflowFeatures() { + return Json.optional(json, "verification_workflow_features", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.VerificationWorkflowFeatures::fromJson))); + } + + /** + * Stable internal identifier of the verified individual behind the child session โ€” useful for cross-session linking. null when no child session exists or the user has not been resolved yet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Document type presented in the child KYC session (e.g. P, ID, DL). null until the child session has an ID verification result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycDocumentType() { + return Json.optional(json, "kyc_document_type", Conv.STRING); + } + + /** + * Nationality extracted from the document in the child KYC session. null until available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycNationality() { + return Json.optional(json, "kyc_nationality", Conv.STRING); + } + + /** + * Whether the child KYC session's liveness check passed. null when no liveness check has run. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycLivenessPassed() { + return Json.optional(json, "kyc_liveness_passed", Conv.BOOLEAN); + } + + /** + * When the child KYC session reached Approved. null while the child session has any other status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycVerifiedAt() { + return Json.optional(json, "kyc_verified_at", Conv.DATE_TIME); + } + + /** + * Per-category summary derived from the person's AML hits. null when there are no hits. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycAmlCategories() { + return Json.optional(json, "kyc_aml_categories", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories::fromJson)); + } + + /** + * ISO 8601 timestamp of the last verification-invite notification sent for this person's child session. null when none was sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycNotificationSentAt() { + return Json.optional(json, "kyc_notification_sent_at", Conv.STRING); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name when explicitly reported by the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthYear() { + return Json.optional(json, "date_of_birth_year", Conv.LONG); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirthMonth() { + return Json.optional(json, "date_of_birth_month", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Officers}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Officers from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Officer's full name as recorded in the registry. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Free-text designation from the registry (e.g. Director, Company Secretary). + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * Normalized officer role. + * + * @param role the value + * @return this builder + */ + public Builder role(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.Role role) { + return set("role", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.Role::of), role); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * Date the officer was appointed. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * Date the appointment ended, when reported. + * + * @param terminationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder terminationDate(@Nullable LocalDate terminationDate) { + return setNullable("termination_date", Conv.DATE, terminationDate); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Officer address reported by the registry. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Status of the AML screening run for this officer. null when no AML screening was run. + * + * @param amlStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amlStatus(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.@Nullable AmlStatus amlStatus) { + return setNullable("aml_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.AmlStatus::of), amlStatus); + } + + /** + * Raw lifecycle status of the child KYC session spawned for this officer. This is the full session status enum (not a reduced Approved/Declined/Pending set). null when no child KYC session exists. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycStatus::of), kycStatus); + } + + /** + * Shareable URL of the child KYC session. null when no child session exists. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Session id of the child KYC session. Pass it to this same decision endpoint to fetch the person's full KYC report. null when no child session exists. + * + * @param kycSessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionId(@Nullable String kycSessionId) { + return setNullable("kyc_session_id", Conv.STRING, kycSessionId); + } + + /** + * Base workflow type of the child session's workflow (e.g. kyc). null for graph-based workflows or when no child session exists. + * + * @param verificationWorkflowType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowType(@Nullable String verificationWorkflowType) { + return setNullable("verification_workflow_type", Conv.STRING, verificationWorkflowType); + } + + /** + * Workflow id used by the child session. null when no child session exists. + * + * @param verificationWorkflowId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowId(@Nullable String verificationWorkflowId) { + return setNullable("verification_workflow_id", Conv.STRING, verificationWorkflowId); + } + + /** + * Human-readable label of the child session's workflow. null when unset. + * + * @param verificationWorkflowLabel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowLabel(@Nullable String verificationWorkflowLabel) { + return setNullable("verification_workflow_label", Conv.STRING, verificationWorkflowLabel); + } + + /** + * Per-feature progress of the child verification session, e.g. [{"feature": "ID_VERIFICATION", "status": "Approved"}]. null when the child session has no resolvable feature list. + * + * @param verificationWorkflowFeatures the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowFeatures(@Nullable List verificationWorkflowFeatures) { + return setNullable("verification_workflow_features", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.VerificationWorkflowFeatures::fromJson)), verificationWorkflowFeatures); + } + + /** + * Stable internal identifier of the verified individual behind the child session โ€” useful for cross-session linking. null when no child session exists or the user has not been resolved yet. + * + * @param diditInternalId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder diditInternalId(@Nullable String diditInternalId) { + return setNullable("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Document type presented in the child KYC session (e.g. P, ID, DL). null until the child session has an ID verification result. + * + * @param kycDocumentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycDocumentType(@Nullable String kycDocumentType) { + return setNullable("kyc_document_type", Conv.STRING, kycDocumentType); + } + + /** + * Nationality extracted from the document in the child KYC session. null until available. + * + * @param kycNationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycNationality(@Nullable String kycNationality) { + return setNullable("kyc_nationality", Conv.STRING, kycNationality); + } + + /** + * Whether the child KYC session's liveness check passed. null when no liveness check has run. + * + * @param kycLivenessPassed the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycLivenessPassed(@Nullable Boolean kycLivenessPassed) { + return setNullable("kyc_liveness_passed", Conv.BOOLEAN, kycLivenessPassed); + } + + /** + * When the child KYC session reached Approved. null while the child session has any other status. + * + * @param kycVerifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycVerifiedAt(@Nullable OffsetDateTime kycVerifiedAt) { + return setNullable("kyc_verified_at", Conv.DATE_TIME, kycVerifiedAt); + } + + /** + * Per-category summary derived from the person's AML hits. null when there are no hits. + * + * @param kycAmlCategories the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycAmlCategories(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.@Nullable KycAmlCategories kycAmlCategories) { + return setNullable("kyc_aml_categories", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories::fromJson), kycAmlCategories); + } + + /** + * ISO 8601 timestamp of the last verification-invite notification sent for this person's child session. null when none was sent. + * + * @param kycNotificationSentAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycNotificationSentAt(@Nullable String kycNotificationSentAt) { + return setNullable("kyc_notification_sent_at", Conv.STRING, kycNotificationSentAt); + } + + /** + * Given name when explicitly reported by the registry; not inferred from the full name. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name when explicitly reported by the registry. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Complete registry-reported birth date. Null when only a birth year or month is known. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Registry-reported birth year, including when the full date is unavailable. + * + * @param dateOfBirthYear the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthYear(@Nullable Long dateOfBirthYear) { + return setNullable("date_of_birth_year", Conv.LONG, dateOfBirthYear); + } + + /** + * Registry-reported birth month. Null when only the year is known. + * + * @param dateOfBirthMonth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirthMonth(@Nullable Long dateOfBirthMonth) { + return setNullable("date_of_birth_month", Conv.LONG, dateOfBirthMonth); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Officers} + */ + public Officers build() { + return new Officers(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Normalized officer role. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "director"}. */ + public static final Role DIRECTOR = new Role("director"); + + /** The value {@code "non_executive_director"}. */ + public static final Role NON_EXECUTIVE_DIRECTOR = new Role("non_executive_director"); + + /** The value {@code "secretary"}. */ + public static final Role SECRETARY = new Role("secretary"); + + /** The value {@code "chairman"}. */ + public static final Role CHAIRMAN = new Role("chairman"); + + /** The value {@code "ubo"}. */ + public static final Role UBO = new Role("ubo"); + + /** The value {@code "shareholder"}. */ + public static final Role SHAREHOLDER = new Role("shareholder"); + + /** The value {@code "representative"}. */ + public static final Role REPRESENTATIVE = new Role("representative"); + + /** The value {@code "founder"}. */ + public static final Role FOUNDER = new Role("founder"); + + /** The value {@code "legal_advisor"}. */ + public static final Role LEGAL_ADVISOR = new Role("legal_advisor"); + + /** The value {@code "authorized_signatory"}. */ + public static final Role AUTHORIZED_SIGNATORY = new Role("authorized_signatory"); + + /** The value {@code "trustee"}. */ + public static final Role TRUSTEE = new Role("trustee"); + + /** The value {@code "beneficiary"}. */ + public static final Role BENEFICIARY = new Role("beneficiary"); + + /** The value {@code "settlor"}. */ + public static final Role SETTLOR = new Role("settlor"); + + /** The value {@code "protector"}. */ + public static final Role PROTECTOR = new Role("protector"); + + /** The value {@code "company_officer"}. */ + public static final Role COMPANY_OFFICER = new Role("company_officer"); + + /** The value {@code "investor"}. */ + public static final Role INVESTOR = new Role("investor"); + + /** The value {@code "other"}. */ + public static final Role OTHER = new Role("other"); + + private static final List KNOWN_VALUES = List.of(DIRECTOR, NON_EXECUTIVE_DIRECTOR, SECRETARY, CHAIRMAN, UBO, SHAREHOLDER, REPRESENTATIVE, FOUNDER, LEGAL_ADVISOR, AUTHORIZED_SIGNATORY, TRUSTEE, BENEFICIARY, SETTLOR, PROTECTOR, COMPANY_OFFICER, INVESTOR, OTHER); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status of the AML screening run for this officer. null when no AML screening was run. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AmlStatus extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final AmlStatus NOT_FINISHED = new AmlStatus("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final AmlStatus APPROVED = new AmlStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final AmlStatus DECLINED = new AmlStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final AmlStatus IN_REVIEW = new AmlStatus("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final AmlStatus RESUB_REQUESTED = new AmlStatus("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private AmlStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AmlStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AmlStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Raw lifecycle status of the child KYC session spawned for this officer. This is the full session status enum (not a reduced Approved/Declined/Pending set). null when no child KYC session exists. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final KycStatus NOT_STARTED = new KycStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final KycStatus IN_PROGRESS = new KycStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final KycStatus IN_REVIEW = new KycStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final KycStatus EXPIRED = new KycStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final KycStatus ABANDONED = new KycStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final KycStatus KYC_EXPIRED = new KycStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final KycStatus RESUBMITTED = new KycStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final KycStatus AWAITING_USER = new KycStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class VerificationWorkflowFeatures extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "status"); + + private VerificationWorkflowFeatures(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VerificationWorkflowFeatures} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VerificationWorkflowFeatures fromJson(JsonNode json) { + return new VerificationWorkflowFeatures(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature display name (e.g. ID_VERIFICATION, LIVENESS, AML). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Feature-level status inside the child session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.VerificationWorkflowFeatures.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VerificationWorkflowFeatures}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VerificationWorkflowFeatures from) { + super(from); + } + + /** + * Feature display name (e.g. ID_VERIFICATION, LIVENESS, AML). + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Feature-level status inside the child session. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.VerificationWorkflowFeatures.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.VerificationWorkflowFeatures.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VerificationWorkflowFeatures} + */ + public VerificationWorkflowFeatures build() { + return new VerificationWorkflowFeatures(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status inside the child session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Per-category summary derived from the person's AML hits. null when there are no hits. + */ + public static final class KycAmlCategories extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("sanctions", "pep", "adverse_media", "warnings"); + + private KycAmlCategories(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KycAmlCategories} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KycAmlCategories fromJson(JsonNode json) { + return new KycAmlCategories(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The sanctions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sanctions() { + return Json.optional(json, "sanctions", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Sanctions::of)); + } + + /** + * The pep field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pep() { + return Json.optional(json, "pep", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Pep::of)); + } + + /** + * The adverse_media field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional adverseMedia() { + return Json.optional(json, "adverse_media", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.AdverseMedia::of)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional warnings() { + return Json.optional(json, "warnings", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Warnings::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KycAmlCategories}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KycAmlCategories from) { + super(from); + } + + /** + * The sanctions field. + * + * @param sanctions the value + * @return this builder + */ + public Builder sanctions(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Sanctions sanctions) { + return set("sanctions", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Sanctions::of), sanctions); + } + + /** + * The pep field. + * + * @param pep the value + * @return this builder + */ + public Builder pep(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Pep pep) { + return set("pep", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Pep::of), pep); + } + + /** + * The adverse_media field. + * + * @param adverseMedia the value + * @return this builder + */ + public Builder adverseMedia(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.AdverseMedia adverseMedia) { + return set("adverse_media", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.AdverseMedia::of), adverseMedia); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Warnings warnings) { + return set("warnings", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.Officers.KycAmlCategories.Warnings::of), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KycAmlCategories} + */ + public KycAmlCategories build() { + return new KycAmlCategories(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Sanctions extends StringEnum { + /** The value {@code "match"}. */ + public static final Sanctions MATCH = new Sanctions("match"); + + /** The value {@code "clear"}. */ + public static final Sanctions CLEAR = new Sanctions("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private Sanctions(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Sanctions of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Sanctions::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Pep extends StringEnum { + /** The value {@code "match"}. */ + public static final Pep MATCH = new Pep("match"); + + /** The value {@code "clear"}. */ + public static final Pep CLEAR = new Pep("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private Pep(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Pep of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Pep::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AdverseMedia extends StringEnum { + /** The value {@code "match"}. */ + public static final AdverseMedia MATCH = new AdverseMedia("match"); + + /** The value {@code "clear"}. */ + public static final AdverseMedia CLEAR = new AdverseMedia("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private AdverseMedia(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AdverseMedia of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AdverseMedia::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Warnings extends StringEnum { + /** The value {@code "match"}. */ + public static final Warnings MATCH = new Warnings("match"); + + /** The value {@code "clear"}. */ + public static final Warnings CLEAR = new Warnings("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private Warnings(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Warnings of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Warnings::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class BeneficialOwners extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "first_name", "last_name", "date_of_birth", "country_of_birth", "email", "company_name", "registration_number", "entity_type", "nationality", "designation", "roles", "ownership_min_shares", "ownership_max_shares", "is_active", "aml_status", "kyc_status", "kyc_session_url", "kyc_session_id", "verification_workflow_type", "verification_workflow_id", "verification_workflow_label", "verification_workflow_features", "didit_internal_id", "kyc_document_type", "kyc_nationality", "kyc_liveness_passed", "kyc_verified_at", "kyc_aml_categories", "kyc_notification_sent_at", "child_beneficial_owners", "effective_ownership_percent", "voting_min_shares", "voting_max_shares", "appointment_date"); + + private BeneficialOwners(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code BeneficialOwners} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static BeneficialOwners fromJson(JsonNode json) { + return new BeneficialOwners(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Beneficial owner's full name (or company name for corporate UBOs). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Complete birth date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * The country_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryOfBirth() { + return Json.optional(json, "country_of_birth", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.EntityType::of)); + } + + /** + * The nationality field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The designation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional designation() { + return Json.optional(json, "designation", Conv.STRING); + } + + /** + * Role names held by this owner, e.g. ["ubo", "shareholder"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> roles() { + return Json.optional(json, "roles", Conv.list(Conv.STRING)); + } + + /** + * Lower bound of the ownership percentage as reported by the registry. Free-form string (e.g. "25", "25-50%"); use effective_ownership_percent for a parsed numeric value. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMinShares() { + return Json.optional(json, "ownership_min_shares", Conv.STRING); + } + + /** + * Upper bound of the ownership percentage as reported by the registry. Free-form string; use effective_ownership_percent for a parsed numeric value. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipMaxShares() { + return Json.optional(json, "ownership_max_shares", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Status of the AML screening run for this beneficial owner. null when no AML screening was run. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amlStatus() { + return Json.optional(json, "aml_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.AmlStatus::of)); + } + + /** + * Raw lifecycle status of the child KYC session spawned for this beneficial owner. This is the full session status enum (not a reduced Approved/Declined/Pending set). null when no child KYC session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycStatus() { + return Json.optional(json, "kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycStatus::of)); + } + + /** + * Shareable URL of the child KYC session. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Session id of the child KYC session. Pass it to this same decision endpoint to fetch the person's full KYC report. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionId() { + return Json.optional(json, "kyc_session_id", Conv.STRING); + } + + /** + * Base workflow type of the child session's workflow (e.g. kyc). null for graph-based workflows or when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowType() { + return Json.optional(json, "verification_workflow_type", Conv.STRING); + } + + /** + * Workflow id used by the child session. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowId() { + return Json.optional(json, "verification_workflow_id", Conv.STRING); + } + + /** + * Human-readable label of the child session's workflow. null when unset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowLabel() { + return Json.optional(json, "verification_workflow_label", Conv.STRING); + } + + /** + * Per-feature progress of the child verification session, e.g. [{"feature": "ID_VERIFICATION", "status": "Approved"}]. null when the child session has no resolvable feature list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> verificationWorkflowFeatures() { + return Json.optional(json, "verification_workflow_features", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.VerificationWorkflowFeatures::fromJson))); + } + + /** + * Stable internal identifier of the verified individual behind the child session โ€” useful for cross-session linking. null when no child session exists or the user has not been resolved yet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Document type presented in the child KYC session (e.g. P, ID, DL). null until the child session has an ID verification result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycDocumentType() { + return Json.optional(json, "kyc_document_type", Conv.STRING); + } + + /** + * Nationality extracted from the document in the child KYC session. null until available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycNationality() { + return Json.optional(json, "kyc_nationality", Conv.STRING); + } + + /** + * Whether the child KYC session's liveness check passed. null when no liveness check has run. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycLivenessPassed() { + return Json.optional(json, "kyc_liveness_passed", Conv.BOOLEAN); + } + + /** + * When the child KYC session reached Approved. null while the child session has any other status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycVerifiedAt() { + return Json.optional(json, "kyc_verified_at", Conv.DATE_TIME); + } + + /** + * Per-category summary derived from the person's AML hits. null when there are no hits. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycAmlCategories() { + return Json.optional(json, "kyc_aml_categories", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories::fromJson)); + } + + /** + * ISO 8601 timestamp of the last verification-invite notification sent for this person's child session. null when none was sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycNotificationSentAt() { + return Json.optional(json, "kyc_notification_sent_at", Conv.STRING); + } + + /** + * For corporate UBOs: the owning entity's own beneficial owners, as raw objects extracted from the registry. Empty array when not applicable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> childBeneficialOwners() { + return Json.optional(json, "child_beneficial_owners", Conv.list(Conv.OBJECT)); + } + + /** + * Parsed numeric ownership percentage โ€” the max bound when available, otherwise the min bound. null when neither bound could be parsed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveOwnershipPercent() { + return Json.optional(json, "effective_ownership_percent", Conv.DOUBLE); + } + + /** + * The voting_min_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMinShares() { + return Json.optional(json, "voting_min_shares", Conv.STRING); + } + + /** + * The voting_max_shares field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingMaxShares() { + return Json.optional(json, "voting_max_shares", Conv.STRING); + } + + /** + * Appointment date when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional appointmentDate() { + return Json.optional(json, "appointment_date", Conv.DATE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link BeneficialOwners}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(BeneficialOwners from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Beneficial owner's full name (or company name for corporate UBOs). + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Complete birth date when reported. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * The country_of_birth field. + * + * @param countryOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryOfBirth(@Nullable String countryOfBirth) { + return setNullable("country_of_birth", Conv.STRING, countryOfBirth); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.EntityType entityType) { + return set("entity_type", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.EntityType::of), entityType); + } + + /** + * The nationality field. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The designation field. + * + * @param designation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder designation(@Nullable String designation) { + return setNullable("designation", Conv.STRING, designation); + } + + /** + * Role names held by this owner, e.g. ["ubo", "shareholder"]. + * + * @param roles the value + * @return this builder + */ + public Builder roles(List roles) { + return set("roles", Conv.list(Conv.STRING), roles); + } + + /** + * Lower bound of the ownership percentage as reported by the registry. Free-form string (e.g. "25", "25-50%"); use effective_ownership_percent for a parsed numeric value. + * + * @param ownershipMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMinShares(@Nullable String ownershipMinShares) { + return setNullable("ownership_min_shares", Conv.STRING, ownershipMinShares); + } + + /** + * Upper bound of the ownership percentage as reported by the registry. Free-form string; use effective_ownership_percent for a parsed numeric value. + * + * @param ownershipMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipMaxShares(@Nullable String ownershipMaxShares) { + return setNullable("ownership_max_shares", Conv.STRING, ownershipMaxShares); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Status of the AML screening run for this beneficial owner. null when no AML screening was run. + * + * @param amlStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amlStatus(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.@Nullable AmlStatus amlStatus) { + return setNullable("aml_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.AmlStatus::of), amlStatus); + } + + /** + * Raw lifecycle status of the child KYC session spawned for this beneficial owner. This is the full session status enum (not a reduced Approved/Declined/Pending set). null when no child KYC session exists. + * + * @param kycStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycStatus(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.@Nullable KycStatus kycStatus) { + return setNullable("kyc_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycStatus::of), kycStatus); + } + + /** + * Shareable URL of the child KYC session. null when no child session exists. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Session id of the child KYC session. Pass it to this same decision endpoint to fetch the person's full KYC report. null when no child session exists. + * + * @param kycSessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionId(@Nullable String kycSessionId) { + return setNullable("kyc_session_id", Conv.STRING, kycSessionId); + } + + /** + * Base workflow type of the child session's workflow (e.g. kyc). null for graph-based workflows or when no child session exists. + * + * @param verificationWorkflowType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowType(@Nullable String verificationWorkflowType) { + return setNullable("verification_workflow_type", Conv.STRING, verificationWorkflowType); + } + + /** + * Workflow id used by the child session. null when no child session exists. + * + * @param verificationWorkflowId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowId(@Nullable String verificationWorkflowId) { + return setNullable("verification_workflow_id", Conv.STRING, verificationWorkflowId); + } + + /** + * Human-readable label of the child session's workflow. null when unset. + * + * @param verificationWorkflowLabel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowLabel(@Nullable String verificationWorkflowLabel) { + return setNullable("verification_workflow_label", Conv.STRING, verificationWorkflowLabel); + } + + /** + * Per-feature progress of the child verification session, e.g. [{"feature": "ID_VERIFICATION", "status": "Approved"}]. null when the child session has no resolvable feature list. + * + * @param verificationWorkflowFeatures the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowFeatures(@Nullable List verificationWorkflowFeatures) { + return setNullable("verification_workflow_features", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.VerificationWorkflowFeatures::fromJson)), verificationWorkflowFeatures); + } + + /** + * Stable internal identifier of the verified individual behind the child session โ€” useful for cross-session linking. null when no child session exists or the user has not been resolved yet. + * + * @param diditInternalId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder diditInternalId(@Nullable String diditInternalId) { + return setNullable("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Document type presented in the child KYC session (e.g. P, ID, DL). null until the child session has an ID verification result. + * + * @param kycDocumentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycDocumentType(@Nullable String kycDocumentType) { + return setNullable("kyc_document_type", Conv.STRING, kycDocumentType); + } + + /** + * Nationality extracted from the document in the child KYC session. null until available. + * + * @param kycNationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycNationality(@Nullable String kycNationality) { + return setNullable("kyc_nationality", Conv.STRING, kycNationality); + } + + /** + * Whether the child KYC session's liveness check passed. null when no liveness check has run. + * + * @param kycLivenessPassed the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycLivenessPassed(@Nullable Boolean kycLivenessPassed) { + return setNullable("kyc_liveness_passed", Conv.BOOLEAN, kycLivenessPassed); + } + + /** + * When the child KYC session reached Approved. null while the child session has any other status. + * + * @param kycVerifiedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycVerifiedAt(@Nullable OffsetDateTime kycVerifiedAt) { + return setNullable("kyc_verified_at", Conv.DATE_TIME, kycVerifiedAt); + } + + /** + * Per-category summary derived from the person's AML hits. null when there are no hits. + * + * @param kycAmlCategories the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycAmlCategories(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.@Nullable KycAmlCategories kycAmlCategories) { + return setNullable("kyc_aml_categories", Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories::fromJson), kycAmlCategories); + } + + /** + * ISO 8601 timestamp of the last verification-invite notification sent for this person's child session. null when none was sent. + * + * @param kycNotificationSentAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycNotificationSentAt(@Nullable String kycNotificationSentAt) { + return setNullable("kyc_notification_sent_at", Conv.STRING, kycNotificationSentAt); + } + + /** + * For corporate UBOs: the owning entity's own beneficial owners, as raw objects extracted from the registry. Empty array when not applicable. + * + * @param childBeneficialOwners the value + * @return this builder + */ + public Builder childBeneficialOwners(List> childBeneficialOwners) { + return setAny("child_beneficial_owners", childBeneficialOwners); + } + + /** + * Parsed numeric ownership percentage โ€” the max bound when available, otherwise the min bound. null when neither bound could be parsed. + * + * @param effectiveOwnershipPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveOwnershipPercent(@Nullable Double effectiveOwnershipPercent) { + return setNullable("effective_ownership_percent", Conv.DOUBLE, effectiveOwnershipPercent); + } + + /** + * The voting_min_shares field. + * + * @param votingMinShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMinShares(@Nullable String votingMinShares) { + return setNullable("voting_min_shares", Conv.STRING, votingMinShares); + } + + /** + * The voting_max_shares field. + * + * @param votingMaxShares the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingMaxShares(@Nullable String votingMaxShares) { + return setNullable("voting_max_shares", Conv.STRING, votingMaxShares); + } + + /** + * Appointment date when reported. + * + * @param appointmentDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder appointmentDate(@Nullable LocalDate appointmentDate) { + return setNullable("appointment_date", Conv.DATE, appointmentDate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code BeneficialOwners} + */ + public BeneficialOwners build() { + return new BeneficialOwners(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status of the AML screening run for this beneficial owner. null when no AML screening was run. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AmlStatus extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final AmlStatus NOT_FINISHED = new AmlStatus("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final AmlStatus APPROVED = new AmlStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final AmlStatus DECLINED = new AmlStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final AmlStatus IN_REVIEW = new AmlStatus("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final AmlStatus RESUB_REQUESTED = new AmlStatus("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private AmlStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AmlStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AmlStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Raw lifecycle status of the child KYC session spawned for this beneficial owner. This is the full session status enum (not a reduced Approved/Declined/Pending set). null when no child KYC session exists. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final KycStatus NOT_STARTED = new KycStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final KycStatus IN_PROGRESS = new KycStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final KycStatus APPROVED = new KycStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycStatus DECLINED = new KycStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final KycStatus IN_REVIEW = new KycStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final KycStatus EXPIRED = new KycStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final KycStatus ABANDONED = new KycStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final KycStatus KYC_EXPIRED = new KycStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final KycStatus RESUBMITTED = new KycStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final KycStatus AWAITING_USER = new KycStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private KycStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class VerificationWorkflowFeatures extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "status"); + + private VerificationWorkflowFeatures(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VerificationWorkflowFeatures} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VerificationWorkflowFeatures fromJson(JsonNode json) { + return new VerificationWorkflowFeatures(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature display name (e.g. ID_VERIFICATION, LIVENESS, AML). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Feature-level status inside the child session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.VerificationWorkflowFeatures.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VerificationWorkflowFeatures}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VerificationWorkflowFeatures from) { + super(from); + } + + /** + * Feature display name (e.g. ID_VERIFICATION, LIVENESS, AML). + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Feature-level status inside the child session. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.VerificationWorkflowFeatures.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.VerificationWorkflowFeatures.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VerificationWorkflowFeatures} + */ + public VerificationWorkflowFeatures build() { + return new VerificationWorkflowFeatures(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status inside the child session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Per-category summary derived from the person's AML hits. null when there are no hits. + */ + public static final class KycAmlCategories extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("sanctions", "pep", "adverse_media", "warnings"); + + private KycAmlCategories(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code KycAmlCategories} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static KycAmlCategories fromJson(JsonNode json) { + return new KycAmlCategories(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The sanctions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sanctions() { + return Json.optional(json, "sanctions", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Sanctions::of)); + } + + /** + * The pep field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pep() { + return Json.optional(json, "pep", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Pep::of)); + } + + /** + * The adverse_media field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional adverseMedia() { + return Json.optional(json, "adverse_media", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.AdverseMedia::of)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional warnings() { + return Json.optional(json, "warnings", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Warnings::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link KycAmlCategories}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(KycAmlCategories from) { + super(from); + } + + /** + * The sanctions field. + * + * @param sanctions the value + * @return this builder + */ + public Builder sanctions(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Sanctions sanctions) { + return set("sanctions", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Sanctions::of), sanctions); + } + + /** + * The pep field. + * + * @param pep the value + * @return this builder + */ + public Builder pep(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Pep pep) { + return set("pep", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Pep::of), pep); + } + + /** + * The adverse_media field. + * + * @param adverseMedia the value + * @return this builder + */ + public Builder adverseMedia(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.AdverseMedia adverseMedia) { + return set("adverse_media", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.AdverseMedia::of), adverseMedia); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Warnings warnings) { + return set("warnings", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Registry.BeneficialOwners.KycAmlCategories.Warnings::of), warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code KycAmlCategories} + */ + public KycAmlCategories build() { + return new KycAmlCategories(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Sanctions extends StringEnum { + /** The value {@code "match"}. */ + public static final Sanctions MATCH = new Sanctions("match"); + + /** The value {@code "clear"}. */ + public static final Sanctions CLEAR = new Sanctions("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private Sanctions(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Sanctions of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Sanctions::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Pep extends StringEnum { + /** The value {@code "match"}. */ + public static final Pep MATCH = new Pep("match"); + + /** The value {@code "clear"}. */ + public static final Pep CLEAR = new Pep("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private Pep(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Pep of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Pep::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AdverseMedia extends StringEnum { + /** The value {@code "match"}. */ + public static final AdverseMedia MATCH = new AdverseMedia("match"); + + /** The value {@code "clear"}. */ + public static final AdverseMedia CLEAR = new AdverseMedia("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private AdverseMedia(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AdverseMedia of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AdverseMedia::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Warnings extends StringEnum { + /** The value {@code "match"}. */ + public static final Warnings MATCH = new Warnings("match"); + + /** The value {@code "clear"}. */ + public static final Warnings CLEAR = new Warnings("clear"); + + private static final List KNOWN_VALUES = List.of(MATCH, CLEAR); + + private Warnings(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Warnings of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Warnings::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + } + + /** + * Parties submitted by the business admin during the Key People flow (BusinessParty rows where source=USER). + */ + public static final class Submitted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("parties"); + + private Submitted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Submitted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Submitted fromJson(JsonNode json) { + return new Submitted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The parties field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> parties() { + return Json.optional(json, "parties", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Submitted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Submitted from) { + super(from); + } + + /** + * The parties field. + * + * @param parties the value + * @return this builder + */ + public Builder parties(List parties) { + return set("parties", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties::fromJson)), parties); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Submitted} + */ + public Submitted build() { + return new Submitted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Party submitted by the business admin via the Key People flow (source=USER). */ + public static final class Parties extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "entity_type", "source", "name", "first_name", "last_name", "company_name", "registration_number", "email", "nationality", "phone_number", "date_of_birth", "position", "custom_fields", "is_active", "is_skipped", "requires_verification", "roles", "kyc_session_id", "kyc_session_status", "kyc_session_url", "kyb_sub_session_id", "kyb_sub_session_status", "kyb_sub_session_url", "verification_workflow_type", "verification_workflow_id", "verification_workflow_label", "verification_workflow_features", "didit_internal_id"); + + private Parties(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Parties} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Parties fromJson(JsonNode json) { + return new Parties(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.EntityType::of)); + } + + /** + * Always USER here โ€” this bucket only contains parties entered or confirmed by the end user in the Key People flow (registry-discovered people appear under registry). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Source::of)); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * Nationality for persons; country of incorporation for company parties. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * The phone_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phoneNumber() { + return Json.optional(json, "phone_number", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Free-text job title / position (persons only). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional position() { + return Json.optional(json, "position", Conv.STRING); + } + + /** + * Workflow-defined custom fields collected for this party; keys are defined by the workflow's key-people field descriptors. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> customFields() { + return Json.optional(json, "custom_fields", Conv.OBJECT); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * True when the end user skipped verification for this party (only possible when the role allows skipping). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSkipped() { + return Json.optional(json, "is_skipped", Conv.BOOLEAN); + } + + /** + * True when a child KYC / KYB sub-session is required for this party based on role settings and ownership thresholds. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requiresVerification() { + return Json.optional(json, "requires_verification", Conv.BOOLEAN); + } + + /** + * All roles held by this party, each with its own ownership and voting percentages. There is no scalar role/ownership_percent on the party itself. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> roles() { + return Json.optional(json, "roles", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Roles::fromJson))); + } + + /** + * Child KYC session id for person parties requiring verification. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionId() { + return Json.optional(json, "kyc_session_id", Conv.STRING); + } + + /** + * Lifecycle status of the child KYC session. null when no child KYC session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionStatus() { + return Json.optional(json, "kyc_session_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.KycSessionStatus::of)); + } + + /** + * The kyc_session_url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * Child KYB sub-session id for corporate parties requiring verification. null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybSubSessionId() { + return Json.optional(json, "kyb_sub_session_id", Conv.STRING); + } + + /** + * Lifecycle status of the child KYB sub-session. null when no sub-session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybSubSessionStatus() { + return Json.optional(json, "kyb_sub_session_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.KybSubSessionStatus::of)); + } + + /** + * Shareable URL of the child KYB sub-session. null when no sub-session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybSubSessionUrl() { + return Json.optional(json, "kyb_sub_session_url", Conv.STRING); + } + + /** + * Base workflow type of the child session's workflow (KYC session preferred, falling back to the KYB sub-session). null for graph-based workflows or when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowType() { + return Json.optional(json, "verification_workflow_type", Conv.STRING); + } + + /** + * Workflow id used by the child session. null when no child session exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowId() { + return Json.optional(json, "verification_workflow_id", Conv.STRING); + } + + /** + * Human-readable label of the child session's workflow. null when unset. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationWorkflowLabel() { + return Json.optional(json, "verification_workflow_label", Conv.STRING); + } + + /** + * Per-feature progress of the child verification session, e.g. [{"feature": "ID_VERIFICATION", "status": "Approved"}]. null when the child session has no resolvable feature list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> verificationWorkflowFeatures() { + return Json.optional(json, "verification_workflow_features", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.VerificationWorkflowFeatures::fromJson))); + } + + /** + * Stable internal identifier of the verified individual behind the child session. null when not resolved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Parties}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Parties from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.EntityType entityType) { + return set("entity_type", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.EntityType::of), entityType); + } + + /** + * Always USER here โ€” this bucket only contains parties entered or confirmed by the end user in the Key People flow (registry-discovered people appear under registry). + * + * @param source the value + * @return this builder + */ + public Builder source(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Source source) { + return set("source", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Source::of), source); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * Nationality for persons; country of incorporation for company parties. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * The phone_number field. + * + * @param phoneNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phoneNumber(@Nullable String phoneNumber) { + return setNullable("phone_number", Conv.STRING, phoneNumber); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Free-text job title / position (persons only). + * + * @param position the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder position(@Nullable String position) { + return setNullable("position", Conv.STRING, position); + } + + /** + * Workflow-defined custom fields collected for this party; keys are defined by the workflow's key-people field descriptors. + * + * @param customFields the value + * @return this builder + */ + public Builder customFields(Map customFields) { + return setAny("custom_fields", customFields); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * True when the end user skipped verification for this party (only possible when the role allows skipping). + * + * @param isSkipped the value + * @return this builder + */ + public Builder isSkipped(boolean isSkipped) { + return set("is_skipped", Conv.BOOLEAN, isSkipped); + } + + /** + * True when a child KYC / KYB sub-session is required for this party based on role settings and ownership thresholds. + * + * @param requiresVerification the value + * @return this builder + */ + public Builder requiresVerification(boolean requiresVerification) { + return set("requires_verification", Conv.BOOLEAN, requiresVerification); + } + + /** + * All roles held by this party, each with its own ownership and voting percentages. There is no scalar role/ownership_percent on the party itself. + * + * @param roles the value + * @return this builder + */ + public Builder roles(List roles) { + return set("roles", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Roles::fromJson)), roles); + } + + /** + * Child KYC session id for person parties requiring verification. null otherwise. + * + * @param kycSessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionId(@Nullable String kycSessionId) { + return setNullable("kyc_session_id", Conv.STRING, kycSessionId); + } + + /** + * Lifecycle status of the child KYC session. null when no child KYC session exists. + * + * @param kycSessionStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionStatus(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.@Nullable KycSessionStatus kycSessionStatus) { + return setNullable("kyc_session_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.KycSessionStatus::of), kycSessionStatus); + } + + /** + * The kyc_session_url field. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * Child KYB sub-session id for corporate parties requiring verification. null otherwise. + * + * @param kybSubSessionId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kybSubSessionId(@Nullable String kybSubSessionId) { + return setNullable("kyb_sub_session_id", Conv.STRING, kybSubSessionId); + } + + /** + * Lifecycle status of the child KYB sub-session. null when no sub-session exists. + * + * @param kybSubSessionStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kybSubSessionStatus(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.@Nullable KybSubSessionStatus kybSubSessionStatus) { + return setNullable("kyb_sub_session_status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.KybSubSessionStatus::of), kybSubSessionStatus); + } + + /** + * Shareable URL of the child KYB sub-session. null when no sub-session exists. + * + * @param kybSubSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kybSubSessionUrl(@Nullable String kybSubSessionUrl) { + return setNullable("kyb_sub_session_url", Conv.STRING, kybSubSessionUrl); + } + + /** + * Base workflow type of the child session's workflow (KYC session preferred, falling back to the KYB sub-session). null for graph-based workflows or when no child session exists. + * + * @param verificationWorkflowType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowType(@Nullable String verificationWorkflowType) { + return setNullable("verification_workflow_type", Conv.STRING, verificationWorkflowType); + } + + /** + * Workflow id used by the child session. null when no child session exists. + * + * @param verificationWorkflowId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowId(@Nullable String verificationWorkflowId) { + return setNullable("verification_workflow_id", Conv.STRING, verificationWorkflowId); + } + + /** + * Human-readable label of the child session's workflow. null when unset. + * + * @param verificationWorkflowLabel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowLabel(@Nullable String verificationWorkflowLabel) { + return setNullable("verification_workflow_label", Conv.STRING, verificationWorkflowLabel); + } + + /** + * Per-feature progress of the child verification session, e.g. [{"feature": "ID_VERIFICATION", "status": "Approved"}]. null when the child session has no resolvable feature list. + * + * @param verificationWorkflowFeatures the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationWorkflowFeatures(@Nullable List verificationWorkflowFeatures) { + return setNullable("verification_workflow_features", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.VerificationWorkflowFeatures::fromJson)), verificationWorkflowFeatures); + } + + /** + * Stable internal identifier of the verified individual behind the child session. null when not resolved. + * + * @param diditInternalId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder diditInternalId(@Nullable String diditInternalId) { + return setNullable("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Parties} + */ + public Parties build() { + return new Parties(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Always USER here โ€” this bucket only contains parties entered or confirmed by the end user in the Key People flow (registry-discovered people appear under registry). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "USER"}. */ + public static final Source USER = new Source("USER"); + + private static final List KNOWN_VALUES = List.of(USER); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Roles extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("role", "ownership_percent", "voting_percent"); + + private Roles(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Roles} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Roles fromJson(JsonNode json) { + return new Roles(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The role field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Roles.Role::of)); + } + + /** + * The ownership_percent field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipPercent() { + return Json.optional(json, "ownership_percent", Conv.DOUBLE); + } + + /** + * The voting_percent field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional votingPercent() { + return Json.optional(json, "voting_percent", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Roles}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Roles from) { + super(from); + } + + /** + * The role field. + * + * @param role the value + * @return this builder + */ + public Builder role(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Roles.Role role) { + return set("role", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.Roles.Role::of), role); + } + + /** + * The ownership_percent field. + * + * @param ownershipPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipPercent(@Nullable Double ownershipPercent) { + return setNullable("ownership_percent", Conv.DOUBLE, ownershipPercent); + } + + /** + * The voting_percent field. + * + * @param votingPercent the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder votingPercent(@Nullable Double votingPercent) { + return setNullable("voting_percent", Conv.DOUBLE, votingPercent); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Roles} + */ + public Roles build() { + return new Roles(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "director"}. */ + public static final Role DIRECTOR = new Role("director"); + + /** The value {@code "non_executive_director"}. */ + public static final Role NON_EXECUTIVE_DIRECTOR = new Role("non_executive_director"); + + /** The value {@code "secretary"}. */ + public static final Role SECRETARY = new Role("secretary"); + + /** The value {@code "chairman"}. */ + public static final Role CHAIRMAN = new Role("chairman"); + + /** The value {@code "ubo"}. */ + public static final Role UBO = new Role("ubo"); + + /** The value {@code "shareholder"}. */ + public static final Role SHAREHOLDER = new Role("shareholder"); + + /** The value {@code "representative"}. */ + public static final Role REPRESENTATIVE = new Role("representative"); + + /** The value {@code "founder"}. */ + public static final Role FOUNDER = new Role("founder"); + + /** The value {@code "legal_advisor"}. */ + public static final Role LEGAL_ADVISOR = new Role("legal_advisor"); + + /** The value {@code "authorized_signatory"}. */ + public static final Role AUTHORIZED_SIGNATORY = new Role("authorized_signatory"); + + /** The value {@code "trustee"}. */ + public static final Role TRUSTEE = new Role("trustee"); + + /** The value {@code "beneficiary"}. */ + public static final Role BENEFICIARY = new Role("beneficiary"); + + /** The value {@code "settlor"}. */ + public static final Role SETTLOR = new Role("settlor"); + + /** The value {@code "protector"}. */ + public static final Role PROTECTOR = new Role("protector"); + + /** The value {@code "company_officer"}. */ + public static final Role COMPANY_OFFICER = new Role("company_officer"); + + /** The value {@code "investor"}. */ + public static final Role INVESTOR = new Role("investor"); + + /** The value {@code "other"}. */ + public static final Role OTHER = new Role("other"); + + private static final List KNOWN_VALUES = List.of(DIRECTOR, NON_EXECUTIVE_DIRECTOR, SECRETARY, CHAIRMAN, UBO, SHAREHOLDER, REPRESENTATIVE, FOUNDER, LEGAL_ADVISOR, AUTHORIZED_SIGNATORY, TRUSTEE, BENEFICIARY, SETTLOR, PROTECTOR, COMPANY_OFFICER, INVESTOR, OTHER); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Lifecycle status of the child KYC session. null when no child KYC session exists. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KycSessionStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final KycSessionStatus NOT_STARTED = new KycSessionStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final KycSessionStatus IN_PROGRESS = new KycSessionStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final KycSessionStatus APPROVED = new KycSessionStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KycSessionStatus DECLINED = new KycSessionStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final KycSessionStatus IN_REVIEW = new KycSessionStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final KycSessionStatus EXPIRED = new KycSessionStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final KycSessionStatus ABANDONED = new KycSessionStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final KycSessionStatus KYC_EXPIRED = new KycSessionStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final KycSessionStatus RESUBMITTED = new KycSessionStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final KycSessionStatus AWAITING_USER = new KycSessionStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private KycSessionStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KycSessionStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KycSessionStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Lifecycle status of the child KYB sub-session. null when no sub-session exists. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class KybSubSessionStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final KybSubSessionStatus NOT_STARTED = new KybSubSessionStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final KybSubSessionStatus IN_PROGRESS = new KybSubSessionStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final KybSubSessionStatus APPROVED = new KybSubSessionStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final KybSubSessionStatus DECLINED = new KybSubSessionStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final KybSubSessionStatus IN_REVIEW = new KybSubSessionStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final KybSubSessionStatus EXPIRED = new KybSubSessionStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final KybSubSessionStatus ABANDONED = new KybSubSessionStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final KybSubSessionStatus KYC_EXPIRED = new KybSubSessionStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final KybSubSessionStatus RESUBMITTED = new KybSubSessionStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final KybSubSessionStatus AWAITING_USER = new KybSubSessionStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private KybSubSessionStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static KybSubSessionStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, KybSubSessionStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class VerificationWorkflowFeatures extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "status"); + + private VerificationWorkflowFeatures(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VerificationWorkflowFeatures} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VerificationWorkflowFeatures fromJson(JsonNode json) { + return new VerificationWorkflowFeatures(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature display name (e.g. ID_VERIFICATION, LIVENESS, AML). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * Feature-level status inside the child session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.VerificationWorkflowFeatures.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VerificationWorkflowFeatures}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VerificationWorkflowFeatures from) { + super(from); + } + + /** + * Feature display name (e.g. ID_VERIFICATION, LIVENESS, AML). + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Feature-level status inside the child session. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.VerificationWorkflowFeatures.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.KeyPeopleChecks.Submitted.Parties.VerificationWorkflowFeatures.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VerificationWorkflowFeatures} + */ + public VerificationWorkflowFeatures build() { + return new VerificationWorkflowFeatures(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature-level status inside the child session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + } + + /** Aggregate UBO KYC progress, or null when no UBOs have linked KYC sessions. */ + public static final class UboKycSummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total", "approved", "flagged", "pending"); + + private UboKycSummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UboKycSummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UboKycSummary fromJson(JsonNode json) { + return new UboKycSummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The approved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approved() { + return Json.optional(json, "approved", Conv.LONG); + } + + /** + * UBOs whose KYC is Declined or In Review. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional flagged() { + return Json.optional(json, "flagged", Conv.LONG); + } + + /** + * The pending field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pending() { + return Json.optional(json, "pending", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UboKycSummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UboKycSummary from) { + super(from); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The approved field. + * + * @param approved the value + * @return this builder + */ + public Builder approved(long approved) { + return set("approved", Conv.LONG, approved); + } + + /** + * UBOs whose KYC is Declined or In Review. + * + * @param flagged the value + * @return this builder + */ + public Builder flagged(long flagged) { + return set("flagged", Conv.LONG, flagged); + } + + /** + * The pending field. + * + * @param pending the value + * @return this builder + */ + public Builder pending(long pending) { + return set("pending", Conv.LONG, pending); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UboKycSummary} + */ + public UboKycSummary build() { + return new UboKycSummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** Documents grouped by workflow node. Present only when session_kind = business. */ + public static final class DocumentVerifications extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "node_id", "items", "groups", "required_groups", "warnings"); + + private DocumentVerifications(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentVerifications} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentVerifications fromJson(JsonNode json) { + return new DocumentVerifications(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * The items field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> items() { + return Json.optional(json, "items", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items::fromJson))); + } + + /** + * Per-group progress counters keyed by group name (e.g. legal_presence, ownership_structure). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> groups() { + return Json.optional(json, "groups", Conv.map(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.GroupsValue::fromJson))); + } + + /** + * The required_groups field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> requiredGroups() { + return Json.optional(json, "required_groups", Conv.list(Conv.STRING)); + } + + /** + * The warnings field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> warnings() { + return Json.optional(json, "warnings", Conv.list(Conv.OBJECT)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentVerifications}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentVerifications from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The node_id field. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * The items field. + * + * @param items the value + * @return this builder + */ + public Builder items(List items) { + return set("items", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items::fromJson)), items); + } + + /** + * Per-group progress counters keyed by group name (e.g. legal_presence, ownership_structure). + * + * @param groups the value + * @return this builder + */ + public Builder groups(Map groups) { + return set("groups", Conv.map(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.GroupsValue::fromJson)), groups); + } + + /** + * The required_groups field. + * + * @param requiredGroups the value + * @return this builder + */ + public Builder requiredGroups(List requiredGroups) { + return set("required_groups", Conv.list(Conv.STRING), requiredGroups); + } + + /** + * The warnings field. + * + * @param warnings the value + * @return this builder + */ + public Builder warnings(List> warnings) { + return setAny("warnings", warnings); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentVerifications} + */ + public DocumentVerifications build() { + return new DocumentVerifications(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Items extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "document_type", "document_subtype", "document_group", "file_url", "original_filename", "file_size", "status", "created_at", "cross_check_result", "document_metadata", "description", "is_requested", "ocr_data", "is_console_upload", "is_confirmed"); + + private Items(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Items} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Items fromJson(JsonNode json) { + return new Items(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * High-level KYB document group the file was classified into. null while unclassified. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentType::of)); + } + + /** + * Specific OCR-detected subtype (e.g. CERTIFICATE_OF_INCORPORATION, SHAREHOLDER_REGISTRY); UNKNOWN when the OCR could not confidently classify the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * Alias of document_type โ€” the group name used by groups and required_groups. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentGroup() { + return Json.optional(json, "document_group", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentGroup::of)); + } + + /** + * Short-lived presigned link to the uploaded file. null for analyst-created document request placeholders (is_requested = true) that have not been fulfilled yet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileUrl() { + return Json.optional(json, "file_url", Conv.STRING); + } + + /** + * Filename as uploaded by the user or analyst. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional originalFilename() { + return Json.optional(json, "original_filename", Conv.STRING); + } + + /** + * File size in bytes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + /** + * Per-document verification status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.Status::of)); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * Cross-reference of the OCR-extracted document fields against the registry company profile. An object with critical, non_critical and people sections, each mapping a field name (e.g. company_name, registration_number, incorporation_date, registered_address) to a comparison record like {"document": "...", "registry": "...", "match": true, "score": 0.97}. null when the document had no OCR data or there was no registry company to compare against. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> crossCheckResult() { + return Json.optional(json, "cross_check_result", Conv.OBJECT); + } + + /** + * Metadata extracted from the uploaded corporate document. When metadata extraction succeeded, all 16 keys are always present (individual values are null when not applicable to the file type); the whole object is null when nothing could be extracted. For PDFs, overlay_manipulation carries forensic overlay-text analysis. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentMetadata() { + return Json.optional(json, "document_metadata", Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata::fromJson)); + } + + /** + * Analyst-provided label or reason for a document request. null for regular uploads. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * True for analyst-created document request placeholders awaiting an upload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isRequested() { + return Json.optional(json, "is_requested", Conv.BOOLEAN); + } + + /** + * The ocr_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> ocrData() { + return Json.optional(json, "ocr_data", Conv.OBJECT); + } + + /** + * True for documents uploaded from the console rather than the end-user flow. Console uploads never change the feature-level aggregate status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isConsoleUpload() { + return Json.optional(json, "is_console_upload", Conv.BOOLEAN); + } + + /** + * Console uploads start false and flip true once the admin confirms them; end-user uploads are always true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isConfirmed() { + return Json.optional(json, "is_confirmed", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Items}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Items from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * High-level KYB document group the file was classified into. null while unclassified. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.@Nullable DocumentType documentType) { + return setNullable("document_type", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentType::of), documentType); + } + + /** + * Specific OCR-detected subtype (e.g. CERTIFICATE_OF_INCORPORATION, SHAREHOLDER_REGISTRY); UNKNOWN when the OCR could not confidently classify the document. + * + * @param documentSubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSubtype(@Nullable String documentSubtype) { + return setNullable("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * Alias of document_type โ€” the group name used by groups and required_groups. + * + * @param documentGroup the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentGroup(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.@Nullable DocumentGroup documentGroup) { + return setNullable("document_group", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentGroup::of), documentGroup); + } + + /** + * Short-lived presigned link to the uploaded file. null for analyst-created document request placeholders (is_requested = true) that have not been fulfilled yet. + * + * @param fileUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileUrl(@Nullable String fileUrl) { + return setNullable("file_url", Conv.STRING, fileUrl); + } + + /** + * Filename as uploaded by the user or analyst. + * + * @param originalFilename the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder originalFilename(@Nullable String originalFilename) { + return setNullable("original_filename", Conv.STRING, originalFilename); + } + + /** + * File size in bytes. + * + * @param fileSize the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileSize(@Nullable Long fileSize) { + return setNullable("file_size", Conv.LONG, fileSize); + } + + /** + * Per-document verification status. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.Status::of), status); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Cross-reference of the OCR-extracted document fields against the registry company profile. An object with critical, non_critical and people sections, each mapping a field name (e.g. company_name, registration_number, incorporation_date, registered_address) to a comparison record like {"document": "...", "registry": "...", "match": true, "score": 0.97}. null when the document had no OCR data or there was no registry company to compare against. + * + * @param crossCheckResult the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder crossCheckResult(@Nullable Map crossCheckResult) { + return setAny("cross_check_result", crossCheckResult); + } + + /** + * Metadata extracted from the uploaded corporate document. When metadata extraction succeeded, all 16 keys are always present (individual values are null when not applicable to the file type); the whole object is null when nothing could be extracted. For PDFs, overlay_manipulation carries forensic overlay-text analysis. + * + * @param documentMetadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentMetadata(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.@Nullable DocumentMetadata documentMetadata) { + return setNullable("document_metadata", Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata::fromJson), documentMetadata); + } + + /** + * Analyst-provided label or reason for a document request. null for regular uploads. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * True for analyst-created document request placeholders awaiting an upload. + * + * @param isRequested the value + * @return this builder + */ + public Builder isRequested(boolean isRequested) { + return set("is_requested", Conv.BOOLEAN, isRequested); + } + + /** + * The ocr_data field. + * + * @param ocrData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ocrData(@Nullable Map ocrData) { + return setAny("ocr_data", ocrData); + } + + /** + * True for documents uploaded from the console rather than the end-user flow. Console uploads never change the feature-level aggregate status. + * + * @param isConsoleUpload the value + * @return this builder + */ + public Builder isConsoleUpload(boolean isConsoleUpload) { + return set("is_console_upload", Conv.BOOLEAN, isConsoleUpload); + } + + /** + * Console uploads start false and flip true once the admin confirms them; end-user uploads are always true. + * + * @param isConfirmed the value + * @return this builder + */ + public Builder isConfirmed(boolean isConfirmed) { + return set("is_confirmed", Conv.BOOLEAN, isConfirmed); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Items} + */ + public Items build() { + return new Items(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * High-level KYB document group the file was classified into. null while unclassified. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "LEGAL_PRESENCE"}. */ + public static final DocumentType LEGAL_PRESENCE = new DocumentType("LEGAL_PRESENCE"); + + /** The value {@code "COMPANY_DETAILS"}. */ + public static final DocumentType COMPANY_DETAILS = new DocumentType("COMPANY_DETAILS"); + + /** The value {@code "OWNERSHIP_STRUCTURE"}. */ + public static final DocumentType OWNERSHIP_STRUCTURE = new DocumentType("OWNERSHIP_STRUCTURE"); + + /** The value {@code "REPRESENTATIVES_AUTHORIZATION"}. */ + public static final DocumentType REPRESENTATIVES_AUTHORIZATION = new DocumentType("REPRESENTATIVES_AUTHORIZATION"); + + /** The value {@code "OTHER"}. */ + public static final DocumentType OTHER = new DocumentType("OTHER"); + + private static final List KNOWN_VALUES = List.of(LEGAL_PRESENCE, COMPANY_DETAILS, OWNERSHIP_STRUCTURE, REPRESENTATIVES_AUTHORIZATION, OTHER); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Alias of document_type โ€” the group name used by groups and required_groups. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentGroup extends StringEnum { + /** The value {@code "LEGAL_PRESENCE"}. */ + public static final DocumentGroup LEGAL_PRESENCE = new DocumentGroup("LEGAL_PRESENCE"); + + /** The value {@code "COMPANY_DETAILS"}. */ + public static final DocumentGroup COMPANY_DETAILS = new DocumentGroup("COMPANY_DETAILS"); + + /** The value {@code "OWNERSHIP_STRUCTURE"}. */ + public static final DocumentGroup OWNERSHIP_STRUCTURE = new DocumentGroup("OWNERSHIP_STRUCTURE"); + + /** The value {@code "REPRESENTATIVES_AUTHORIZATION"}. */ + public static final DocumentGroup REPRESENTATIVES_AUTHORIZATION = new DocumentGroup("REPRESENTATIVES_AUTHORIZATION"); + + /** The value {@code "OTHER"}. */ + public static final DocumentGroup OTHER = new DocumentGroup("OTHER"); + + private static final List KNOWN_VALUES = List.of(LEGAL_PRESENCE, COMPANY_DETAILS, OWNERSHIP_STRUCTURE, REPRESENTATIVES_AUTHORIZATION, OTHER); + + private DocumentGroup(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentGroup of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentGroup::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-document verification status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "Not Finished"}. */ + public static final Status NOT_FINISHED = new Status("Not Finished"); + + /** The value {@code "Approved"}. */ + public static final Status APPROVED = new Status("Approved"); + + /** The value {@code "Declined"}. */ + public static final Status DECLINED = new Status("Declined"); + + /** The value {@code "In Review"}. */ + public static final Status IN_REVIEW = new Status("In Review"); + + /** The value {@code "Resub Requested"}. */ + public static final Status RESUB_REQUESTED = new Status("Resub Requested"); + + private static final List KNOWN_VALUES = List.of(NOT_FINISHED, APPROVED, DECLINED, IN_REVIEW, RESUB_REQUESTED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Metadata extracted from the uploaded corporate document. When metadata extraction succeeded, all 16 keys are always present (individual values are null when not applicable to the file type); the whole object is null when nothing could be extracted. For PDFs, overlay_manipulation carries forensic overlay-text analysis. + */ + public static final class DocumentMetadata extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("file_size", "content_type", "creation_date", "modified_date", "creator", "producer", "software", "encryption", "is_signed", "is_tampered", "signature_info", "exif_original_date", "exif_digitized_date", "processed_by_known_editor", "has_different_creation_mod_date", "overlay_manipulation"); + + private DocumentMetadata(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DocumentMetadata} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DocumentMetadata fromJson(JsonNode json) { + return new DocumentMetadata(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Size of the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + /** + * Content type of the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional contentType() { + return Json.optional(json, "content_type", Conv.STRING); + } + + /** + * Date when the document was created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional creationDate() { + return Json.optional(json, "creation_date", Conv.STRING); + } + + /** + * Date when the document was modified. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional modifiedDate() { + return Json.optional(json, "modified_date", Conv.STRING); + } + + /** + * Authoring tool/user recorded in the file metadata (PDF Creator). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional creator() { + return Json.optional(json, "creator", Conv.STRING); + } + + /** + * Software that produced the file (PDF Producer). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional producer() { + return Json.optional(json, "producer", Conv.STRING); + } + + /** + * Editing software recorded in the file metadata. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional software() { + return Json.optional(json, "software", Conv.STRING); + } + + /** + * Encryption scheme of the file, when encrypted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional encryption() { + return Json.optional(json, "encryption", Conv.STRING); + } + + /** + * Whether the document carries a digital signature. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSigned() { + return Json.optional(json, "is_signed", Conv.BOOLEAN); + } + + /** + * Whether the digital signature failed validation (post-signing modification). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isTampered() { + return Json.optional(json, "is_tampered", Conv.BOOLEAN); + } + + /** + * Details of the digital signature(s), when present. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signatureInfo() { + return Json.optional(json, "signature_info", Conv.OBJECT); + } + + /** + * EXIF original capture date, for image uploads. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exifOriginalDate() { + return Json.optional(json, "exif_original_date", Conv.STRING); + } + + /** + * EXIF digitization date, for image uploads. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exifDigitizedDate() { + return Json.optional(json, "exif_digitized_date", Conv.STRING); + } + + /** + * Whether metadata indicates the file passed through a known image/PDF editor. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processedByKnownEditor() { + return Json.optional(json, "processed_by_known_editor", Conv.BOOLEAN); + } + + /** + * Whether creation and modification dates differ โ€” a possible (but not conclusive) editing signal. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hasDifferentCreationModDate() { + return Json.optional(json, "has_different_creation_mod_date", Conv.BOOLEAN); + } + + /** + * PDF forensic analysis for suspected overlay-text manipulation. Null when no overlay manipulation evidence was found or the document was not a PDF. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional overlayManipulation() { + return Json.optional(json, "overlay_manipulation", Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata.OverlayManipulation::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DocumentMetadata}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DocumentMetadata from) { + super(from); + } + + /** + * Size of the document. + * + * @param fileSize the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileSize(@Nullable Long fileSize) { + return setNullable("file_size", Conv.LONG, fileSize); + } + + /** + * Content type of the document. + * + * @param contentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder contentType(@Nullable String contentType) { + return setNullable("content_type", Conv.STRING, contentType); + } + + /** + * Date when the document was created. + * + * @param creationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder creationDate(@Nullable String creationDate) { + return setNullable("creation_date", Conv.STRING, creationDate); + } + + /** + * Date when the document was modified. + * + * @param modifiedDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder modifiedDate(@Nullable String modifiedDate) { + return setNullable("modified_date", Conv.STRING, modifiedDate); + } + + /** + * Authoring tool/user recorded in the file metadata (PDF Creator). + * + * @param creator the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder creator(@Nullable String creator) { + return setNullable("creator", Conv.STRING, creator); + } + + /** + * Software that produced the file (PDF Producer). + * + * @param producer the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder producer(@Nullable String producer) { + return setNullable("producer", Conv.STRING, producer); + } + + /** + * Editing software recorded in the file metadata. + * + * @param software the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder software(@Nullable String software) { + return setNullable("software", Conv.STRING, software); + } + + /** + * Encryption scheme of the file, when encrypted. + * + * @param encryption the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder encryption(@Nullable String encryption) { + return setNullable("encryption", Conv.STRING, encryption); + } + + /** + * Whether the document carries a digital signature. + * + * @param isSigned the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isSigned(@Nullable Boolean isSigned) { + return setNullable("is_signed", Conv.BOOLEAN, isSigned); + } + + /** + * Whether the digital signature failed validation (post-signing modification). + * + * @param isTampered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder isTampered(@Nullable Boolean isTampered) { + return setNullable("is_tampered", Conv.BOOLEAN, isTampered); + } + + /** + * Details of the digital signature(s), when present. + * + * @param signatureInfo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder signatureInfo(@Nullable Map signatureInfo) { + return setAny("signature_info", signatureInfo); + } + + /** + * EXIF original capture date, for image uploads. + * + * @param exifOriginalDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder exifOriginalDate(@Nullable String exifOriginalDate) { + return setNullable("exif_original_date", Conv.STRING, exifOriginalDate); + } + + /** + * EXIF digitization date, for image uploads. + * + * @param exifDigitizedDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder exifDigitizedDate(@Nullable String exifDigitizedDate) { + return setNullable("exif_digitized_date", Conv.STRING, exifDigitizedDate); + } + + /** + * Whether metadata indicates the file passed through a known image/PDF editor. + * + * @param processedByKnownEditor the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder processedByKnownEditor(@Nullable Boolean processedByKnownEditor) { + return setNullable("processed_by_known_editor", Conv.BOOLEAN, processedByKnownEditor); + } + + /** + * Whether creation and modification dates differ โ€” a possible (but not conclusive) editing signal. + * + * @param hasDifferentCreationModDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder hasDifferentCreationModDate(@Nullable Boolean hasDifferentCreationModDate) { + return setNullable("has_different_creation_mod_date", Conv.BOOLEAN, hasDifferentCreationModDate); + } + + /** + * PDF forensic analysis for suspected overlay-text manipulation. Null when no overlay manipulation evidence was found or the document was not a PDF. + * + * @param overlayManipulation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder overlayManipulation(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata.@Nullable OverlayManipulation overlayManipulation) { + return setNullable("overlay_manipulation", Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata.OverlayManipulation::fromJson), overlayManipulation); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DocumentMetadata} + */ + public DocumentMetadata build() { + return new DocumentMetadata(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * PDF forensic analysis for suspected overlay-text manipulation. Null when no overlay manipulation evidence was found or the document was not a PDF. + */ + public static final class OverlayManipulation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detected", "analyzed", "signals", "manipulated_regions"); + + private OverlayManipulation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code OverlayManipulation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static OverlayManipulation fromJson(JsonNode json) { + return new OverlayManipulation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Whether overlay-text manipulation evidence was detected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detected() { + return Json.optional(json, "detected", Conv.BOOLEAN); + } + + /** + * Whether the PDF could be analyzed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional analyzed() { + return Json.optional(json, "analyzed", Conv.BOOLEAN); + } + + /** + * Forensic signals that fired, such as duplicate_font_subset or glyph_fragmentation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> signals() { + return Json.optional(json, "signals", Conv.list(Conv.STRING)); + } + + /** + * Suspected manipulated areas in PDF page coordinates. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> manipulatedRegions() { + return Json.optional(json, "manipulated_regions", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata.OverlayManipulation.ManipulatedRegions::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link OverlayManipulation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(OverlayManipulation from) { + super(from); + } + + /** + * Whether overlay-text manipulation evidence was detected. + * + * @param detected the value + * @return this builder + */ + public Builder detected(boolean detected) { + return set("detected", Conv.BOOLEAN, detected); + } + + /** + * Whether the PDF could be analyzed. + * + * @param analyzed the value + * @return this builder + */ + public Builder analyzed(boolean analyzed) { + return set("analyzed", Conv.BOOLEAN, analyzed); + } + + /** + * Forensic signals that fired, such as duplicate_font_subset or glyph_fragmentation. + * + * @param signals the value + * @return this builder + */ + public Builder signals(List signals) { + return set("signals", Conv.list(Conv.STRING), signals); + } + + /** + * Suspected manipulated areas in PDF page coordinates. + * + * @param manipulatedRegions the value + * @return this builder + */ + public Builder manipulatedRegions(List manipulatedRegions) { + return set("manipulated_regions", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.DocumentVerifications.Items.DocumentMetadata.OverlayManipulation.ManipulatedRegions::fromJson)), manipulatedRegions); + } + + /** + * Builds the value. + * + * @return a new immutable {@code OverlayManipulation} + */ + public OverlayManipulation build() { + return new OverlayManipulation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class ManipulatedRegions extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("page", "x", "y", "width", "height", "page_width", "page_height"); + + private ManipulatedRegions(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ManipulatedRegions} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ManipulatedRegions fromJson(JsonNode json) { + return new ManipulatedRegions(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The page field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional page() { + return Json.optional(json, "page", Conv.LONG); + } + + /** + * The x field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional x() { + return Json.optional(json, "x", Conv.DOUBLE); + } + + /** + * The y field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional y() { + return Json.optional(json, "y", Conv.DOUBLE); + } + + /** + * The width field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional width() { + return Json.optional(json, "width", Conv.DOUBLE); + } + + /** + * The height field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional height() { + return Json.optional(json, "height", Conv.DOUBLE); + } + + /** + * The page_width field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pageWidth() { + return Json.optional(json, "page_width", Conv.DOUBLE); + } + + /** + * The page_height field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pageHeight() { + return Json.optional(json, "page_height", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ManipulatedRegions}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ManipulatedRegions from) { + super(from); + } + + /** + * The page field. + * + * @param page the value + * @return this builder + */ + public Builder page(long page) { + return set("page", Conv.LONG, page); + } + + /** + * The x field. + * + * @param x the value + * @return this builder + */ + public Builder x(double x) { + return set("x", Conv.DOUBLE, x); + } + + /** + * The y field. + * + * @param y the value + * @return this builder + */ + public Builder y(double y) { + return set("y", Conv.DOUBLE, y); + } + + /** + * The width field. + * + * @param width the value + * @return this builder + */ + public Builder width(double width) { + return set("width", Conv.DOUBLE, width); + } + + /** + * The height field. + * + * @param height the value + * @return this builder + */ + public Builder height(double height) { + return set("height", Conv.DOUBLE, height); + } + + /** + * The page_width field. + * + * @param pageWidth the value + * @return this builder + */ + public Builder pageWidth(double pageWidth) { + return set("page_width", Conv.DOUBLE, pageWidth); + } + + /** + * The page_height field. + * + * @param pageHeight the value + * @return this builder + */ + public Builder pageHeight(double pageHeight) { + return set("page_height", Conv.DOUBLE, pageHeight); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ManipulatedRegions} + */ + public ManipulatedRegions build() { + return new ManipulatedRegions(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + } + + public static final class GroupsValue extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total", "approved", "pending", "declined", "in_review", "other", "missing"); + + private GroupsValue(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code GroupsValue} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static GroupsValue fromJson(JsonNode json) { + return new GroupsValue(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The approved field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approved() { + return Json.optional(json, "approved", Conv.LONG); + } + + /** + * The pending field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pending() { + return Json.optional(json, "pending", Conv.LONG); + } + + /** + * The declined field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declined() { + return Json.optional(json, "declined", Conv.LONG); + } + + /** + * The in_review field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inReview() { + return Json.optional(json, "in_review", Conv.LONG); + } + + /** + * The other field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional other() { + return Json.optional(json, "other", Conv.LONG); + } + + /** + * Requested placeholders with no file uploaded yet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional missing() { + return Json.optional(json, "missing", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link GroupsValue}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(GroupsValue from) { + super(from); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The approved field. + * + * @param approved the value + * @return this builder + */ + public Builder approved(long approved) { + return set("approved", Conv.LONG, approved); + } + + /** + * The pending field. + * + * @param pending the value + * @return this builder + */ + public Builder pending(long pending) { + return set("pending", Conv.LONG, pending); + } + + /** + * The declined field. + * + * @param declined the value + * @return this builder + */ + public Builder declined(long declined) { + return set("declined", Conv.LONG, declined); + } + + /** + * The in_review field. + * + * @param inReview the value + * @return this builder + */ + public Builder inReview(long inReview) { + return set("in_review", Conv.LONG, inReview); + } + + /** + * The other field. + * + * @param other the value + * @return this builder + */ + public Builder other(long other) { + return set("other", Conv.LONG, other); + } + + /** + * Requested placeholders with no file uploaded yet. + * + * @param missing the value + * @return this builder + */ + public Builder missing(long missing) { + return set("missing", Conv.LONG, missing); + } + + /** + * Builds the value. + * + * @return a new immutable {@code GroupsValue} + */ + public GroupsValue build() { + return new GroupsValue(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Whether the session was created by a live application (live) or a sandbox application (sandbox). Sandbox sessions are free, fully simulated, and never bill credits. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Environment extends StringEnum { + /** The value {@code "live"}. */ + public static final Environment LIVE = new Environment("live"); + + /** The value {@code "sandbox"}. */ + public static final Environment SANDBOX = new Environment("sandbox"); + + private static final List KNOWN_VALUES = List.of(LIVE, SANDBOX); + + private Environment(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Environment of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Environment::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Resubmissions extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("number", "created_at", "previous_status", "nodes", "reasons", "requested_by", "results"); + + private Resubmissions(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Resubmissions} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Resubmissions fromJson(JsonNode json) { + return new Resubmissions(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * 1 for the first resubmission of the session, 2 for the second, and so on. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional number() { + return Json.optional(json, "number", Conv.LONG); + } + + /** + * When the resubmission was requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The session status just before the request. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previousStatus() { + return Json.optional(json, "previous_status", Conv.STRING); + } + + /** + * The workflow steps sent back to the user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> nodes() { + return Json.optional(json, "nodes", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.Resubmissions.Nodes::fromJson))); + } + + /** + * The reason given for each step, keyed by node_id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reasons() { + return Json.optional(json, "reasons", Conv.map(Conv.STRING)); + } + + /** + * Who requested the resubmission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requestedBy() { + return Json.optional(json, "requested_by", Conv.model(SessionsRetrieveDecisionResponse.Resubmissions.RequestedBy::fromJson)); + } + + /** + * What the resubmitted steps returned before the request, under the same keys and in the same shape as the current results of this response (id_verifications, nfc_verifications, liveness_checks, face_matches, poa_verifications, phone_verifications, email_verifications, aml_screenings, ip_analyses, database_validations, questionnaire_responses, document_ai_documents, geolocation_checks; for business sessions also document_verifications). Only the keys of the steps that were sent back appear. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Resubmissions}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Resubmissions from) { + super(from); + } + + /** + * 1 for the first resubmission of the session, 2 for the second, and so on. + * + * @param number the value + * @return this builder + */ + public Builder number(long number) { + return set("number", Conv.LONG, number); + } + + /** + * When the resubmission was requested. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The session status just before the request. + * + * @param previousStatus the value + * @return this builder + */ + public Builder previousStatus(String previousStatus) { + return set("previous_status", Conv.STRING, previousStatus); + } + + /** + * The workflow steps sent back to the user. + * + * @param nodes the value + * @return this builder + */ + public Builder nodes(List nodes) { + return set("nodes", Conv.list(Conv.model(SessionsRetrieveDecisionResponse.Resubmissions.Nodes::fromJson)), nodes); + } + + /** + * The reason given for each step, keyed by node_id. + * + * @param reasons the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder reasons(@Nullable Map reasons) { + return setNullable("reasons", Conv.map(Conv.STRING), reasons); + } + + /** + * Who requested the resubmission. + * + * @param requestedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder requestedBy(SessionsRetrieveDecisionResponse.Resubmissions.@Nullable RequestedBy requestedBy) { + return setNullable("requested_by", Conv.model(SessionsRetrieveDecisionResponse.Resubmissions.RequestedBy::fromJson), requestedBy); + } + + /** + * What the resubmitted steps returned before the request, under the same keys and in the same shape as the current results of this response (id_verifications, nfc_verifications, liveness_checks, face_matches, poa_verifications, phone_verifications, email_verifications, aml_screenings, ip_analyses, database_validations, questionnaire_responses, document_ai_documents, geolocation_checks; for business sessions also document_verifications). Only the keys of the steps that were sent back appear. + * + * @param results the value + * @return this builder + */ + public Builder results(Map results) { + return setAny("results", results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Resubmissions} + */ + public Resubmissions build() { + return new Resubmissions(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Nodes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "feature"); + + private Nodes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Nodes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Nodes fromJson(JsonNode json) { + return new Nodes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * The feature field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Nodes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Nodes from) { + super(from); + } + + /** + * The node_id field. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * The feature field. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Nodes} + */ + public Nodes build() { + return new Nodes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Who requested the resubmission. */ + public static final class RequestedBy extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "email", "type"); + + private RequestedBy(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RequestedBy} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RequestedBy fromJson(JsonNode json) { + return new RequestedBy(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RequestedBy}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RequestedBy from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The email field. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(String type) { + return set("type", Conv.STRING, type); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RequestedBy} + */ + public RequestedBy build() { + return new RequestedBy(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsRetrieveDeletionJobResponse.java b/src/main/java/me/didit/types/SessionsRetrieveDeletionJobResponse.java new file mode 100644 index 0000000..39bd7b4 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsRetrieveDeletionJobResponse.java @@ -0,0 +1,499 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * A bulk session deletion running in the background: progress and counts per outcome, never which sessions it deleted. + */ +public final class SessionsRetrieveDeletionJobResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "total", "processed", "outcomes", "deleted_child_verifications", "error", "created_at", "completed_at"); + + private SessionsRetrieveDeletionJobResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsRetrieveDeletionJobResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsRetrieveDeletionJobResponse fromJson(JsonNode json) { + return new SessionsRetrieveDeletionJobResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Poll GET /v3/sessions/delete/{job_id}/ with this id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * PENDING: accepted, not started yet. PROCESSING: deleting; processed and outcomes are updating. COMPLETED: every selected session is accounted for. FAILED: the job stopped early; see error. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SessionsRetrieveDeletionJobResponse.Status::of)); + } + + /** + * Sessions selected when the deletion was requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * Sessions the job has finished with so far. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * How many sessions ended in each outcome. Every key is always present. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(SessionsRetrieveDeletionJobResponse.Outcomes::fromJson)); + } + + /** + * Verifications that the deleted business verifications created, deleted with them. Always 0 for a job started by POST /v3/sessions/delete/, which deletes KYC sessions only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deletedChildVerifications() { + return Json.optional(json, "deleted_child_verifications", Conv.LONG); + } + + /** + * null unless status is FAILED; then why the deletion stopped. The sessions the job had not reached are still in place: repeat the request to delete them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * When the deletion was requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * When the job finished; null while it runs. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsRetrieveDeletionJobResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsRetrieveDeletionJobResponse from) { + super(from); + } + + /** + * Poll GET /v3/sessions/delete/{job_id}/ with this id. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * PENDING: accepted, not started yet. PROCESSING: deleting; processed and outcomes are updating. COMPLETED: every selected session is accounted for. FAILED: the job stopped early; see error. + * + * @param status the value + * @return this builder + */ + public Builder status(SessionsRetrieveDeletionJobResponse.Status status) { + return set("status", Conv.enumeration(SessionsRetrieveDeletionJobResponse.Status::of), status); + } + + /** + * Sessions selected when the deletion was requested. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Sessions the job has finished with so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * How many sessions ended in each outcome. Every key is always present. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(SessionsRetrieveDeletionJobResponse.Outcomes outcomes) { + return set("outcomes", Conv.model(SessionsRetrieveDeletionJobResponse.Outcomes::fromJson), outcomes); + } + + /** + * Verifications that the deleted business verifications created, deleted with them. Always 0 for a job started by POST /v3/sessions/delete/, which deletes KYC sessions only. + * + * @param deletedChildVerifications the value + * @return this builder + */ + public Builder deletedChildVerifications(long deletedChildVerifications) { + return set("deleted_child_verifications", Conv.LONG, deletedChildVerifications); + } + + /** + * null unless status is FAILED; then why the deletion stopped. The sessions the job had not reached are still in place: repeat the request to delete them. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * When the deletion was requested. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * When the job finished; null while it runs. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsRetrieveDeletionJobResponse} + */ + public SessionsRetrieveDeletionJobResponse build() { + return new SessionsRetrieveDeletionJobResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * PENDING: accepted, not started yet. PROCESSING: deleting; processed and outcomes are updating. COMPLETED: every selected session is accounted for. FAILED: the job stopped early; see error. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** How many sessions ended in each outcome. Every key is always present. */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("deleted", "none", "retained_with_user", "ineligible_no_vendor_user", "failed_retryable", "already_deleted"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Sessions deleted together with their face embedding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleted() { + return Json.optional(json, "deleted", Conv.LONG); + } + + /** + * Sessions deleted that had no face embedding. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional none() { + return Json.optional(json, "none", Conv.LONG); + } + + /** + * Sessions deleted while one image-free biometric template was retained for their User, as the request or the application policy asked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retainedWithUser() { + return Json.optional(json, "retained_with_user", Conv.LONG); + } + + /** + * Sessions deleted, with their face embedding, because retention was requested but they had no linked User. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ineligibleNoVendorUser() { + return Json.optional(json, "ineligible_no_vendor_user", Conv.LONG); + } + + /** + * Sessions reported as not deleted. A job retries a group it could not delete by itself instead of counting it here. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedRetryable() { + return Json.optional(json, "failed_retryable", Conv.LONG); + } + + /** + * Selected sessions that were already deleted, for example by another request, when the job reached them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyDeleted() { + return Json.optional(json, "already_deleted", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Sessions deleted together with their face embedding. + * + * @param deleted the value + * @return this builder + */ + public Builder deleted(long deleted) { + return set("deleted", Conv.LONG, deleted); + } + + /** + * Sessions deleted that had no face embedding. + * + * @param none the value + * @return this builder + */ + public Builder none(long none) { + return set("none", Conv.LONG, none); + } + + /** + * Sessions deleted while one image-free biometric template was retained for their User, as the request or the application policy asked. + * + * @param retainedWithUser the value + * @return this builder + */ + public Builder retainedWithUser(long retainedWithUser) { + return set("retained_with_user", Conv.LONG, retainedWithUser); + } + + /** + * Sessions deleted, with their face embedding, because retention was requested but they had no linked User. + * + * @param ineligibleNoVendorUser the value + * @return this builder + */ + public Builder ineligibleNoVendorUser(long ineligibleNoVendorUser) { + return set("ineligible_no_vendor_user", Conv.LONG, ineligibleNoVendorUser); + } + + /** + * Sessions reported as not deleted. A job retries a group it could not delete by itself instead of counting it here. + * + * @param failedRetryable the value + * @return this builder + */ + public Builder failedRetryable(long failedRetryable) { + return set("failed_retryable", Conv.LONG, failedRetryable); + } + + /** + * Selected sessions that were already deleted, for example by another request, when the job reached them. + * + * @param alreadyDeleted the value + * @return this builder + */ + public Builder alreadyDeleted(long alreadyDeleted) { + return set("already_deleted", Conv.LONG, alreadyDeleted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsReviewsCreateParams.java b/src/main/java/me/didit/types/SessionsReviewsCreateParams.java new file mode 100644 index 0000000..f3fea21 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsReviewsCreateParams.java @@ -0,0 +1,188 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.reviews.create}. */ +public final class SessionsReviewsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("new_status", "comment"); + + private SessionsReviewsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsReviewsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsReviewsCreateParams fromJson(JsonNode json) { + return new SessionsReviewsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Optional status label to record on the entry. Accepts any session status value, case-sensitive ("approved" is rejected with 400). Recording a status here does not change the session's actual status โ€” use the update-status endpoint for that. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.enumeration(SessionsReviewsCreateParams.NewStatus::of)); + } + + /** + * Optional free-text note (no enforced length limit). Stored verbatim; @email mentions are not processed on this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsReviewsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsReviewsCreateParams from) { + super(from); + } + + /** + * Optional status label to record on the entry. Accepts any session status value, case-sensitive ("approved" is rejected with 400). Recording a status here does not change the session's actual status โ€” use the update-status endpoint for that. + * + * @param newStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newStatus(SessionsReviewsCreateParams.@Nullable NewStatus newStatus) { + return setNullable("new_status", Conv.enumeration(SessionsReviewsCreateParams.NewStatus::of), newStatus); + } + + /** + * Optional free-text note (no enforced length limit). Stored verbatim; @email mentions are not processed on this endpoint. + * + * @param comment the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder comment(@Nullable String comment) { + return setNullable("comment", Conv.STRING, comment); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsReviewsCreateParams} + */ + public SessionsReviewsCreateParams build() { + return new SessionsReviewsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Optional status label to record on the entry. Accepts any session status value, case-sensitive ("approved" is rejected with 400). Recording a status here does not change the session's actual status โ€” use the update-status endpoint for that. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final NewStatus NOT_STARTED = new NewStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final NewStatus IN_PROGRESS = new NewStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final NewStatus APPROVED = new NewStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final NewStatus DECLINED = new NewStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final NewStatus IN_REVIEW = new NewStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final NewStatus EXPIRED = new NewStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final NewStatus ABANDONED = new NewStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final NewStatus KYC_EXPIRED = new NewStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final NewStatus RESUBMITTED = new NewStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final NewStatus AWAITING_USER = new NewStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsReviewsCreateResponse.java b/src/main/java/me/didit/types/SessionsReviewsCreateResponse.java new file mode 100644 index 0000000..d75e7f3 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsReviewsCreateResponse.java @@ -0,0 +1,228 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsReviewsCreateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("user", "new_status", "comment", "created_at"); + + private SessionsReviewsCreateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsReviewsCreateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsReviewsCreateResponse fromJson(JsonNode json) { + return new SessionsReviewsCreateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Display name of the entry's author. Always "Unknown" for entries created through this endpoint, because it records no actor attribution. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional user() { + return Json.optional(json, "user", Conv.STRING); + } + + /** + * The status label recorded on the entry, or null if none was sent. The session's actual status is not affected. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.enumeration(SessionsReviewsCreateResponse.NewStatus::of)); + } + + /** + * The note recorded on the entry, or null if none was sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * When the entry was written, ISO 8601 UTC. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsReviewsCreateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsReviewsCreateResponse from) { + super(from); + } + + /** + * Display name of the entry's author. Always "Unknown" for entries created through this endpoint, because it records no actor attribution. + * + * @param user the value + * @return this builder + */ + public Builder user(String user) { + return set("user", Conv.STRING, user); + } + + /** + * The status label recorded on the entry, or null if none was sent. The session's actual status is not affected. + * + * @param newStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newStatus(SessionsReviewsCreateResponse.@Nullable NewStatus newStatus) { + return setNullable("new_status", Conv.enumeration(SessionsReviewsCreateResponse.NewStatus::of), newStatus); + } + + /** + * The note recorded on the entry, or null if none was sent. + * + * @param comment the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder comment(@Nullable String comment) { + return setNullable("comment", Conv.STRING, comment); + } + + /** + * When the entry was written, ISO 8601 UTC. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsReviewsCreateResponse} + */ + public SessionsReviewsCreateResponse build() { + return new SessionsReviewsCreateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The status label recorded on the entry, or null if none was sent. The session's actual status is not affected. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "Not Started"}. */ + public static final NewStatus NOT_STARTED = new NewStatus("Not Started"); + + /** The value {@code "In Progress"}. */ + public static final NewStatus IN_PROGRESS = new NewStatus("In Progress"); + + /** The value {@code "Approved"}. */ + public static final NewStatus APPROVED = new NewStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final NewStatus DECLINED = new NewStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final NewStatus IN_REVIEW = new NewStatus("In Review"); + + /** The value {@code "Expired"}. */ + public static final NewStatus EXPIRED = new NewStatus("Expired"); + + /** The value {@code "Abandoned"}. */ + public static final NewStatus ABANDONED = new NewStatus("Abandoned"); + + /** The value {@code "Kyc Expired"}. */ + public static final NewStatus KYC_EXPIRED = new NewStatus("Kyc Expired"); + + /** The value {@code "Resubmitted"}. */ + public static final NewStatus RESUBMITTED = new NewStatus("Resubmitted"); + + /** The value {@code "Awaiting User"}. */ + public static final NewStatus AWAITING_USER = new NewStatus("Awaiting User"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, APPROVED, DECLINED, IN_REVIEW, EXPIRED, ABANDONED, KYC_EXPIRED, RESUBMITTED, AWAITING_USER); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsReviewsListParams.java b/src/main/java/me/didit/types/SessionsReviewsListParams.java new file mode 100644 index 0000000..f009c83 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsReviewsListParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code sessions.reviews.list}. */ +public final class SessionsReviewsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset", "ordering"); + + private SessionsReviewsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsReviewsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsReviewsListParams fromJson(JsonNode json) { + return new SessionsReviewsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. Defaults to 50. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Number of entries to skip from the start of the (ordered) feed. Defaults to 0. The next / previous URLs in the response carry the right values for walking the feed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + /** + * Sort order. The feed defaults to newest first (-created_at); pass created_at to read it oldest first. Unknown values are silently ignored (default order is used); other serializer field names are also accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsReviewsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsReviewsListParams from) { + super(from); + } + + /** + * Page size. Defaults to 50. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Number of entries to skip from the start of the (ordered) feed. Defaults to 0. The next / previous URLs in the response carry the right values for walking the feed. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Sort order. The feed defaults to newest first (-created_at); pass created_at to read it oldest first. Unknown values are silently ignored (default order is used); other serializer field names are also accepted. + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsReviewsListParams} + */ + public SessionsReviewsListParams build() { + return new SessionsReviewsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsReviewsListResponse.java b/src/main/java/me/didit/types/SessionsReviewsListResponse.java new file mode 100644 index 0000000..1e22a3b --- /dev/null +++ b/src/main/java/me/didit/types/SessionsReviewsListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class SessionsReviewsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private SessionsReviewsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsReviewsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsReviewsListResponse fromJson(JsonNode json) { + return new SessionsReviewsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Total number of feed entries for this session (across all pages). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * Feed entries for this page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(ReviewItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsReviewsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsReviewsListResponse from) { + super(from); + } + + /** + * Total number of feed entries for this session (across all pages). + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * Feed entries for this page. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(ReviewItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsReviewsListResponse} + */ + public SessionsReviewsListResponse build() { + return new SessionsReviewsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsShareParams.java b/src/main/java/me/didit/types/SessionsShareParams.java new file mode 100644 index 0000000..c3fc3fe --- /dev/null +++ b/src/main/java/me/didit/types/SessionsShareParams.java @@ -0,0 +1,121 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code sessions.share}. */ +public final class SessionsShareParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("for_application_id", "ttl_in_seconds"); + + private SessionsShareParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsShareParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsShareParams fromJson(JsonNode json) { + return new SessionsShareParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * UUID of the Didit application that will redeem the token. Must exist, must not be deleted, and must differ from the calling application. Find it in the Business Console under Settings โ†’ Application. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String forApplicationId() { + return Json.required(json, "for_application_id", Conv.STRING); + } + + /** + * Token lifetime, in seconds. Minimum 60, maximum 86400 (24 h). Defaults to 3600 (1 h). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ttlInSeconds() { + return Json.optional(json, "ttl_in_seconds", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsShareParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsShareParams from) { + super(from); + } + + /** + * UUID of the Didit application that will redeem the token. Must exist, must not be deleted, and must differ from the calling application. Find it in the Business Console under Settings โ†’ Application. + * + * @param forApplicationId the value + * @return this builder + */ + public Builder forApplicationId(String forApplicationId) { + return set("for_application_id", Conv.STRING, forApplicationId); + } + + /** + * Token lifetime, in seconds. Minimum 60, maximum 86400 (24 h). Defaults to 3600 (1 h). + * + * @param ttlInSeconds the value + * @return this builder + */ + public Builder ttlInSeconds(long ttlInSeconds) { + return set("ttl_in_seconds", Conv.LONG, ttlInSeconds); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsShareParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsShareParams build() { + require("for_application_id", false); + return new SessionsShareParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsShareResponse.java b/src/main/java/me/didit/types/SessionsShareResponse.java new file mode 100644 index 0000000..37014bc --- /dev/null +++ b/src/main/java/me/didit/types/SessionsShareResponse.java @@ -0,0 +1,182 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class SessionsShareResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("share_token", "for_application_id", "session_kind"); + + private SessionsShareResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsShareResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsShareResponse fromJson(JsonNode json) { + return new SessionsShareResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * HS256-signed JWT. Pass this verbatim as share_token to [POST /v3/session/import-shared/](/sessions-api/import-shared-session) on the target application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional shareToken() { + return Json.optional(json, "share_token", Conv.STRING); + } + + /** + * Echoes the target application UUID that the token is bound to. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional forApplicationId() { + return Json.optional(json, "for_application_id", Conv.STRING); + } + + /** + * Whether the source session is a User Verification (KYC) or Business Verification (KYB) session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionKind() { + return Json.optional(json, "session_kind", Conv.enumeration(SessionsShareResponse.SessionKind::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsShareResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsShareResponse from) { + super(from); + } + + /** + * HS256-signed JWT. Pass this verbatim as share_token to [POST /v3/session/import-shared/](/sessions-api/import-shared-session) on the target application. + * + * @param shareToken the value + * @return this builder + */ + public Builder shareToken(String shareToken) { + return set("share_token", Conv.STRING, shareToken); + } + + /** + * Echoes the target application UUID that the token is bound to. + * + * @param forApplicationId the value + * @return this builder + */ + public Builder forApplicationId(String forApplicationId) { + return set("for_application_id", Conv.STRING, forApplicationId); + } + + /** + * Whether the source session is a User Verification (KYC) or Business Verification (KYB) session. + * + * @param sessionKind the value + * @return this builder + */ + public Builder sessionKind(SessionsShareResponse.SessionKind sessionKind) { + return set("session_kind", Conv.enumeration(SessionsShareResponse.SessionKind::of), sessionKind); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsShareResponse} + */ + public SessionsShareResponse build() { + return new SessionsShareResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the source session is a User Verification (KYC) or Business Verification (KYB) session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class SessionKind extends StringEnum { + /** The value {@code "user"}. */ + public static final SessionKind USER = new SessionKind("user"); + + /** The value {@code "business"}. */ + public static final SessionKind BUSINESS = new SessionKind("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private SessionKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static SessionKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, SessionKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateAmlHitStatusParams.java b/src/main/java/me/didit/types/SessionsUpdateAmlHitStatusParams.java new file mode 100644 index 0000000..ee877ab --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateAmlHitStatusParams.java @@ -0,0 +1,212 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.update_aml_hit_status}. */ +public final class SessionsUpdateAmlHitStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id_query", "hit_id", "review_status", "node_id"); + + private SessionsUpdateAmlHitStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateAmlHitStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateAmlHitStatusParams fromJson(JsonNode json) { + return new SessionsUpdateAmlHitStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node ID. Required only when the session has multiple AML checks (one per node); omit it for single-AML sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeIdQuery() { + return Json.optional(json, "node_id_query", Conv.STRING); + } + + /** + * The id of the hit in the AML check's hits array. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String hitId() { + return Json.required(json, "hit_id", Conv.STRING); + } + + /** + * The new review status for the hit. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsUpdateAmlHitStatusParams.ReviewStatus reviewStatus() { + return Json.required(json, "review_status", Conv.enumeration(SessionsUpdateAmlHitStatusParams.ReviewStatus::of)); + } + + /** + * Optional graph node ID. Use it (here or as a query parameter) when the session has multiple AML checks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateAmlHitStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateAmlHitStatusParams from) { + super(from); + } + + /** + * Workflow graph node ID. Required only when the session has multiple AML checks (one per node); omit it for single-AML sessions. + * + * @param nodeIdQuery the value + * @return this builder + */ + public Builder nodeIdQuery(String nodeIdQuery) { + return set("node_id_query", Conv.STRING, nodeIdQuery); + } + + /** + * The id of the hit in the AML check's hits array. + * + * @param hitId the value + * @return this builder + */ + public Builder hitId(String hitId) { + return set("hit_id", Conv.STRING, hitId); + } + + /** + * The new review status for the hit. + * + * @param reviewStatus the value + * @return this builder + */ + public Builder reviewStatus(SessionsUpdateAmlHitStatusParams.ReviewStatus reviewStatus) { + return set("review_status", Conv.enumeration(SessionsUpdateAmlHitStatusParams.ReviewStatus::of), reviewStatus); + } + + /** + * Optional graph node ID. Use it (here or as a query parameter) when the session has multiple AML checks. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateAmlHitStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsUpdateAmlHitStatusParams build() { + require("hit_id", false); + require("review_status", false); + return new SessionsUpdateAmlHitStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * The new review status for the hit. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReviewStatus extends StringEnum { + /** The value {@code "Unreviewed"}. */ + public static final ReviewStatus UNREVIEWED = new ReviewStatus("Unreviewed"); + + /** The value {@code "Confirmed Match"}. */ + public static final ReviewStatus CONFIRMED_MATCH = new ReviewStatus("Confirmed Match"); + + /** The value {@code "False Positive"}. */ + public static final ReviewStatus FALSE_POSITIVE = new ReviewStatus("False Positive"); + + /** The value {@code "Inconclusive"}. */ + public static final ReviewStatus INCONCLUSIVE = new ReviewStatus("Inconclusive"); + + private static final List KNOWN_VALUES = List.of(UNREVIEWED, CONFIRMED_MATCH, FALSE_POSITIVE, INCONCLUSIVE); + + private ReviewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReviewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReviewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateDataParams.java b/src/main/java/me/didit/types/SessionsUpdateDataParams.java new file mode 100644 index 0000000..0457fc5 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateDataParams.java @@ -0,0 +1,821 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.update_data}. */ +public final class SessionsUpdateDataParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "document_type", "document_subtype", "document_number", "personal_number", "date_of_birth", "date_of_issue", "expiration_date", "issuing_state", "first_name", "last_name", "gender", "address", "place_of_birth", "nationality", "marital_status", "extra_fields", "parsed_address"); + + private SessionsUpdateDataParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateDataParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateDataParams fromJson(JsonNode json) { + return new SessionsUpdateDataParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node whose KYC record to patch, for graph workflows with multiple ID-verification steps (also accepted as a node_id body field). When omitted, the most recent KYC record on the session is patched. If no KYC exists for the given node, the call returns 404 ("The session does not have a KYC for node '<node_id>'."). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Document type code. Accepts the short codes listed in the enum, plus six long-form aliases normalized server-side before validation: Passport โ†’ P, Identity Card โ†’ ID, Driver's License โ†’ DL, Residence Permit โ†’ RP, Health Insurance Card โ†’ HIC, Tax Card โ†’ TC. Any other value (including PASSPORT in caps) returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(SessionsUpdateDataParams.DocumentType::of)); + } + + /** + * Document subtype from the document registry, including the region prefix when the registry distinguishes regional variants. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * Document number as printed on the ID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * Personal / national identification number where the document carries one (e.g. Spanish DNI on a passport). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * Date of birth in YYYY-MM-DD. Any other format returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Issue date of the document in YYYY-MM-DD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfIssue() { + return Json.optional(json, "date_of_issue", Conv.DATE); + } + + /** + * Expiration date of the document in YYYY-MM-DD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * Issuing country as an ISO 3166-1 alpha-3 code. Case-insensitive (esp is stored as ESP); the human-readable issuing_state_name shown in [Get Decision](#get-/v3/session/-sessionId-/decision/) is recomputed from this value. Invalid codes return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * Given name(s). The stored full_name is recomputed as first_name + ' ' + last_name on every call to this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name(s). Also feeds the recomputed full_name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Sex as printed on the document: M (male), F (female), or U (unknown). Any other value โ€” including X โ€” returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.enumeration(SessionsUpdateDataParams.Gender::of)); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it synchronously before responding โ€” the 200 body already reflects the refreshed parsed_address. The re-geocode also requires issuing_state to be present on the KYC record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Place of birth as printed on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + /** + * Nationality as printed on the document. Free text up to 32 characters โ€” typically an ISO 3166-1 alpha-3 code (e.g. ESP), but not validated as one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Marital status where the document carries it. Any other value returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maritalStatus() { + return Json.optional(json, "marital_status", Conv.enumeration(SessionsUpdateDataParams.MaritalStatus::of)); + } + + /** + * Per-key overrides for document-specific extra fields (e.g. blood_group, dl_categories, mrz_string). Keys are merged into the existing override map: send a key with a value to set it, or with null / "" to remove that key from the merged view. Send the whole field as null to clear all previously applied overrides. Must be a JSON object, otherwise 400. The response always returns the merged view (OCR-extracted values with your overrides applied). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFields() { + return Json.optional(json, "extra_fields", Conv.OBJECT); + } + + /** + * Structured address. Only these nested keys are accepted: address_type, city, region, street_1, street_2, postal_code, country โ€” any other key returns 400. Per-key semantics: a value sets the key, null removes it. formatted_address is recomputed server-side by joining street_1, street_2, city, region, postal_code, and country and is returned in the response โ€” you cannot set it directly. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional parsedAddress() { + return Json.optional(json, "parsed_address", Conv.model(SessionsUpdateDataParams.ParsedAddress::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateDataParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateDataParams from) { + super(from); + } + + /** + * Workflow graph node whose KYC record to patch, for graph workflows with multiple ID-verification steps (also accepted as a node_id body field). When omitted, the most recent KYC record on the session is patched. If no KYC exists for the given node, the call returns 404 ("The session does not have a KYC for node '<node_id>'."). + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Document type code. Accepts the short codes listed in the enum, plus six long-form aliases normalized server-side before validation: Passport โ†’ P, Identity Card โ†’ ID, Driver's License โ†’ DL, Residence Permit โ†’ RP, Health Insurance Card โ†’ HIC, Tax Card โ†’ TC. Any other value (including PASSPORT in caps) returns 400. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(SessionsUpdateDataParams.@Nullable DocumentType documentType) { + return setNullable("document_type", Conv.enumeration(SessionsUpdateDataParams.DocumentType::of), documentType); + } + + /** + * Document subtype from the document registry, including the region prefix when the registry distinguishes regional variants. + * + * @param documentSubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSubtype(@Nullable String documentSubtype) { + return setNullable("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * Document number as printed on the ID. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Personal / national identification number where the document carries one (e.g. Spanish DNI on a passport). + * + * @param personalNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder personalNumber(@Nullable String personalNumber) { + return setNullable("personal_number", Conv.STRING, personalNumber); + } + + /** + * Date of birth in YYYY-MM-DD. Any other format returns 400. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Issue date of the document in YYYY-MM-DD. + * + * @param dateOfIssue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfIssue(@Nullable LocalDate dateOfIssue) { + return setNullable("date_of_issue", Conv.DATE, dateOfIssue); + } + + /** + * Expiration date of the document in YYYY-MM-DD. + * + * @param expirationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expirationDate(@Nullable LocalDate expirationDate) { + return setNullable("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Issuing country as an ISO 3166-1 alpha-3 code. Case-insensitive (esp is stored as ESP); the human-readable issuing_state_name shown in [Get Decision](#get-/v3/session/-sessionId-/decision/) is recomputed from this value. Invalid codes return 400. + * + * @param issuingState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingState(@Nullable String issuingState) { + return setNullable("issuing_state", Conv.STRING, issuingState); + } + + /** + * Given name(s). The stored full_name is recomputed as first_name + ' ' + last_name on every call to this endpoint. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name(s). Also feeds the recomputed full_name. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Sex as printed on the document: M (male), F (female), or U (unknown). Any other value โ€” including X โ€” returns 400. + * + * @param gender the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder gender(SessionsUpdateDataParams.@Nullable Gender gender) { + return setNullable("gender", Conv.enumeration(SessionsUpdateDataParams.Gender::of), gender); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it synchronously before responding โ€” the 200 body already reflects the refreshed parsed_address. The re-geocode also requires issuing_state to be present on the KYC record. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Place of birth as printed on the document. + * + * @param placeOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder placeOfBirth(@Nullable String placeOfBirth) { + return setNullable("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * Nationality as printed on the document. Free text up to 32 characters โ€” typically an ISO 3166-1 alpha-3 code (e.g. ESP), but not validated as one. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * Marital status where the document carries it. Any other value returns 400. + * + * @param maritalStatus the value + * @return this builder + */ + public Builder maritalStatus(SessionsUpdateDataParams.MaritalStatus maritalStatus) { + return set("marital_status", Conv.enumeration(SessionsUpdateDataParams.MaritalStatus::of), maritalStatus); + } + + /** + * Per-key overrides for document-specific extra fields (e.g. blood_group, dl_categories, mrz_string). Keys are merged into the existing override map: send a key with a value to set it, or with null / "" to remove that key from the merged view. Send the whole field as null to clear all previously applied overrides. Must be a JSON object, otherwise 400. The response always returns the merged view (OCR-extracted values with your overrides applied). + * + * @param extraFields the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder extraFields(@Nullable Map extraFields) { + return setAny("extra_fields", extraFields); + } + + /** + * Structured address. Only these nested keys are accepted: address_type, city, region, street_1, street_2, postal_code, country โ€” any other key returns 400. Per-key semantics: a value sets the key, null removes it. formatted_address is recomputed server-side by joining street_1, street_2, city, region, postal_code, and country and is returned in the response โ€” you cannot set it directly. + * + * @param parsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder parsedAddress(SessionsUpdateDataParams.@Nullable ParsedAddress parsedAddress) { + return setNullable("parsed_address", Conv.model(SessionsUpdateDataParams.ParsedAddress::fromJson), parsedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateDataParams} + */ + public SessionsUpdateDataParams build() { + return new SessionsUpdateDataParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Document type code. Accepts the short codes listed in the enum, plus six long-form aliases normalized server-side before validation: Passport โ†’ P, Identity Card โ†’ ID, Driver's License โ†’ DL, Residence Permit โ†’ RP, Health Insurance Card โ†’ HIC, Tax Card โ†’ TC. Any other value (including PASSPORT in caps) returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "P"}. */ + public static final DocumentType P = new DocumentType("P"); + + /** The value {@code "DL"}. */ + public static final DocumentType DL = new DocumentType("DL"); + + /** The value {@code "ID"}. */ + public static final DocumentType ID = new DocumentType("ID"); + + /** The value {@code "RP"}. */ + public static final DocumentType RP = new DocumentType("RP"); + + /** The value {@code "SSC"}. */ + public static final DocumentType SSC = new DocumentType("SSC"); + + /** The value {@code "HIC"}. */ + public static final DocumentType HIC = new DocumentType("HIC"); + + /** The value {@code "WP"}. */ + public static final DocumentType WP = new DocumentType("WP"); + + /** The value {@code "TC"}. */ + public static final DocumentType TC = new DocumentType("TC"); + + /** The value {@code "VISA"}. */ + public static final DocumentType VISA = new DocumentType("VISA"); + + /** The value {@code "PSC"}. */ + public static final DocumentType PSC = new DocumentType("PSC"); + + /** The value {@code "BC"}. */ + public static final DocumentType BC = new DocumentType("BC"); + + /** The value {@code "OTHER"}. */ + public static final DocumentType OTHER = new DocumentType("OTHER"); + + private static final List KNOWN_VALUES = List.of(P, DL, ID, RP, SSC, HIC, WP, TC, VISA, PSC, BC, OTHER); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Sex as printed on the document: M (male), F (female), or U (unknown). Any other value โ€” including X โ€” returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Gender extends StringEnum { + /** The value {@code "M"}. */ + public static final Gender M = new Gender("M"); + + /** The value {@code "F"}. */ + public static final Gender F = new Gender("F"); + + /** The value {@code "U"}. */ + public static final Gender U = new Gender("U"); + + private static final List KNOWN_VALUES = List.of(M, F, U); + + private Gender(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Gender of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Gender::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Marital status where the document carries it. Any other value returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MaritalStatus extends StringEnum { + /** The value {@code "SINGLE"}. */ + public static final MaritalStatus SINGLE = new MaritalStatus("SINGLE"); + + /** The value {@code "MARRIED"}. */ + public static final MaritalStatus MARRIED = new MaritalStatus("MARRIED"); + + /** The value {@code "DIVORCED"}. */ + public static final MaritalStatus DIVORCED = new MaritalStatus("DIVORCED"); + + /** The value {@code "WIDOWED"}. */ + public static final MaritalStatus WIDOWED = new MaritalStatus("WIDOWED"); + + /** The value {@code "UNKNOWN"}. */ + public static final MaritalStatus UNKNOWN = new MaritalStatus("UNKNOWN"); + + private static final List KNOWN_VALUES = List.of(SINGLE, MARRIED, DIVORCED, WIDOWED, UNKNOWN); + + private MaritalStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MaritalStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MaritalStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Structured address. Only these nested keys are accepted: address_type, city, region, street_1, street_2, postal_code, country โ€” any other key returns 400. Per-key semantics: a value sets the key, null removes it. formatted_address is recomputed server-side by joining street_1, street_2, city, region, postal_code, and country and is returned in the response โ€” you cannot set it directly. + */ + public static final class ParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("address_type", "city", "region", "street_1", "street_2", "postal_code", "country"); + + private ParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ParsedAddress fromJson(JsonNode json) { + return new ParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Free-form address classification (e.g. home). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * State / province / autonomous community. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ParsedAddress from) { + super(from); + } + + /** + * Free-form address classification (e.g. home). + * + * @param addressType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addressType(@Nullable String addressType) { + return setNullable("address_type", Conv.STRING, addressType); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * State / province / autonomous community. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The street_1 field. + * + * @param street1 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street1(@Nullable String street1) { + return setNullable("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * The postal_code field. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ParsedAddress} + */ + public ParsedAddress build() { + return new ParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateDataResponse.java b/src/main/java/me/didit/types/SessionsUpdateDataResponse.java new file mode 100644 index 0000000..ba492d0 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateDataResponse.java @@ -0,0 +1,820 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsUpdateDataResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("document_type", "document_subtype", "document_number", "personal_number", "date_of_birth", "date_of_issue", "expiration_date", "issuing_state", "first_name", "last_name", "gender", "address", "place_of_birth", "nationality", "marital_status", "extra_fields", "parsed_address"); + + private SessionsUpdateDataResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateDataResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateDataResponse fromJson(JsonNode json) { + return new SessionsUpdateDataResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Document type code. Accepts the short codes listed in the enum, plus six long-form aliases normalized server-side before validation: Passport โ†’ P, Identity Card โ†’ ID, Driver's License โ†’ DL, Residence Permit โ†’ RP, Health Insurance Card โ†’ HIC, Tax Card โ†’ TC. Any other value (including PASSPORT in caps) returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(SessionsUpdateDataResponse.DocumentType::of)); + } + + /** + * Document subtype from the document registry, including the region prefix when the registry distinguishes regional variants. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentSubtype() { + return Json.optional(json, "document_subtype", Conv.STRING); + } + + /** + * Document number as printed on the ID. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentNumber() { + return Json.optional(json, "document_number", Conv.STRING); + } + + /** + * Personal / national identification number where the document carries one (e.g. Spanish DNI on a passport). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional personalNumber() { + return Json.optional(json, "personal_number", Conv.STRING); + } + + /** + * Date of birth in YYYY-MM-DD. Any other format returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Issue date of the document in YYYY-MM-DD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfIssue() { + return Json.optional(json, "date_of_issue", Conv.DATE); + } + + /** + * Expiration date of the document in YYYY-MM-DD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expirationDate() { + return Json.optional(json, "expiration_date", Conv.DATE); + } + + /** + * Issuing country as an ISO 3166-1 alpha-3 code. Case-insensitive (esp is stored as ESP); the human-readable issuing_state_name shown in [Get Decision](#get-/v3/session/-sessionId-/decision/) is recomputed from this value. Invalid codes return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * Given name(s). The stored full_name is recomputed as first_name + ' ' + last_name on every call to this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Family name(s). Also feeds the recomputed full_name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Sex as printed on the document: M (male), F (female), or U (unknown). Any other value โ€” including X โ€” returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gender() { + return Json.optional(json, "gender", Conv.enumeration(SessionsUpdateDataResponse.Gender::of)); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it in the background of the same request and may overwrite parsed_address with the geocoder result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Place of birth as printed on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional placeOfBirth() { + return Json.optional(json, "place_of_birth", Conv.STRING); + } + + /** + * Nationality as printed on the document. Free text up to 32 characters โ€” typically an ISO 3166-1 alpha-3 code (e.g. ESP), but not validated as one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nationality() { + return Json.optional(json, "nationality", Conv.STRING); + } + + /** + * Marital status where the document carries it. Any other value returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maritalStatus() { + return Json.optional(json, "marital_status", Conv.enumeration(SessionsUpdateDataResponse.MaritalStatus::of)); + } + + /** + * Merged view of the document's extra fields: the OCR-extracted values with all operator overrides applied. Keys removed via a null override are absent from this map. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFields() { + return Json.optional(json, "extra_fields", Conv.OBJECT); + } + + /** + * Current structured address (with internal bookkeeping keys stripped), or null when none exists. Includes the recomputed formatted_address alongside the seven editable keys. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional parsedAddress() { + return Json.optional(json, "parsed_address", Conv.model(SessionsUpdateDataResponse.ParsedAddress::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateDataResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateDataResponse from) { + super(from); + } + + /** + * Document type code. Accepts the short codes listed in the enum, plus six long-form aliases normalized server-side before validation: Passport โ†’ P, Identity Card โ†’ ID, Driver's License โ†’ DL, Residence Permit โ†’ RP, Health Insurance Card โ†’ HIC, Tax Card โ†’ TC. Any other value (including PASSPORT in caps) returns 400. + * + * @param documentType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentType(SessionsUpdateDataResponse.@Nullable DocumentType documentType) { + return setNullable("document_type", Conv.enumeration(SessionsUpdateDataResponse.DocumentType::of), documentType); + } + + /** + * Document subtype from the document registry, including the region prefix when the registry distinguishes regional variants. + * + * @param documentSubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentSubtype(@Nullable String documentSubtype) { + return setNullable("document_subtype", Conv.STRING, documentSubtype); + } + + /** + * Document number as printed on the ID. + * + * @param documentNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentNumber(@Nullable String documentNumber) { + return setNullable("document_number", Conv.STRING, documentNumber); + } + + /** + * Personal / national identification number where the document carries one (e.g. Spanish DNI on a passport). + * + * @param personalNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder personalNumber(@Nullable String personalNumber) { + return setNullable("personal_number", Conv.STRING, personalNumber); + } + + /** + * Date of birth in YYYY-MM-DD. Any other format returns 400. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Issue date of the document in YYYY-MM-DD. + * + * @param dateOfIssue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfIssue(@Nullable LocalDate dateOfIssue) { + return setNullable("date_of_issue", Conv.DATE, dateOfIssue); + } + + /** + * Expiration date of the document in YYYY-MM-DD. + * + * @param expirationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expirationDate(@Nullable LocalDate expirationDate) { + return setNullable("expiration_date", Conv.DATE, expirationDate); + } + + /** + * Issuing country as an ISO 3166-1 alpha-3 code. Case-insensitive (esp is stored as ESP); the human-readable issuing_state_name shown in [Get Decision](#get-/v3/session/-sessionId-/decision/) is recomputed from this value. Invalid codes return 400. + * + * @param issuingState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingState(@Nullable String issuingState) { + return setNullable("issuing_state", Conv.STRING, issuingState); + } + + /** + * Given name(s). The stored full_name is recomputed as first_name + ' ' + last_name on every call to this endpoint. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * Family name(s). Also feeds the recomputed full_name. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Sex as printed on the document: M (male), F (female), or U (unknown). Any other value โ€” including X โ€” returns 400. + * + * @param gender the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder gender(SessionsUpdateDataResponse.@Nullable Gender gender) { + return setNullable("gender", Conv.enumeration(SessionsUpdateDataResponse.Gender::of), gender); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it in the background of the same request and may overwrite parsed_address with the geocoder result. + * + * @param address the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder address(@Nullable String address) { + return setNullable("address", Conv.STRING, address); + } + + /** + * Place of birth as printed on the document. + * + * @param placeOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder placeOfBirth(@Nullable String placeOfBirth) { + return setNullable("place_of_birth", Conv.STRING, placeOfBirth); + } + + /** + * Nationality as printed on the document. Free text up to 32 characters โ€” typically an ISO 3166-1 alpha-3 code (e.g. ESP), but not validated as one. + * + * @param nationality the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nationality(@Nullable String nationality) { + return setNullable("nationality", Conv.STRING, nationality); + } + + /** + * Marital status where the document carries it. Any other value returns 400. + * + * @param maritalStatus the value + * @return this builder + */ + public Builder maritalStatus(SessionsUpdateDataResponse.MaritalStatus maritalStatus) { + return set("marital_status", Conv.enumeration(SessionsUpdateDataResponse.MaritalStatus::of), maritalStatus); + } + + /** + * Merged view of the document's extra fields: the OCR-extracted values with all operator overrides applied. Keys removed via a null override are absent from this map. + * + * @param extraFields the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder extraFields(@Nullable Map extraFields) { + return setAny("extra_fields", extraFields); + } + + /** + * Current structured address (with internal bookkeeping keys stripped), or null when none exists. Includes the recomputed formatted_address alongside the seven editable keys. + * + * @param parsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder parsedAddress(SessionsUpdateDataResponse.@Nullable ParsedAddress parsedAddress) { + return setNullable("parsed_address", Conv.model(SessionsUpdateDataResponse.ParsedAddress::fromJson), parsedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateDataResponse} + */ + public SessionsUpdateDataResponse build() { + return new SessionsUpdateDataResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Document type code. Accepts the short codes listed in the enum, plus six long-form aliases normalized server-side before validation: Passport โ†’ P, Identity Card โ†’ ID, Driver's License โ†’ DL, Residence Permit โ†’ RP, Health Insurance Card โ†’ HIC, Tax Card โ†’ TC. Any other value (including PASSPORT in caps) returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "P"}. */ + public static final DocumentType P = new DocumentType("P"); + + /** The value {@code "DL"}. */ + public static final DocumentType DL = new DocumentType("DL"); + + /** The value {@code "ID"}. */ + public static final DocumentType ID = new DocumentType("ID"); + + /** The value {@code "RP"}. */ + public static final DocumentType RP = new DocumentType("RP"); + + /** The value {@code "SSC"}. */ + public static final DocumentType SSC = new DocumentType("SSC"); + + /** The value {@code "HIC"}. */ + public static final DocumentType HIC = new DocumentType("HIC"); + + /** The value {@code "WP"}. */ + public static final DocumentType WP = new DocumentType("WP"); + + /** The value {@code "TC"}. */ + public static final DocumentType TC = new DocumentType("TC"); + + /** The value {@code "VISA"}. */ + public static final DocumentType VISA = new DocumentType("VISA"); + + /** The value {@code "PSC"}. */ + public static final DocumentType PSC = new DocumentType("PSC"); + + /** The value {@code "BC"}. */ + public static final DocumentType BC = new DocumentType("BC"); + + /** The value {@code "OTHER"}. */ + public static final DocumentType OTHER = new DocumentType("OTHER"); + + private static final List KNOWN_VALUES = List.of(P, DL, ID, RP, SSC, HIC, WP, TC, VISA, PSC, BC, OTHER); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Sex as printed on the document: M (male), F (female), or U (unknown). Any other value โ€” including X โ€” returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Gender extends StringEnum { + /** The value {@code "M"}. */ + public static final Gender M = new Gender("M"); + + /** The value {@code "F"}. */ + public static final Gender F = new Gender("F"); + + /** The value {@code "U"}. */ + public static final Gender U = new Gender("U"); + + private static final List KNOWN_VALUES = List.of(M, F, U); + + private Gender(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Gender of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Gender::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Marital status where the document carries it. Any other value returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class MaritalStatus extends StringEnum { + /** The value {@code "SINGLE"}. */ + public static final MaritalStatus SINGLE = new MaritalStatus("SINGLE"); + + /** The value {@code "MARRIED"}. */ + public static final MaritalStatus MARRIED = new MaritalStatus("MARRIED"); + + /** The value {@code "DIVORCED"}. */ + public static final MaritalStatus DIVORCED = new MaritalStatus("DIVORCED"); + + /** The value {@code "WIDOWED"}. */ + public static final MaritalStatus WIDOWED = new MaritalStatus("WIDOWED"); + + /** The value {@code "UNKNOWN"}. */ + public static final MaritalStatus UNKNOWN = new MaritalStatus("UNKNOWN"); + + private static final List KNOWN_VALUES = List.of(SINGLE, MARRIED, DIVORCED, WIDOWED, UNKNOWN); + + private MaritalStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static MaritalStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, MaritalStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Current structured address (with internal bookkeeping keys stripped), or null when none exists. Includes the recomputed formatted_address alongside the seven editable keys. + */ + public static final class ParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("address_type", "city", "region", "street_1", "street_2", "postal_code", "country", "formatted_address"); + + private ParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ParsedAddress fromJson(JsonNode json) { + return new ParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Free-form address classification (e.g. home). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * State / province / autonomous community. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Joined, human-readable form of the structured address. Recomputed server-side after every parsed_address edit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ParsedAddress from) { + super(from); + } + + /** + * Free-form address classification (e.g. home). + * + * @param addressType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addressType(@Nullable String addressType) { + return setNullable("address_type", Conv.STRING, addressType); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * State / province / autonomous community. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The street_1 field. + * + * @param street1 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street1(@Nullable String street1) { + return setNullable("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * The postal_code field. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Joined, human-readable form of the structured address. Recomputed server-side after every parsed_address edit. + * + * @param formattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder formattedAddress(@Nullable String formattedAddress) { + return setNullable("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ParsedAddress} + */ + public ParsedAddress build() { + return new ParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateFeatureStatusParams.java b/src/main/java/me/didit/types/SessionsUpdateFeatureStatusParams.java new file mode 100644 index 0000000..c524bc5 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateFeatureStatusParams.java @@ -0,0 +1,168 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.update_feature_status}. */ +public final class SessionsUpdateFeatureStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("new_status", "comment"); + + private SessionsUpdateFeatureStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateFeatureStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateFeatureStatusParams fromJson(JsonNode json) { + return new SessionsUpdateFeatureStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Target status for this feature. Must differ from the current value. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsUpdateFeatureStatusParams.NewStatus newStatus() { + return Json.required(json, "new_status", Conv.enumeration(SessionsUpdateFeatureStatusParams.NewStatus::of)); + } + + /** + * Optional free-text note recorded on the session's review trail for this feature change. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateFeatureStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateFeatureStatusParams from) { + super(from); + } + + /** + * Target status for this feature. Must differ from the current value. + * + * @param newStatus the value + * @return this builder + */ + public Builder newStatus(SessionsUpdateFeatureStatusParams.NewStatus newStatus) { + return set("new_status", Conv.enumeration(SessionsUpdateFeatureStatusParams.NewStatus::of), newStatus); + } + + /** + * Optional free-text note recorded on the session's review trail for this feature change. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateFeatureStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsUpdateFeatureStatusParams build() { + require("new_status", false); + return new SessionsUpdateFeatureStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Target status for this feature. Must differ from the current value. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final NewStatus APPROVED = new NewStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final NewStatus DECLINED = new NewStatus("Declined"); + + /** The value {@code "In Review"}. */ + public static final NewStatus IN_REVIEW = new NewStatus("In Review"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, IN_REVIEW); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateFeatureStatusResponse.java b/src/main/java/me/didit/types/SessionsUpdateFeatureStatusResponse.java new file mode 100644 index 0000000..88f6f33 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateFeatureStatusResponse.java @@ -0,0 +1,158 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class SessionsUpdateFeatureStatusResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "node_id", "feature_type", "new_status"); + + private SessionsUpdateFeatureStatusResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateFeatureStatusResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateFeatureStatusResponse fromJson(JsonNode json) { + return new SessionsUpdateFeatureStatusResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The session_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The node_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Model name of the updated feature (e.g. KYC, Face, FaceMatch, AML, POA). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional featureType() { + return Json.optional(json, "feature_type", Conv.STRING); + } + + /** + * The new_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateFeatureStatusResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateFeatureStatusResponse from) { + super(from); + } + + /** + * The session_id field. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * The node_id field. + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Model name of the updated feature (e.g. KYC, Face, FaceMatch, AML, POA). + * + * @param featureType the value + * @return this builder + */ + public Builder featureType(String featureType) { + return set("feature_type", Conv.STRING, featureType); + } + + /** + * The new_status field. + * + * @param newStatus the value + * @return this builder + */ + public Builder newStatus(String newStatus) { + return set("new_status", Conv.STRING, newStatus); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateFeatureStatusResponse} + */ + public SessionsUpdateFeatureStatusResponse build() { + return new SessionsUpdateFeatureStatusResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateKybCompanyDataParams.java b/src/main/java/me/didit/types/SessionsUpdateKybCompanyDataParams.java new file mode 100644 index 0000000..eba89ed --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateKybCompanyDataParams.java @@ -0,0 +1,678 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.update_kyb_company_data}. */ +public final class SessionsUpdateKybCompanyDataParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("company_name", "registration_number", "country_code", "region", "incorporation_date", "registration_date", "dissolution_date", "tax_number", "legal_address", "company_type", "registry_status", "verification_status", "alternative_names", "nature_of_business", "registered_capital", "registered_capital_amount", "registered_capital_currency", "website", "email", "phone", "legal_entity_identifier", "location_of_registration", "vat_number", "control_scheme"); + + private SessionsUpdateKybCompanyDataParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateKybCompanyDataParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateKybCompanyDataParams fromJson(JsonNode json) { + return new SessionsUpdateKybCompanyDataParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Legal name of the company. Written to the canonical column and the registry snapshot. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * Official registration number with the company registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * Country of incorporation, ISO 3166-1 alpha-2. Case-insensitive (us is stored as US). Alpha-3 codes fail the 2-character limit with 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Subdivision / region tag where the registry has one (e.g. US state). Stored in the registry snapshot only โ€” it has no canonical column. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * Incorporation date in YYYY-MM-DD. Optional like every other field โ€” the PATCH is partial. Any other date format returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional incorporationDate() { + return Json.optional(json, "incorporation_date", Conv.DATE); + } + + /** + * Registration date where the registry distinguishes it from incorporation. Stored in the registry snapshot only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationDate() { + return Json.optional(json, "registration_date", Conv.DATE); + } + + /** + * Dissolution date for companies that are no longer active. Stored in the registry snapshot only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dissolutionDate() { + return Json.optional(json, "dissolution_date", Conv.DATE); + } + + /** + * Tax identification number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * Legal / registered address. Aliased server-side to the canonical registered_address column โ€” the response returns it under registered_address, while the registry snapshot keeps the legal_address key you sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalAddress() { + return Json.optional(json, "legal_address", Conv.STRING); + } + + /** + * Legal entity type (e.g. Limited Liability Company, PLC, GmbH). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyType() { + return Json.optional(json, "company_type", Conv.STRING); + } + + /** + * Registry-reported company status. Lowercase, some values contain spaces (e.g. struck off, no longer authorised). Any other value returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryStatus() { + return Json.optional(json, "registry_status", Conv.enumeration(SessionsUpdateKybCompanyDataParams.RegistryStatus::of)); + } + + /** + * Outcome of the registry verification. Any other value returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationStatus() { + return Json.optional(json, "verification_status", Conv.enumeration(SessionsUpdateKybCompanyDataParams.VerificationStatus::of)); + } + + /** + * Trade names, former legal names, DBA names (free text). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alternativeNames() { + return Json.optional(json, "alternative_names", Conv.STRING); + } + + /** + * Short description of the company's activity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional natureOfBusiness() { + return Json.optional(json, "nature_of_business", Conv.STRING); + } + + /** + * Human-readable registered capital (e.g. USD 50000). Use registered_capital_amount + registered_capital_currency for structured values, or this field for free-form text. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapital() { + return Json.optional(json, "registered_capital", Conv.STRING); + } + + /** + * Numeric registered-capital amount (up to 20 digits, 2 decimal places). Sets the registered_capital_amount column and is mirrored into registry_data as a decimal string; the response echoes it as a decimal string (e.g. "1500000.50"). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalAmount() { + return Json.optional(json, "registered_capital_amount", Conv.DOUBLE); + } + + /** + * ISO 4217 currency code for registered_capital_amount. Case-insensitive (usd is stored as USD); values that are not exactly 3 letters return 400 with the ISO 4217 message. Sets the canonical registered_capital_currency column and is mirrored into registry_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalCurrency() { + return Json.optional(json, "registered_capital_currency", Conv.STRING); + } + + /** + * Company website. Bare domains are accepted and normalized with an https:// prefix (docsprobe.example.com is stored as https://docsprobe.example.com); values that still fail URL validation return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * Contact email on file with the registry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * Contact phone. Must match +, digits, spaces, dashes, dots, or parentheses, with 7-15 digits total โ€” otherwise 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * LEI, where the company has one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalEntityIdentifier() { + return Json.optional(json, "legal_entity_identifier", Conv.STRING); + } + + /** + * City / subdivision of the registry of record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationOfRegistration() { + return Json.optional(json, "location_of_registration", Conv.STRING); + } + + /** + * EU VAT number. Merged into the registry_data snapshot only โ€” editing it here does not re-run VAT and tax ID validation, so vat_validation_status and the other vat_* result fields are unchanged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatNumber() { + return Json.optional(json, "vat_number", Conv.STRING); + } + + /** + * Control / governance scheme when the registry exposes it. Stored in the registry snapshot only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional controlScheme() { + return Json.optional(json, "control_scheme", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateKybCompanyDataParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateKybCompanyDataParams from) { + super(from); + } + + /** + * Legal name of the company. Written to the canonical column and the registry snapshot. + * + * @param companyName the value + * @return this builder + */ + public Builder companyName(String companyName) { + return set("company_name", Conv.STRING, companyName); + } + + /** + * Official registration number with the company registry. + * + * @param registrationNumber the value + * @return this builder + */ + public Builder registrationNumber(String registrationNumber) { + return set("registration_number", Conv.STRING, registrationNumber); + } + + /** + * Country of incorporation, ISO 3166-1 alpha-2. Case-insensitive (us is stored as US). Alpha-3 codes fail the 2-character limit with 400. + * + * @param countryCode the value + * @return this builder + */ + public Builder countryCode(String countryCode) { + return set("country_code", Conv.STRING, countryCode); + } + + /** + * Subdivision / region tag where the registry has one (e.g. US state). Stored in the registry snapshot only โ€” it has no canonical column. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * Incorporation date in YYYY-MM-DD. Optional like every other field โ€” the PATCH is partial. Any other date format returns 400. + * + * @param incorporationDate the value + * @return this builder + */ + public Builder incorporationDate(LocalDate incorporationDate) { + return set("incorporation_date", Conv.DATE, incorporationDate); + } + + /** + * Registration date where the registry distinguishes it from incorporation. Stored in the registry snapshot only. + * + * @param registrationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationDate(@Nullable LocalDate registrationDate) { + return setNullable("registration_date", Conv.DATE, registrationDate); + } + + /** + * Dissolution date for companies that are no longer active. Stored in the registry snapshot only. + * + * @param dissolutionDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dissolutionDate(@Nullable LocalDate dissolutionDate) { + return setNullable("dissolution_date", Conv.DATE, dissolutionDate); + } + + /** + * Tax identification number. + * + * @param taxNumber the value + * @return this builder + */ + public Builder taxNumber(String taxNumber) { + return set("tax_number", Conv.STRING, taxNumber); + } + + /** + * Legal / registered address. Aliased server-side to the canonical registered_address column โ€” the response returns it under registered_address, while the registry snapshot keeps the legal_address key you sent. + * + * @param legalAddress the value + * @return this builder + */ + public Builder legalAddress(String legalAddress) { + return set("legal_address", Conv.STRING, legalAddress); + } + + /** + * Legal entity type (e.g. Limited Liability Company, PLC, GmbH). + * + * @param companyType the value + * @return this builder + */ + public Builder companyType(String companyType) { + return set("company_type", Conv.STRING, companyType); + } + + /** + * Registry-reported company status. Lowercase, some values contain spaces (e.g. struck off, no longer authorised). Any other value returns 400. + * + * @param registryStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryStatus(SessionsUpdateKybCompanyDataParams.@Nullable RegistryStatus registryStatus) { + return setNullable("registry_status", Conv.enumeration(SessionsUpdateKybCompanyDataParams.RegistryStatus::of), registryStatus); + } + + /** + * Outcome of the registry verification. Any other value returns 400. + * + * @param verificationStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationStatus(SessionsUpdateKybCompanyDataParams.@Nullable VerificationStatus verificationStatus) { + return setNullable("verification_status", Conv.enumeration(SessionsUpdateKybCompanyDataParams.VerificationStatus::of), verificationStatus); + } + + /** + * Trade names, former legal names, DBA names (free text). + * + * @param alternativeNames the value + * @return this builder + */ + public Builder alternativeNames(String alternativeNames) { + return set("alternative_names", Conv.STRING, alternativeNames); + } + + /** + * Short description of the company's activity. + * + * @param natureOfBusiness the value + * @return this builder + */ + public Builder natureOfBusiness(String natureOfBusiness) { + return set("nature_of_business", Conv.STRING, natureOfBusiness); + } + + /** + * Human-readable registered capital (e.g. USD 50000). Use registered_capital_amount + registered_capital_currency for structured values, or this field for free-form text. + * + * @param registeredCapital the value + * @return this builder + */ + public Builder registeredCapital(String registeredCapital) { + return set("registered_capital", Conv.STRING, registeredCapital); + } + + /** + * Numeric registered-capital amount (up to 20 digits, 2 decimal places). Sets the registered_capital_amount column and is mirrored into registry_data as a decimal string; the response echoes it as a decimal string (e.g. "1500000.50"). + * + * @param registeredCapitalAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalAmount(@Nullable Double registeredCapitalAmount) { + return setNullable("registered_capital_amount", Conv.DOUBLE, registeredCapitalAmount); + } + + /** + * ISO 4217 currency code for registered_capital_amount. Case-insensitive (usd is stored as USD); values that are not exactly 3 letters return 400 with the ISO 4217 message. Sets the canonical registered_capital_currency column and is mirrored into registry_data. + * + * @param registeredCapitalCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalCurrency(@Nullable String registeredCapitalCurrency) { + return setNullable("registered_capital_currency", Conv.STRING, registeredCapitalCurrency); + } + + /** + * Company website. Bare domains are accepted and normalized with an https:// prefix (docsprobe.example.com is stored as https://docsprobe.example.com); values that still fail URL validation return 400. + * + * @param website the value + * @return this builder + */ + public Builder website(String website) { + return set("website", Conv.STRING, website); + } + + /** + * Contact email on file with the registry. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * Contact phone. Must match +, digits, spaces, dashes, dots, or parentheses, with 7-15 digits total โ€” otherwise 400. + * + * @param phone the value + * @return this builder + */ + public Builder phone(String phone) { + return set("phone", Conv.STRING, phone); + } + + /** + * LEI, where the company has one. + * + * @param legalEntityIdentifier the value + * @return this builder + */ + public Builder legalEntityIdentifier(String legalEntityIdentifier) { + return set("legal_entity_identifier", Conv.STRING, legalEntityIdentifier); + } + + /** + * City / subdivision of the registry of record. + * + * @param locationOfRegistration the value + * @return this builder + */ + public Builder locationOfRegistration(String locationOfRegistration) { + return set("location_of_registration", Conv.STRING, locationOfRegistration); + } + + /** + * EU VAT number. Merged into the registry_data snapshot only โ€” editing it here does not re-run VAT and tax ID validation, so vat_validation_status and the other vat_* result fields are unchanged. + * + * @param vatNumber the value + * @return this builder + */ + public Builder vatNumber(String vatNumber) { + return set("vat_number", Conv.STRING, vatNumber); + } + + /** + * Control / governance scheme when the registry exposes it. Stored in the registry snapshot only. + * + * @param controlScheme the value + * @return this builder + */ + public Builder controlScheme(String controlScheme) { + return set("control_scheme", Conv.STRING, controlScheme); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateKybCompanyDataParams} + */ + public SessionsUpdateKybCompanyDataParams build() { + return new SessionsUpdateKybCompanyDataParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Registry-reported company status. Lowercase, some values contain spaces (e.g. struck off, no longer authorised). Any other value returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class RegistryStatus extends StringEnum { + /** The value {@code "active"}. */ + public static final RegistryStatus ACTIVE = new RegistryStatus("active"); + + /** The value {@code "dissolved"}. */ + public static final RegistryStatus DISSOLVED = new RegistryStatus("dissolved"); + + /** The value {@code "deregistered"}. */ + public static final RegistryStatus DEREGISTERED = new RegistryStatus("deregistered"); + + /** The value {@code "see full details"}. */ + public static final RegistryStatus SEE_FULL_DETAILS = new RegistryStatus("see full details"); + + /** The value {@code "authorised"}. */ + public static final RegistryStatus AUTHORISED = new RegistryStatus("authorised"); + + /** The value {@code "appointed representative"}. */ + public static final RegistryStatus APPOINTED_REPRESENTATIVE = new RegistryStatus("appointed representative"); + + /** The value {@code "unauthorised"}. */ + public static final RegistryStatus UNAUTHORISED = new RegistryStatus("unauthorised"); + + /** The value {@code "inactive"}. */ + public static final RegistryStatus INACTIVE = new RegistryStatus("inactive"); + + /** The value {@code "no longer authorised"}. */ + public static final RegistryStatus NO_LONGER_AUTHORISED = new RegistryStatus("no longer authorised"); + + /** The value {@code "closed"}. */ + public static final RegistryStatus CLOSED = new RegistryStatus("closed"); + + /** The value {@code "struck off"}. */ + public static final RegistryStatus STRUCK_OFF = new RegistryStatus("struck off"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISSOLVED, DEREGISTERED, SEE_FULL_DETAILS, AUTHORISED, APPOINTED_REPRESENTATIVE, UNAUTHORISED, INACTIVE, NO_LONGER_AUTHORISED, CLOSED, STRUCK_OFF); + + private RegistryStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static RegistryStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, RegistryStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Outcome of the registry verification. Any other value returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VerificationStatus extends StringEnum { + /** The value {@code "verified"}. */ + public static final VerificationStatus VERIFIED = new VerificationStatus("verified"); + + /** The value {@code "failed"}. */ + public static final VerificationStatus FAILED = new VerificationStatus("failed"); + + /** The value {@code "unknown"}. */ + public static final VerificationStatus UNKNOWN = new VerificationStatus("unknown"); + + private static final List KNOWN_VALUES = List.of(VERIFIED, FAILED, UNKNOWN); + + private VerificationStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VerificationStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VerificationStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateKybCompanyDataResponse.java b/src/main/java/me/didit/types/SessionsUpdateKybCompanyDataResponse.java new file mode 100644 index 0000000..c86bb1e --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateKybCompanyDataResponse.java @@ -0,0 +1,1107 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Full KYB company record โ€” the same shape as the company object inside registry_checks[] on the business session decision. + */ +public final class SessionsUpdateKybCompanyDataResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "node_id", "status", "registry_status", "data_resolved", "company_name", "registration_number", "country_code", "region", "company_type", "incorporation_date", "registered_address", "tax_number", "risk_level", "verification_status", "is_from_registry", "fetch_status", "alternative_names", "nature_of_business", "registered_capital", "registered_capital_amount", "registered_capital_currency", "website", "email", "phone", "legal_entity_identifier", "location_of_registration", "vat_number", "vat_validation_status", "vat_validated_number", "vat_validation_source", "vat_validated_name", "vat_validated_address", "vat_checked_at", "financial_summary", "officers", "beneficial_owners", "addresses", "industries", "accounts", "registry_data", "user_provided_data", "confirmed_by_user_at", "last_console_edit_at", "is_editable"); + + private SessionsUpdateKybCompanyDataResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateKybCompanyDataResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateKybCompanyDataResponse fromJson(JsonNode json) { + return new SessionsUpdateKybCompanyDataResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Company record identifier (the companyUuid path parameter). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Workflow graph node this company record belongs to, when the workflow is graph-based. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Feature lifecycle status of the registry check (e.g. Not Finished, Approved, Declined, In Review). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * Registry-reported company status (e.g. active, dissolved, struck off). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registryStatus() { + return Json.optional(json, "registry_status", Conv.STRING); + } + + /** + * true when the company data is complete โ€” always true for manual-entry companies; for registry-sourced companies, true once the registry fetch resolved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dataResolved() { + return Json.optional(json, "data_resolved", Conv.BOOLEAN); + } + + /** + * The company_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyName() { + return Json.optional(json, "company_name", Conv.STRING); + } + + /** + * The registration_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registrationNumber() { + return Json.optional(json, "registration_number", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country of incorporation. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * The region field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The company_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional companyType() { + return Json.optional(json, "company_type", Conv.STRING); + } + + /** + * The incorporation_date field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional incorporationDate() { + return Json.optional(json, "incorporation_date", Conv.DATE); + } + + /** + * Canonical registered address โ€” updated when you send legal_address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredAddress() { + return Json.optional(json, "registered_address", Conv.STRING); + } + + /** + * The tax_number field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional taxNumber() { + return Json.optional(json, "tax_number", Conv.STRING); + } + + /** + * The risk_level field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * verified, failed, or unknown. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verificationStatus() { + return Json.optional(json, "verification_status", Conv.STRING); + } + + /** + * true when the company was pre-filled from a registry search rather than entered manually. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isFromRegistry() { + return Json.optional(json, "is_from_registry", Conv.BOOLEAN); + } + + /** + * Registry fetch lifecycle for registry-sourced companies (pending / resolved); null for manual entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fetchStatus() { + return Json.optional(json, "fetch_status", Conv.STRING); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alternativeNames() { + return Json.optional(json, "alternative_names", Conv.STRING); + } + + /** + * The nature_of_business field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional natureOfBusiness() { + return Json.optional(json, "nature_of_business", Conv.STRING); + } + + /** + * The registered_capital field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapital() { + return Json.optional(json, "registered_capital", Conv.STRING); + } + + /** + * Canonical column. Returned as a decimal string (e.g. "2750000.00"). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalAmount() { + return Json.optional(json, "registered_capital_amount", Conv.STRING); + } + + /** + * Canonical column. Set by the registry flow or by console/API edits via this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registeredCapitalCurrency() { + return Json.optional(json, "registered_capital_currency", Conv.STRING); + } + + /** + * The website field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional website() { + return Json.optional(json, "website", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The phone field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional phone() { + return Json.optional(json, "phone", Conv.STRING); + } + + /** + * The legal_entity_identifier field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalEntityIdentifier() { + return Json.optional(json, "legal_entity_identifier", Conv.STRING); + } + + /** + * The location_of_registration field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional locationOfRegistration() { + return Json.optional(json, "location_of_registration", Conv.STRING); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatNumber() { + return Json.optional(json, "vat_number", Conv.STRING); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationStatus() { + return Json.optional(json, "vat_validation_status", Conv.enumeration(SessionsUpdateKybCompanyDataResponse.VatValidationStatus::of)); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedNumber() { + return Json.optional(json, "vat_validated_number", Conv.STRING); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidationSource() { + return Json.optional(json, "vat_validation_source", Conv.enumeration(SessionsUpdateKybCompanyDataResponse.VatValidationSource::of)); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedName() { + return Json.optional(json, "vat_validated_name", Conv.STRING); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatValidatedAddress() { + return Json.optional(json, "vat_validated_address", Conv.STRING); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vatCheckedAt() { + return Json.optional(json, "vat_checked_at", Conv.DATE_TIME); + } + + /** + * The financial_summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> financialSummary() { + return Json.optional(json, "financial_summary", Conv.OBJECT); + } + + /** + * Directors / officers attached to the company, including per-person KYC progress. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> officers() { + return Json.optional(json, "officers", Conv.list(Conv.OBJECT)); + } + + /** + * Beneficial owners attached to the company, including per-person KYC progress. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> beneficialOwners() { + return Json.optional(json, "beneficial_owners", Conv.list(Conv.OBJECT)); + } + + /** + * Registry address detail, when the registry returned any. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> addresses() { + return Json.optional(json, "addresses", Conv.list(Conv.OBJECT)); + } + + /** + * Registry industry classification, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> industries() { + return Json.optional(json, "industries", Conv.list(Conv.OBJECT)); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> accounts() { + return Json.optional(json, "accounts", Conv.OBJECT); + } + + /** + * Raw registry payload snapshot. Every key you PATCH is merged into this map (dates serialized as ISO strings), so the "extracted from registry" view reflects operator corrections. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> registryData() { + return Json.optional(json, "registry_data", Conv.OBJECT); + } + + /** + * What the end user typed during the hosted registry-confirmation step. Never modified by this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> userProvidedData() { + return Json.optional(json, "user_provided_data", Conv.OBJECT); + } + + /** + * When the end user confirmed the company data in the hosted flow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmedByUserAt() { + return Json.optional(json, "confirmed_by_user_at", Conv.DATE_TIME); + } + + /** + * Stamped on every successful non-empty PATCH, so UIs can surface "edited by operator" context. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastConsoleEditAt() { + return Json.optional(json, "last_console_edit_at", Conv.DATE_TIME); + } + + /** + * true while the end user can still edit the registry-sourced data in the hosted flow (registry-sourced and not yet confirmed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateKybCompanyDataResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateKybCompanyDataResponse from) { + super(from); + } + + /** + * Company record identifier (the companyUuid path parameter). + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Workflow graph node this company record belongs to, when the workflow is graph-based. + * + * @param nodeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nodeId(@Nullable String nodeId) { + return setNullable("node_id", Conv.STRING, nodeId); + } + + /** + * Feature lifecycle status of the registry check (e.g. Not Finished, Approved, Declined, In Review). + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Registry-reported company status (e.g. active, dissolved, struck off). + * + * @param registryStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryStatus(@Nullable String registryStatus) { + return setNullable("registry_status", Conv.STRING, registryStatus); + } + + /** + * true when the company data is complete โ€” always true for manual-entry companies; for registry-sourced companies, true once the registry fetch resolved. + * + * @param dataResolved the value + * @return this builder + */ + public Builder dataResolved(boolean dataResolved) { + return set("data_resolved", Conv.BOOLEAN, dataResolved); + } + + /** + * The company_name field. + * + * @param companyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyName(@Nullable String companyName) { + return setNullable("company_name", Conv.STRING, companyName); + } + + /** + * The registration_number field. + * + * @param registrationNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registrationNumber(@Nullable String registrationNumber) { + return setNullable("registration_number", Conv.STRING, registrationNumber); + } + + /** + * ISO 3166-1 alpha-2 country of incorporation. + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * The region field. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The company_type field. + * + * @param companyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder companyType(@Nullable String companyType) { + return setNullable("company_type", Conv.STRING, companyType); + } + + /** + * The incorporation_date field. + * + * @param incorporationDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder incorporationDate(@Nullable LocalDate incorporationDate) { + return setNullable("incorporation_date", Conv.DATE, incorporationDate); + } + + /** + * Canonical registered address โ€” updated when you send legal_address. + * + * @param registeredAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredAddress(@Nullable String registeredAddress) { + return setNullable("registered_address", Conv.STRING, registeredAddress); + } + + /** + * The tax_number field. + * + * @param taxNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder taxNumber(@Nullable String taxNumber) { + return setNullable("tax_number", Conv.STRING, taxNumber); + } + + /** + * The risk_level field. + * + * @param riskLevel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder riskLevel(@Nullable String riskLevel) { + return setNullable("risk_level", Conv.STRING, riskLevel); + } + + /** + * verified, failed, or unknown. + * + * @param verificationStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder verificationStatus(@Nullable String verificationStatus) { + return setNullable("verification_status", Conv.STRING, verificationStatus); + } + + /** + * true when the company was pre-filled from a registry search rather than entered manually. + * + * @param isFromRegistry the value + * @return this builder + */ + public Builder isFromRegistry(boolean isFromRegistry) { + return set("is_from_registry", Conv.BOOLEAN, isFromRegistry); + } + + /** + * Registry fetch lifecycle for registry-sourced companies (pending / resolved); null for manual entries. + * + * @param fetchStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fetchStatus(@Nullable String fetchStatus) { + return setNullable("fetch_status", Conv.STRING, fetchStatus); + } + + /** + * Alternative, trading, former or original-language company names as text, when reported. + * + * @param alternativeNames the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder alternativeNames(@Nullable String alternativeNames) { + return setNullable("alternative_names", Conv.STRING, alternativeNames); + } + + /** + * The nature_of_business field. + * + * @param natureOfBusiness the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder natureOfBusiness(@Nullable String natureOfBusiness) { + return setNullable("nature_of_business", Conv.STRING, natureOfBusiness); + } + + /** + * The registered_capital field. + * + * @param registeredCapital the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapital(@Nullable String registeredCapital) { + return setNullable("registered_capital", Conv.STRING, registeredCapital); + } + + /** + * Canonical column. Returned as a decimal string (e.g. "2750000.00"). + * + * @param registeredCapitalAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalAmount(@Nullable String registeredCapitalAmount) { + return setNullable("registered_capital_amount", Conv.STRING, registeredCapitalAmount); + } + + /** + * Canonical column. Set by the registry flow or by console/API edits via this endpoint. + * + * @param registeredCapitalCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registeredCapitalCurrency(@Nullable String registeredCapitalCurrency) { + return setNullable("registered_capital_currency", Conv.STRING, registeredCapitalCurrency); + } + + /** + * The website field. + * + * @param website the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder website(@Nullable String website) { + return setNullable("website", Conv.STRING, website); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The phone field. + * + * @param phone the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder phone(@Nullable String phone) { + return setNullable("phone", Conv.STRING, phone); + } + + /** + * The legal_entity_identifier field. + * + * @param legalEntityIdentifier the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder legalEntityIdentifier(@Nullable String legalEntityIdentifier) { + return setNullable("legal_entity_identifier", Conv.STRING, legalEntityIdentifier); + } + + /** + * The location_of_registration field. + * + * @param locationOfRegistration the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder locationOfRegistration(@Nullable String locationOfRegistration) { + return setNullable("location_of_registration", Conv.STRING, locationOfRegistration); + } + + /** + * EU VAT number, when collected during the hosted registry step or edited afterwards. + * + * @param vatNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatNumber(@Nullable String vatNumber) { + return setNullable("vat_number", Conv.STRING, vatNumber); + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + * @param vatValidationStatus the value + * @return this builder + */ + public Builder vatValidationStatus(SessionsUpdateKybCompanyDataResponse.VatValidationStatus vatValidationStatus) { + return set("vat_validation_status", Conv.enumeration(SessionsUpdateKybCompanyDataResponse.VatValidationStatus::of), vatValidationStatus); + } + + /** + * The number that was checked, as the source knows it (for example the VAT number derived from a French SIREN or a Dutch RSIN). null when no check ran. + * + * @param vatValidatedNumber the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedNumber(@Nullable String vatValidatedNumber) { + return setNullable("vat_validated_number", Conv.STRING, vatValidatedNumber); + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + * @param vatValidationSource the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidationSource(SessionsUpdateKybCompanyDataResponse.@Nullable VatValidationSource vatValidationSource) { + return setNullable("vat_validation_source", Conv.enumeration(SessionsUpdateKybCompanyDataResponse.VatValidationSource::of), vatValidationSource); + } + + /** + * Name registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedName(@Nullable String vatValidatedName) { + return setNullable("vat_validated_name", Conv.STRING, vatValidatedName); + } + + /** + * Address registered with the source that validated the number, when it discloses one. Only set when the status is valid. + * + * @param vatValidatedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatValidatedAddress(@Nullable String vatValidatedAddress) { + return setNullable("vat_validated_address", Conv.STRING, vatValidatedAddress); + } + + /** + * Timestamp of the check. null when no check ran. + * + * @param vatCheckedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vatCheckedAt(@Nullable OffsetDateTime vatCheckedAt) { + return setNullable("vat_checked_at", Conv.DATE_TIME, vatCheckedAt); + } + + /** + * The financial_summary field. + * + * @param financialSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder financialSummary(@Nullable Map financialSummary) { + return setAny("financial_summary", financialSummary); + } + + /** + * Directors / officers attached to the company, including per-person KYC progress. + * + * @param officers the value + * @return this builder + */ + public Builder officers(List> officers) { + return setAny("officers", officers); + } + + /** + * Beneficial owners attached to the company, including per-person KYC progress. + * + * @param beneficialOwners the value + * @return this builder + */ + public Builder beneficialOwners(List> beneficialOwners) { + return setAny("beneficial_owners", beneficialOwners); + } + + /** + * Registry address detail, when the registry returned any. + * + * @param addresses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addresses(@Nullable List> addresses) { + return setAny("addresses", addresses); + } + + /** + * Registry industry classification, when available. + * + * @param industries the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder industries(@Nullable List> industries) { + return setAny("industries", industries); + } + + /** + * Registry filing dates, when available. Annual returns and general meetings use last_annual_return_date and last_agm_date; they are distinct from financial accounts. + * + * @param accounts the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder accounts(@Nullable Map accounts) { + return setAny("accounts", accounts); + } + + /** + * Raw registry payload snapshot. Every key you PATCH is merged into this map (dates serialized as ISO strings), so the "extracted from registry" view reflects operator corrections. + * + * @param registryData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registryData(@Nullable Map registryData) { + return setAny("registry_data", registryData); + } + + /** + * What the end user typed during the hosted registry-confirmation step. Never modified by this endpoint. + * + * @param userProvidedData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder userProvidedData(@Nullable Map userProvidedData) { + return setAny("user_provided_data", userProvidedData); + } + + /** + * When the end user confirmed the company data in the hosted flow. + * + * @param confirmedByUserAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder confirmedByUserAt(@Nullable OffsetDateTime confirmedByUserAt) { + return setNullable("confirmed_by_user_at", Conv.DATE_TIME, confirmedByUserAt); + } + + /** + * Stamped on every successful non-empty PATCH, so UIs can surface "edited by operator" context. + * + * @param lastConsoleEditAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastConsoleEditAt(@Nullable OffsetDateTime lastConsoleEditAt) { + return setNullable("last_console_edit_at", Conv.DATE_TIME, lastConsoleEditAt); + } + + /** + * true while the end user can still edit the registry-sourced data in the hosted flow (registry-sourced and not yet confirmed). + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateKybCompanyDataResponse} + */ + public SessionsUpdateKybCompanyDataResponse build() { + return new SessionsUpdateKybCompanyDataResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Result of validating the VAT number or, when there is none, the tax_number, at registry submit. valid / invalid: decided by the official registry of the country (EU VIES, Norway, Switzerland, Brazil, Colombia, Costa Rica, Ecuador, Paraguay; Poland also by its domestic VAT register). format_valid / invalid_format: decided by the country's format and check-digit rules where no registry can be queried. could_not_validate: the registry was unavailable. not_applicable: no number, a country without registry or rules, or a sandbox session. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationStatus extends StringEnum { + /** The value {@code "valid"}. */ + public static final VatValidationStatus VALID = new VatValidationStatus("valid"); + + /** The value {@code "invalid"}. */ + public static final VatValidationStatus INVALID = new VatValidationStatus("invalid"); + + /** The value {@code "format_valid"}. */ + public static final VatValidationStatus FORMAT_VALID = new VatValidationStatus("format_valid"); + + /** The value {@code "invalid_format"}. */ + public static final VatValidationStatus INVALID_FORMAT = new VatValidationStatus("invalid_format"); + + /** The value {@code "could_not_validate"}. */ + public static final VatValidationStatus COULD_NOT_VALIDATE = new VatValidationStatus("could_not_validate"); + + /** The value {@code "not_applicable"}. */ + public static final VatValidationStatus NOT_APPLICABLE = new VatValidationStatus("not_applicable"); + + private static final List KNOWN_VALUES = List.of(VALID, INVALID, FORMAT_VALID, INVALID_FORMAT, COULD_NOT_VALIDATE, NOT_APPLICABLE); + + private VatValidationStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * The source that decided vat_validation_status: an official registry, or format_rules. null when no check ran. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class VatValidationSource extends StringEnum { + /** The value {@code "eu_vies"}. */ + public static final VatValidationSource EU_VIES = new VatValidationSource("eu_vies"); + + /** The value {@code "pl_vat_white_list"}. */ + public static final VatValidationSource PL_VAT_WHITE_LIST = new VatValidationSource("pl_vat_white_list"); + + /** The value {@code "no_brreg"}. */ + public static final VatValidationSource NO_BRREG = new VatValidationSource("no_brreg"); + + /** The value {@code "ch_uid_register"}. */ + public static final VatValidationSource CH_UID_REGISTER = new VatValidationSource("ch_uid_register"); + + /** The value {@code "br_receita_federal"}. */ + public static final VatValidationSource BR_RECEITA_FEDERAL = new VatValidationSource("br_receita_federal"); + + /** The value {@code "co_rues"}. */ + public static final VatValidationSource CO_RUES = new VatValidationSource("co_rues"); + + /** The value {@code "cr_hacienda"}. */ + public static final VatValidationSource CR_HACIENDA = new VatValidationSource("cr_hacienda"); + + /** The value {@code "ec_sri"}. */ + public static final VatValidationSource EC_SRI = new VatValidationSource("ec_sri"); + + /** The value {@code "py_dnit"}. */ + public static final VatValidationSource PY_DNIT = new VatValidationSource("py_dnit"); + + /** The value {@code "format_rules"}. */ + public static final VatValidationSource FORMAT_RULES = new VatValidationSource("format_rules"); + + private static final List KNOWN_VALUES = List.of(EU_VIES, PL_VAT_WHITE_LIST, NO_BRREG, CH_UID_REGISTER, BR_RECEITA_FEDERAL, CO_RUES, CR_HACIENDA, EC_SRI, PY_DNIT, FORMAT_RULES); + + private VatValidationSource(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static VatValidationSource of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, VatValidationSource::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateKybPartyParams.java b/src/main/java/me/didit/types/SessionsUpdateKybPartyParams.java new file mode 100644 index 0000000..646d372 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateKybPartyParams.java @@ -0,0 +1,100 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code sessions.update_kyb_party}. */ +public final class SessionsUpdateKybPartyParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_skipped"); + + private SessionsUpdateKybPartyParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateKybPartyParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateKybPartyParams fromJson(JsonNode json) { + return new SessionsUpdateKybPartyParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * true exempts the party from verification so the Key People check can settle without it; false puts it back in scope. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isSkipped() { + return Json.required(json, "is_skipped", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateKybPartyParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateKybPartyParams from) { + super(from); + } + + /** + * true exempts the party from verification so the Key People check can settle without it; false puts it back in scope. + * + * @param isSkipped the value + * @return this builder + */ + public Builder isSkipped(boolean isSkipped) { + return set("is_skipped", Conv.BOOLEAN, isSkipped); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateKybPartyParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsUpdateKybPartyParams build() { + require("is_skipped", false); + return new SessionsUpdateKybPartyParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateKybPartyResponse.java b/src/main/java/me/didit/types/SessionsUpdateKybPartyResponse.java new file mode 100644 index 0000000..ef115d5 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateKybPartyResponse.java @@ -0,0 +1,306 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Key People party record - the same shape as an entry of key_people_checks[].submitted.parties[] on the business session decision. + */ +public final class SessionsUpdateKybPartyResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "entity_type", "name", "is_skipped", "requires_verification", "kyc_session_status", "kyc_session_url", "kyc_session_deleted", "kyb_sub_session_deleted"); + + private SessionsUpdateKybPartyResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateKybPartyResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateKybPartyResponse fromJson(JsonNode json) { + return new SessionsUpdateKybPartyResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Party identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Whether the party is an individual or a company. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(SessionsUpdateKybPartyResponse.EntityType::of)); + } + + /** + * Display name of the party. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Whether the party is exempt from verification. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSkipped() { + return Json.optional(json, "is_skipped", Conv.BOOLEAN); + } + + /** + * What the role and threshold rules asked for. Left untouched by this endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional requiresVerification() { + return Json.optional(json, "requires_verification", Conv.BOOLEAN); + } + + /** + * Status of the linked individual KYC session, frozen at deletion time when the session was deleted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionStatus() { + return Json.optional(json, "kyc_session_status", Conv.STRING); + } + + /** + * Link to the linked individual KYC session. null when there is none or when it was deleted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionUrl() { + return Json.optional(json, "kyc_session_url", Conv.STRING); + } + + /** + * The linked individual KYC session was deleted, so it can never settle. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kycSessionDeleted() { + return Json.optional(json, "kyc_session_deleted", Conv.BOOLEAN); + } + + /** + * Corporate-party counterpart of kyc_session_deleted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kybSubSessionDeleted() { + return Json.optional(json, "kyb_sub_session_deleted", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateKybPartyResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateKybPartyResponse from) { + super(from); + } + + /** + * Party identifier. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Whether the party is an individual or a company. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(SessionsUpdateKybPartyResponse.EntityType entityType) { + return set("entity_type", Conv.enumeration(SessionsUpdateKybPartyResponse.EntityType::of), entityType); + } + + /** + * Display name of the party. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * Whether the party is exempt from verification. + * + * @param isSkipped the value + * @return this builder + */ + public Builder isSkipped(boolean isSkipped) { + return set("is_skipped", Conv.BOOLEAN, isSkipped); + } + + /** + * What the role and threshold rules asked for. Left untouched by this endpoint. + * + * @param requiresVerification the value + * @return this builder + */ + public Builder requiresVerification(boolean requiresVerification) { + return set("requires_verification", Conv.BOOLEAN, requiresVerification); + } + + /** + * Status of the linked individual KYC session, frozen at deletion time when the session was deleted. + * + * @param kycSessionStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionStatus(@Nullable String kycSessionStatus) { + return setNullable("kyc_session_status", Conv.STRING, kycSessionStatus); + } + + /** + * Link to the linked individual KYC session. null when there is none or when it was deleted. + * + * @param kycSessionUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder kycSessionUrl(@Nullable String kycSessionUrl) { + return setNullable("kyc_session_url", Conv.STRING, kycSessionUrl); + } + + /** + * The linked individual KYC session was deleted, so it can never settle. + * + * @param kycSessionDeleted the value + * @return this builder + */ + public Builder kycSessionDeleted(boolean kycSessionDeleted) { + return set("kyc_session_deleted", Conv.BOOLEAN, kycSessionDeleted); + } + + /** + * Corporate-party counterpart of kyc_session_deleted. + * + * @param kybSubSessionDeleted the value + * @return this builder + */ + public Builder kybSubSessionDeleted(boolean kybSubSessionDeleted) { + return set("kyb_sub_session_deleted", Conv.BOOLEAN, kybSubSessionDeleted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateKybPartyResponse} + */ + public SessionsUpdateKybPartyResponse build() { + return new SessionsUpdateKybPartyResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the party is an individual or a company. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "person"}. */ + public static final EntityType PERSON = new EntityType("person"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + private static final List KNOWN_VALUES = List.of(PERSON, COMPANY); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdatePoaDataParams.java b/src/main/java/me/didit/types/SessionsUpdatePoaDataParams.java new file mode 100644 index 0000000..fab8ccb --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdatePoaDataParams.java @@ -0,0 +1,542 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code sessions.update_poa_data}. */ +public final class SessionsUpdatePoaDataParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "issuing_state", "document_type", "document_language", "issuer", "issue_date", "poa_address", "name_on_document", "extra_fields", "poa_parsed_address"); + + private SessionsUpdatePoaDataParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdatePoaDataParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdatePoaDataParams fromJson(JsonNode json) { + return new SessionsUpdatePoaDataParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Workflow graph node whose POA record to patch, for graph workflows with multiple Proof of Address steps (also accepted as a node_id body field). When omitted, the most recent POA record on the session is patched. If no POA exists for the given node, the call returns 404 ("The session does not have a POA for node '<node_id>'."). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nodeId() { + return Json.optional(json, "node_id", Conv.STRING); + } + + /** + * Country that issued the POA document, ISO 3166-1 alpha-3. Case-insensitive (normalized to uppercase); invalid codes return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * POA document category. Values are uppercase โ€” lowercase variants like utility_bill return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(SessionsUpdatePoaDataParams.DocumentType::of)); + } + + /** + * Language of the document, typically an ISO 639-1 code (e.g. es). Free text โ€” not validated as a language code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLanguage() { + return Json.optional(json, "document_language", Conv.STRING); + } + + /** + * Organization that issued the document (utility company, bank, government agency). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + /** + * Issue date of the POA document in YYYY-MM-DD. Any other format returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issueDate() { + return Json.optional(json, "issue_date", Conv.DATE); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it in the background of the same request and may overwrite poa_parsed_address / poa_formatted_address with the geocoder result. The re-geocode also requires issuing_state to be present on the POA record. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaAddress() { + return Json.optional(json, "poa_address", Conv.STRING); + } + + /** + * Recipient name as printed on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameOnDocument() { + return Json.optional(json, "name_on_document", Conv.STRING); + } + + /** + * Document-specific extras, merged key-by-key. Nine keys map to dedicated POA columns: bank_account_number, bank_iban, bank_sort_code, bank_routing_number, bank_swift_bic, bank_branch_name, bank_branch_address, document_phone_number, and additional_names (must be a list of strings or null, otherwise 400). Any other key is stored as a custom extra field. Per-key semantics: a value sets the key; null or "" deletes it. Must be a JSON object, otherwise 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFields() { + return Json.optional(json, "extra_fields", Conv.OBJECT); + } + + /** + * Structured address. Only these nested keys are accepted: address_type, city, region, street_1, street_2, postal_code, country โ€” any other key returns 400. Per-key semantics: a value sets the key, null removes it. formatted_address (and the top-level poa_formatted_address) is recomputed server-side by joining street_1, street_2, city, region, postal_code, and country โ€” you cannot set it directly. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaParsedAddress() { + return Json.optional(json, "poa_parsed_address", Conv.model(SessionsUpdatePoaDataParams.PoaParsedAddress::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdatePoaDataParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdatePoaDataParams from) { + super(from); + } + + /** + * Workflow graph node whose POA record to patch, for graph workflows with multiple Proof of Address steps (also accepted as a node_id body field). When omitted, the most recent POA record on the session is patched. If no POA exists for the given node, the call returns 404 ("The session does not have a POA for node '<node_id>'."). + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Country that issued the POA document, ISO 3166-1 alpha-3. Case-insensitive (normalized to uppercase); invalid codes return 400. + * + * @param issuingState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingState(@Nullable String issuingState) { + return setNullable("issuing_state", Conv.STRING, issuingState); + } + + /** + * POA document category. Values are uppercase โ€” lowercase variants like utility_bill return 400. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(SessionsUpdatePoaDataParams.DocumentType documentType) { + return set("document_type", Conv.enumeration(SessionsUpdatePoaDataParams.DocumentType::of), documentType); + } + + /** + * Language of the document, typically an ISO 639-1 code (e.g. es). Free text โ€” not validated as a language code. + * + * @param documentLanguage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentLanguage(@Nullable String documentLanguage) { + return setNullable("document_language", Conv.STRING, documentLanguage); + } + + /** + * Organization that issued the document (utility company, bank, government agency). + * + * @param issuer the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuer(@Nullable String issuer) { + return setNullable("issuer", Conv.STRING, issuer); + } + + /** + * Issue date of the POA document in YYYY-MM-DD. Any other format returns 400. + * + * @param issueDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issueDate(@Nullable LocalDate issueDate) { + return setNullable("issue_date", Conv.DATE, issueDate); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it in the background of the same request and may overwrite poa_parsed_address / poa_formatted_address with the geocoder result. The re-geocode also requires issuing_state to be present on the POA record. + * + * @param poaAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaAddress(@Nullable String poaAddress) { + return setNullable("poa_address", Conv.STRING, poaAddress); + } + + /** + * Recipient name as printed on the document. + * + * @param nameOnDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameOnDocument(@Nullable String nameOnDocument) { + return setNullable("name_on_document", Conv.STRING, nameOnDocument); + } + + /** + * Document-specific extras, merged key-by-key. Nine keys map to dedicated POA columns: bank_account_number, bank_iban, bank_sort_code, bank_routing_number, bank_swift_bic, bank_branch_name, bank_branch_address, document_phone_number, and additional_names (must be a list of strings or null, otherwise 400). Any other key is stored as a custom extra field. Per-key semantics: a value sets the key; null or "" deletes it. Must be a JSON object, otherwise 400. + * + * @param extraFields the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder extraFields(@Nullable Map extraFields) { + return setAny("extra_fields", extraFields); + } + + /** + * Structured address. Only these nested keys are accepted: address_type, city, region, street_1, street_2, postal_code, country โ€” any other key returns 400. Per-key semantics: a value sets the key, null removes it. formatted_address (and the top-level poa_formatted_address) is recomputed server-side by joining street_1, street_2, city, region, postal_code, and country โ€” you cannot set it directly. + * + * @param poaParsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaParsedAddress(SessionsUpdatePoaDataParams.@Nullable PoaParsedAddress poaParsedAddress) { + return setNullable("poa_parsed_address", Conv.model(SessionsUpdatePoaDataParams.PoaParsedAddress::fromJson), poaParsedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdatePoaDataParams} + */ + public SessionsUpdatePoaDataParams build() { + return new SessionsUpdatePoaDataParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * POA document category. Values are uppercase โ€” lowercase variants like utility_bill return 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "UTILITY_BILL"}. */ + public static final DocumentType UTILITY_BILL = new DocumentType("UTILITY_BILL"); + + /** The value {@code "BANK_STATEMENT"}. */ + public static final DocumentType BANK_STATEMENT = new DocumentType("BANK_STATEMENT"); + + /** The value {@code "GOVERNMENT_ISSUED_DOCUMENT"}. */ + public static final DocumentType GOVERNMENT_ISSUED_DOCUMENT = new DocumentType("GOVERNMENT_ISSUED_DOCUMENT"); + + /** The value {@code "OTHER_POA_DOCUMENT"}. */ + public static final DocumentType OTHER_POA_DOCUMENT = new DocumentType("OTHER_POA_DOCUMENT"); + + /** The value {@code "UNKNOWN"}. */ + public static final DocumentType UNKNOWN = new DocumentType("UNKNOWN"); + + private static final List KNOWN_VALUES = List.of(UTILITY_BILL, BANK_STATEMENT, GOVERNMENT_ISSUED_DOCUMENT, OTHER_POA_DOCUMENT, UNKNOWN); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Structured address. Only these nested keys are accepted: address_type, city, region, street_1, street_2, postal_code, country โ€” any other key returns 400. Per-key semantics: a value sets the key, null removes it. formatted_address (and the top-level poa_formatted_address) is recomputed server-side by joining street_1, street_2, city, region, postal_code, and country โ€” you cannot set it directly. + */ + public static final class PoaParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("address_type", "city", "region", "street_1", "street_2", "postal_code", "country"); + + private PoaParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PoaParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PoaParsedAddress fromJson(JsonNode json) { + return new PoaParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Free-form address classification (e.g. home). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * State / province / autonomous community. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PoaParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PoaParsedAddress from) { + super(from); + } + + /** + * Free-form address classification (e.g. home). + * + * @param addressType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addressType(@Nullable String addressType) { + return setNullable("address_type", Conv.STRING, addressType); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * State / province / autonomous community. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The street_1 field. + * + * @param street1 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street1(@Nullable String street1) { + return setNullable("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * The postal_code field. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PoaParsedAddress} + */ + public PoaParsedAddress build() { + return new PoaParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdatePoaDataResponse.java b/src/main/java/me/didit/types/SessionsUpdatePoaDataResponse.java new file mode 100644 index 0000000..c1a3d9a --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdatePoaDataResponse.java @@ -0,0 +1,561 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SessionsUpdatePoaDataResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("issuing_state", "document_type", "document_language", "issuer", "issue_date", "poa_address", "name_on_document", "extra_fields", "poa_parsed_address", "poa_formatted_address"); + + private SessionsUpdatePoaDataResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdatePoaDataResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdatePoaDataResponse fromJson(JsonNode json) { + return new SessionsUpdatePoaDataResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Country that issued the POA document, ISO 3166-1 alpha-3. Case-insensitive (normalized to uppercase); invalid codes return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingState() { + return Json.optional(json, "issuing_state", Conv.STRING); + } + + /** + * POA document category. Values are uppercase โ€” lowercase variants like utility_bill return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentType() { + return Json.optional(json, "document_type", Conv.enumeration(SessionsUpdatePoaDataResponse.DocumentType::of)); + } + + /** + * Language of the document, typically an ISO 639-1 code (e.g. es). Free text โ€” not validated as a language code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional documentLanguage() { + return Json.optional(json, "document_language", Conv.STRING); + } + + /** + * Organization that issued the document (utility company, bank, government agency). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuer() { + return Json.optional(json, "issuer", Conv.STRING); + } + + /** + * Issue date of the POA document in YYYY-MM-DD. Any other format returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issueDate() { + return Json.optional(json, "issue_date", Conv.DATE); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it in the background of the same request and may overwrite poa_parsed_address / poa_formatted_address with the geocoder result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaAddress() { + return Json.optional(json, "poa_address", Conv.STRING); + } + + /** + * Recipient name as printed on the document. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameOnDocument() { + return Json.optional(json, "name_on_document", Conv.STRING); + } + + /** + * Always present in the response: the nine known keys (with null for unset ones, additional_names defaulting to []) plus any custom keys previously stored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> extraFields() { + return Json.optional(json, "extra_fields", Conv.OBJECT); + } + + /** + * Current structured address, or null when none exists. Includes the recomputed formatted_address alongside the seven editable keys. Returned as stored โ€” after a server-side geocode it can contain bookkeeping keys (e.g. raw_results) alongside the editable keys. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaParsedAddress() { + return Json.optional(json, "poa_parsed_address", Conv.model(SessionsUpdatePoaDataResponse.PoaParsedAddress::fromJson)); + } + + /** + * Top-level copy of the recomputed formatted_address, kept in sync when the structured address changes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional poaFormattedAddress() { + return Json.optional(json, "poa_formatted_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdatePoaDataResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdatePoaDataResponse from) { + super(from); + } + + /** + * Country that issued the POA document, ISO 3166-1 alpha-3. Case-insensitive (normalized to uppercase); invalid codes return 400. + * + * @param issuingState the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingState(@Nullable String issuingState) { + return setNullable("issuing_state", Conv.STRING, issuingState); + } + + /** + * POA document category. Values are uppercase โ€” lowercase variants like utility_bill return 400. + * + * @param documentType the value + * @return this builder + */ + public Builder documentType(SessionsUpdatePoaDataResponse.DocumentType documentType) { + return set("document_type", Conv.enumeration(SessionsUpdatePoaDataResponse.DocumentType::of), documentType); + } + + /** + * Language of the document, typically an ISO 639-1 code (e.g. es). Free text โ€” not validated as a language code. + * + * @param documentLanguage the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder documentLanguage(@Nullable String documentLanguage) { + return setNullable("document_language", Conv.STRING, documentLanguage); + } + + /** + * Organization that issued the document (utility company, bank, government agency). + * + * @param issuer the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuer(@Nullable String issuer) { + return setNullable("issuer", Conv.STRING, issuer); + } + + /** + * Issue date of the POA document in YYYY-MM-DD. Any other format returns 400. + * + * @param issueDate the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issueDate(@Nullable LocalDate issueDate) { + return setNullable("issue_date", Conv.DATE, issueDate); + } + + /** + * Free-text address as printed on the document. When this value changes (non-sandbox sessions only) and the structured address is still missing or incomplete, the server re-geocodes it in the background of the same request and may overwrite poa_parsed_address / poa_formatted_address with the geocoder result. + * + * @param poaAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaAddress(@Nullable String poaAddress) { + return setNullable("poa_address", Conv.STRING, poaAddress); + } + + /** + * Recipient name as printed on the document. + * + * @param nameOnDocument the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder nameOnDocument(@Nullable String nameOnDocument) { + return setNullable("name_on_document", Conv.STRING, nameOnDocument); + } + + /** + * Always present in the response: the nine known keys (with null for unset ones, additional_names defaulting to []) plus any custom keys previously stored. + * + * @param extraFields the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder extraFields(@Nullable Map extraFields) { + return setAny("extra_fields", extraFields); + } + + /** + * Current structured address, or null when none exists. Includes the recomputed formatted_address alongside the seven editable keys. Returned as stored โ€” after a server-side geocode it can contain bookkeeping keys (e.g. raw_results) alongside the editable keys. + * + * @param poaParsedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaParsedAddress(SessionsUpdatePoaDataResponse.@Nullable PoaParsedAddress poaParsedAddress) { + return setNullable("poa_parsed_address", Conv.model(SessionsUpdatePoaDataResponse.PoaParsedAddress::fromJson), poaParsedAddress); + } + + /** + * Top-level copy of the recomputed formatted_address, kept in sync when the structured address changes. + * + * @param poaFormattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder poaFormattedAddress(@Nullable String poaFormattedAddress) { + return setNullable("poa_formatted_address", Conv.STRING, poaFormattedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdatePoaDataResponse} + */ + public SessionsUpdatePoaDataResponse build() { + return new SessionsUpdatePoaDataResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * POA document category. Values are uppercase โ€” lowercase variants like utility_bill return 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DocumentType extends StringEnum { + /** The value {@code "UTILITY_BILL"}. */ + public static final DocumentType UTILITY_BILL = new DocumentType("UTILITY_BILL"); + + /** The value {@code "BANK_STATEMENT"}. */ + public static final DocumentType BANK_STATEMENT = new DocumentType("BANK_STATEMENT"); + + /** The value {@code "GOVERNMENT_ISSUED_DOCUMENT"}. */ + public static final DocumentType GOVERNMENT_ISSUED_DOCUMENT = new DocumentType("GOVERNMENT_ISSUED_DOCUMENT"); + + /** The value {@code "OTHER_POA_DOCUMENT"}. */ + public static final DocumentType OTHER_POA_DOCUMENT = new DocumentType("OTHER_POA_DOCUMENT"); + + /** The value {@code "UNKNOWN"}. */ + public static final DocumentType UNKNOWN = new DocumentType("UNKNOWN"); + + private static final List KNOWN_VALUES = List.of(UTILITY_BILL, BANK_STATEMENT, GOVERNMENT_ISSUED_DOCUMENT, OTHER_POA_DOCUMENT, UNKNOWN); + + private DocumentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DocumentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DocumentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Current structured address, or null when none exists. Includes the recomputed formatted_address alongside the seven editable keys. Returned as stored โ€” after a server-side geocode it can contain bookkeeping keys (e.g. raw_results) alongside the editable keys. + */ + public static final class PoaParsedAddress extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("address_type", "city", "region", "street_1", "street_2", "postal_code", "country", "formatted_address"); + + private PoaParsedAddress(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PoaParsedAddress} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PoaParsedAddress fromJson(JsonNode json) { + return new PoaParsedAddress(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Free-form address classification (e.g. home). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addressType() { + return Json.optional(json, "address_type", Conv.STRING); + } + + /** + * The city field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional city() { + return Json.optional(json, "city", Conv.STRING); + } + + /** + * State / province / autonomous community. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional region() { + return Json.optional(json, "region", Conv.STRING); + } + + /** + * The street_1 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street1() { + return Json.optional(json, "street_1", Conv.STRING); + } + + /** + * The street_2 field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street2() { + return Json.optional(json, "street_2", Conv.STRING); + } + + /** + * The postal_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postalCode() { + return Json.optional(json, "postal_code", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Joined, human-readable form of the structured address. Recomputed server-side after every poa_parsed_address edit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional formattedAddress() { + return Json.optional(json, "formatted_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PoaParsedAddress}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PoaParsedAddress from) { + super(from); + } + + /** + * Free-form address classification (e.g. home). + * + * @param addressType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addressType(@Nullable String addressType) { + return setNullable("address_type", Conv.STRING, addressType); + } + + /** + * The city field. + * + * @param city the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder city(@Nullable String city) { + return setNullable("city", Conv.STRING, city); + } + + /** + * State / province / autonomous community. + * + * @param region the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder region(@Nullable String region) { + return setNullable("region", Conv.STRING, region); + } + + /** + * The street_1 field. + * + * @param street1 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street1(@Nullable String street1) { + return setNullable("street_1", Conv.STRING, street1); + } + + /** + * The street_2 field. + * + * @param street2 the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder street2(@Nullable String street2) { + return setNullable("street_2", Conv.STRING, street2); + } + + /** + * The postal_code field. + * + * @param postalCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder postalCode(@Nullable String postalCode) { + return setNullable("postal_code", Conv.STRING, postalCode); + } + + /** + * ISO 3166-1 alpha-2 country code. Lowercase input is normalized to uppercase; alpha-3 codes are rejected with 400. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Joined, human-readable form of the structured address. Recomputed server-side after every poa_parsed_address edit. + * + * @param formattedAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder formattedAddress(@Nullable String formattedAddress) { + return setNullable("formatted_address", Conv.STRING, formattedAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PoaParsedAddress} + */ + public PoaParsedAddress build() { + return new PoaParsedAddress(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateStatusParams.java b/src/main/java/me/didit/types/SessionsUpdateStatusParams.java new file mode 100644 index 0000000..24a197f --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateStatusParams.java @@ -0,0 +1,485 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code sessions.update_status}. */ +public final class SessionsUpdateStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("new_status", "comment", "nodes_to_resubmit", "send_email", "email_address", "email_language", "email_preview_token"); + + private SessionsUpdateStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateStatusParams fromJson(JsonNode json) { + return new SessionsUpdateStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Target status. Approved and Declined record a final manual decision (each can also overturn the other). Resubmitted clears the selected steps and sends the session back to the user. Any other value returns 400. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsUpdateStatusParams.NewStatus newStatus() { + return Json.required(json, "new_status", Conv.enumeration(SessionsUpdateStatusParams.NewStatus::of)); + } + + /** + * Free-text reason for the change, stored on the session's review trail and returned in the reviews array of [Get Decision](#get-/v3/session/-sessionId-/decision/). For example Duplicated user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * Workflow steps the user must redo. Only acted on when new_status is Resubmitted. For Approved/Declined the entries are still schema-validated (an invalid feature value returns 400) but schema-valid entries are semantically ignored. If omitted, the server auto-selects existing OCR, Liveness, Face Match, POA, Phone, Email, AML, Database Validation, and Questionnaire attempts whose status is Declined, In Review, Not Finished, or Expired (NFC, IP analysis, age estimation, face search, and KYB document attempts are never auto-selected; non-face-match face attempts are selected as LIVENESS) โ€” features the user never attempted (no recorded attempt) are NOT selected, so a session with zero attempts returns 400 ("No features found that need resubmission") even though nothing was approved; pass nodes_to_resubmit explicitly in that case. Steps are executed in workflow-graph order regardless of the order you send them. KYB_REGISTRY, KYB_KEY_PEOPLE, and the KYB alias are rejected with 400 โ€” those parent checks recompute from their child KYC sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> nodesToResubmit() { + return Json.optional(json, "nodes_to_resubmit", Conv.list(Conv.model(SessionsUpdateStatusParams.NodesToResubmit::fromJson))); + } + + /** + * Whether to email the user about the change. Requires email_address. For Approved/Declined the user receives a status notice; for Resubmitted the email includes the verification link and the per-step resubmission reasons. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sendEmail() { + return Json.optional(json, "send_email", Conv.BOOLEAN); + } + + /** + * Recipient for the notification email. **Required when send_email is true** โ€” omitting it returns 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailAddress() { + return Json.optional(json, "email_address", Conv.STRING); + } + + /** + * Language for the notification email. Accepts any string at schema level; unsupported codes silently fall back to English (en). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailLanguage() { + return Json.optional(json, "email_language", Conv.STRING); + } + + /** + * Optional signed receipt from Preview Resubmission Email. When supplied with send_email=true and new_status=Resubmitted, the recipient, language, checks, current session state, sender and message must still match the preview. A changed or expired receipt returns 409 before changing the session or sending email. Existing integrations may omit this field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional emailPreviewToken() { + return Json.optional(json, "email_preview_token", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateStatusParams from) { + super(from); + } + + /** + * Target status. Approved and Declined record a final manual decision (each can also overturn the other). Resubmitted clears the selected steps and sends the session back to the user. Any other value returns 400. + * + * @param newStatus the value + * @return this builder + */ + public Builder newStatus(SessionsUpdateStatusParams.NewStatus newStatus) { + return set("new_status", Conv.enumeration(SessionsUpdateStatusParams.NewStatus::of), newStatus); + } + + /** + * Free-text reason for the change, stored on the session's review trail and returned in the reviews array of [Get Decision](#get-/v3/session/-sessionId-/decision/). For example Duplicated user. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * Workflow steps the user must redo. Only acted on when new_status is Resubmitted. For Approved/Declined the entries are still schema-validated (an invalid feature value returns 400) but schema-valid entries are semantically ignored. If omitted, the server auto-selects existing OCR, Liveness, Face Match, POA, Phone, Email, AML, Database Validation, and Questionnaire attempts whose status is Declined, In Review, Not Finished, or Expired (NFC, IP analysis, age estimation, face search, and KYB document attempts are never auto-selected; non-face-match face attempts are selected as LIVENESS) โ€” features the user never attempted (no recorded attempt) are NOT selected, so a session with zero attempts returns 400 ("No features found that need resubmission") even though nothing was approved; pass nodes_to_resubmit explicitly in that case. Steps are executed in workflow-graph order regardless of the order you send them. KYB_REGISTRY, KYB_KEY_PEOPLE, and the KYB alias are rejected with 400 โ€” those parent checks recompute from their child KYC sessions. + * + * @param nodesToResubmit the value + * @return this builder + */ + public Builder nodesToResubmit(List nodesToResubmit) { + return set("nodes_to_resubmit", Conv.list(Conv.model(SessionsUpdateStatusParams.NodesToResubmit::fromJson)), nodesToResubmit); + } + + /** + * Whether to email the user about the change. Requires email_address. For Approved/Declined the user receives a status notice; for Resubmitted the email includes the verification link and the per-step resubmission reasons. + * + * @param sendEmail the value + * @return this builder + */ + public Builder sendEmail(boolean sendEmail) { + return set("send_email", Conv.BOOLEAN, sendEmail); + } + + /** + * Recipient for the notification email. **Required when send_email is true** โ€” omitting it returns 400. + * + * @param emailAddress the value + * @return this builder + */ + public Builder emailAddress(String emailAddress) { + return set("email_address", Conv.STRING, emailAddress); + } + + /** + * Language for the notification email. Accepts any string at schema level; unsupported codes silently fall back to English (en). + * + * @param emailLanguage the value + * @return this builder + */ + public Builder emailLanguage(String emailLanguage) { + return set("email_language", Conv.STRING, emailLanguage); + } + + /** + * Optional signed receipt from Preview Resubmission Email. When supplied with send_email=true and new_status=Resubmitted, the recipient, language, checks, current session state, sender and message must still match the preview. A changed or expired receipt returns 409 before changing the session or sending email. Existing integrations may omit this field. + * + * @param emailPreviewToken the value + * @return this builder + */ + public Builder emailPreviewToken(String emailPreviewToken) { + return set("email_preview_token", Conv.STRING, emailPreviewToken); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public SessionsUpdateStatusParams build() { + require("new_status", false); + return new SessionsUpdateStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Target status. Approved and Declined record a final manual decision (each can also overturn the other). Resubmitted clears the selected steps and sends the session back to the user. Any other value returns 400. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "Approved"}. */ + public static final NewStatus APPROVED = new NewStatus("Approved"); + + /** The value {@code "Declined"}. */ + public static final NewStatus DECLINED = new NewStatus("Declined"); + + /** The value {@code "Resubmitted"}. */ + public static final NewStatus RESUBMITTED = new NewStatus("Resubmitted"); + + private static final List KNOWN_VALUES = List.of(APPROVED, DECLINED, RESUBMITTED); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class NodesToResubmit extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("node_id", "feature"); + + private NodesToResubmit(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NodesToResubmit} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NodesToResubmit fromJson(JsonNode json) { + return new NodesToResubmit(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Node identifier as it appears in the session's workflow definition (for example feature_ocr, feature_liveness). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String nodeId() { + return Json.required(json, "node_id", Conv.STRING); + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SessionsUpdateStatusParams.NodesToResubmit.Feature feature() { + return Json.required(json, "feature", Conv.enumeration(SessionsUpdateStatusParams.NodesToResubmit.Feature::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NodesToResubmit}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NodesToResubmit from) { + super(from); + } + + /** + * Node identifier as it appears in the session's workflow definition (for example feature_ocr, feature_liveness). + * + * @param nodeId the value + * @return this builder + */ + public Builder nodeId(String nodeId) { + return set("node_id", Conv.STRING, nodeId); + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SessionsUpdateStatusParams.NodesToResubmit.Feature feature) { + return set("feature", Conv.enumeration(SessionsUpdateStatusParams.NodesToResubmit.Feature::of), feature); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NodesToResubmit} + * @throws IllegalStateException when a required field is missing + */ + public NodesToResubmit build() { + require("node_id", false); + require("feature", false); + return new NodesToResubmit(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature type of the node. The aliases ID_VERIFICATION, POA, PHONE, and EMAIL are normalized server-side to OCR, PROOF_OF_ADDRESS, PHONE_VERIFICATION, and EMAIL_VERIFICATION. KYB_REGISTRY, KYB_KEY_PEOPLE, and KYB pass schema validation but are always rejected with the business-rule 400 shown in the examples. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "OCR"}. */ + public static final Feature OCR = new Feature("OCR"); + + /** The value {@code "OCR_BACK"}. */ + public static final Feature OCR_BACK = new Feature("OCR_BACK"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "FACE"}. */ + public static final Feature FACE = new Feature("FACE"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACE_MATCH"}. */ + public static final Feature FACE_MATCH = new Feature("FACE_MATCH"); + + /** The value {@code "IP_ANALYSIS"}. */ + public static final Feature IP_ANALYSIS = new Feature("IP_ANALYSIS"); + + /** The value {@code "AGE_ESTIMATION"}. */ + public static final Feature AGE_ESTIMATION = new Feature("AGE_ESTIMATION"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "PHONE_VERIFICATION"}. */ + public static final Feature PHONE_VERIFICATION = new Feature("PHONE_VERIFICATION"); + + /** The value {@code "EMAIL_VERIFICATION"}. */ + public static final Feature EMAIL_VERIFICATION = new Feature("EMAIL_VERIFICATION"); + + /** The value {@code "FACE_SEARCH"}. */ + public static final Feature FACE_SEARCH = new Feature("FACE_SEARCH"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "ID_VERIFICATION"}. */ + public static final Feature ID_VERIFICATION = new Feature("ID_VERIFICATION"); + + /** The value {@code "POA"}. */ + public static final Feature POA = new Feature("POA"); + + /** The value {@code "PHONE"}. */ + public static final Feature PHONE = new Feature("PHONE"); + + /** The value {@code "EMAIL"}. */ + public static final Feature EMAIL = new Feature("EMAIL"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + /** The value {@code "KYB"}. */ + public static final Feature KYB = new Feature("KYB"); + + private static final List KNOWN_VALUES = List.of(OCR, OCR_BACK, NFC, AML, FACE, LIVENESS, FACE_MATCH, IP_ANALYSIS, AGE_ESTIMATION, PROOF_OF_ADDRESS, PHONE_VERIFICATION, EMAIL_VERIFICATION, FACE_SEARCH, DATABASE_VALIDATION, QUESTIONNAIRE, DOCUMENT_AI, KYB_DOCUMENTS, ID_VERIFICATION, POA, PHONE, EMAIL, KYB_REGISTRY, KYB_KEY_PEOPLE, KYB); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/SessionsUpdateStatusResponse.java b/src/main/java/me/didit/types/SessionsUpdateStatusResponse.java new file mode 100644 index 0000000..87560a8 --- /dev/null +++ b/src/main/java/me/didit/types/SessionsUpdateStatusResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class SessionsUpdateStatusResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id"); + + private SessionsUpdateStatusResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SessionsUpdateStatusResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SessionsUpdateStatusResponse fromJson(JsonNode json) { + return new SessionsUpdateStatusResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * UUID of the updated session. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SessionsUpdateStatusResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SessionsUpdateStatusResponse from) { + super(from); + } + + /** + * UUID of the updated session. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SessionsUpdateStatusResponse} + */ + public SessionsUpdateStatusResponse build() { + return new SessionsUpdateStatusResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SimpleQuestionnaireElement.java b/src/main/java/me/didit/types/SimpleQuestionnaireElement.java new file mode 100644 index 0000000..ad58f33 --- /dev/null +++ b/src/main/java/me/didit/types/SimpleQuestionnaireElement.java @@ -0,0 +1,652 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SimpleQuestionnaireElement extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("id", "element_type", "label", "description", "placeholder", "is_required", "options", "max_files", "validation"); + + private SimpleQuestionnaireElement(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SimpleQuestionnaireElement} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SimpleQuestionnaireElement fromJson(JsonNode json) { + return new SimpleQuestionnaireElement(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Optional stable question id. If omitted, the API generates q1, q2, etc. Use lowercase letters, numbers, and underscores for readability. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional id() { + return Json.optional(json, "id", Conv.STRING); + } + + /** + * Question type. The API accepts these lowercase values and their uppercase equivalents. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SimpleQuestionnaireElement.ElementType elementType() { + return Json.required(json, "element_type", Conv.enumeration(SimpleQuestionnaireElement.ElementType::of)); + } + + /** + * Question label by language code, for example { "en": "Source of funds" }. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map label() { + return Json.required(json, "label", Conv.map(Conv.STRING)); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> description() { + return Json.optional(json, "description", Conv.map(Conv.STRING)); + } + + /** + * The placeholder field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> placeholder() { + return Json.optional(json, "placeholder", Conv.map(Conv.STRING)); + } + + /** + * The is_required field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isRequired() { + return Json.optional(json, "is_required", Conv.BOOLEAN); + } + + /** + * Use for dropdown, single_choice, and multiple_choice. If value is omitted, the API generates one from the option label. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> options() { + return Json.optional(json, "options", Conv.list(Conv.model(SimpleQuestionnaireElement.Options::fromJson))); + } + + /** + * Use with file_upload or image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxFiles() { + return Json.optional(json, "max_files", Conv.LONG); + } + + /** + * Optional format validation for short_text, long_text, or number. Enforced while the user fills the field (they cannot proceed until it passes) and re-checked by the API on submission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional validation() { + return Json.optional(json, "validation", Conv.model(SimpleQuestionnaireElement.Validation::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SimpleQuestionnaireElement}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SimpleQuestionnaireElement from) { + super(from); + } + + /** + * Optional stable question id. If omitted, the API generates q1, q2, etc. Use lowercase letters, numbers, and underscores for readability. + * + * @param id the value + * @return this builder + */ + public Builder id(String id) { + return set("id", Conv.STRING, id); + } + + /** + * Question type. The API accepts these lowercase values and their uppercase equivalents. + * + * @param elementType the value + * @return this builder + */ + public Builder elementType(SimpleQuestionnaireElement.ElementType elementType) { + return set("element_type", Conv.enumeration(SimpleQuestionnaireElement.ElementType::of), elementType); + } + + /** + * Question label by language code, for example { "en": "Source of funds" }. + * + * @param label the value + * @return this builder + */ + public Builder label(Map label) { + return set("label", Conv.map(Conv.STRING), label); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable Map description) { + return setNullable("description", Conv.map(Conv.STRING), description); + } + + /** + * The placeholder field. + * + * @param placeholder the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder placeholder(@Nullable Map placeholder) { + return setNullable("placeholder", Conv.map(Conv.STRING), placeholder); + } + + /** + * The is_required field. + * + * @param isRequired the value + * @return this builder + */ + public Builder isRequired(boolean isRequired) { + return set("is_required", Conv.BOOLEAN, isRequired); + } + + /** + * Use for dropdown, single_choice, and multiple_choice. If value is omitted, the API generates one from the option label. + * + * @param options_ the value + * @return this builder + */ + public Builder options(List options_) { + return set("options", Conv.list(Conv.model(SimpleQuestionnaireElement.Options::fromJson)), options_); + } + + /** + * Use with file_upload or image. + * + * @param maxFiles the value + * @return this builder + */ + public Builder maxFiles(long maxFiles) { + return set("max_files", Conv.LONG, maxFiles); + } + + /** + * Optional format validation for short_text, long_text, or number. Enforced while the user fills the field (they cannot proceed until it passes) and re-checked by the API on submission. + * + * @param validation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder validation(SimpleQuestionnaireElement.@Nullable Validation validation) { + return setNullable("validation", Conv.model(SimpleQuestionnaireElement.Validation::fromJson), validation); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SimpleQuestionnaireElement} + * @throws IllegalStateException when a required field is missing + */ + public SimpleQuestionnaireElement build() { + require("element_type", false); + require("label", false); + return new SimpleQuestionnaireElement(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Question type. The API accepts these lowercase values and their uppercase equivalents. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ElementType extends StringEnum { + /** The value {@code "short_text"}. */ + public static final ElementType SHORT_TEXT = new ElementType("short_text"); + + /** The value {@code "long_text"}. */ + public static final ElementType LONG_TEXT = new ElementType("long_text"); + + /** The value {@code "dropdown"}. */ + public static final ElementType DROPDOWN = new ElementType("dropdown"); + + /** The value {@code "single_choice"}. */ + public static final ElementType SINGLE_CHOICE = new ElementType("single_choice"); + + /** The value {@code "multiple_choice"}. */ + public static final ElementType MULTIPLE_CHOICE = new ElementType("multiple_choice"); + + /** The value {@code "number"}. */ + public static final ElementType NUMBER = new ElementType("number"); + + /** The value {@code "image"}. */ + public static final ElementType IMAGE = new ElementType("image"); + + /** The value {@code "file_upload"}. */ + public static final ElementType FILE_UPLOAD = new ElementType("file_upload"); + + /** The value {@code "time"}. */ + public static final ElementType TIME = new ElementType("time"); + + /** The value {@code "email"}. */ + public static final ElementType EMAIL = new ElementType("email"); + + /** The value {@code "address"}. */ + public static final ElementType ADDRESS = new ElementType("address"); + + /** The value {@code "phone"}. */ + public static final ElementType PHONE = new ElementType("phone"); + + /** The value {@code "country"}. */ + public static final ElementType COUNTRY = new ElementType("country"); + + /** The value {@code "date_picker"}. */ + public static final ElementType DATE_PICKER = new ElementType("date_picker"); + + /** The value {@code "consent"}. */ + public static final ElementType CONSENT = new ElementType("consent"); + + /** The value {@code "section_header"}. */ + public static final ElementType SECTION_HEADER = new ElementType("section_header"); + + /** The value {@code "separator"}. */ + public static final ElementType SEPARATOR = new ElementType("separator"); + + /** The value {@code "heading"}. */ + public static final ElementType HEADING = new ElementType("heading"); + + /** The value {@code "paragraph"}. */ + public static final ElementType PARAGRAPH = new ElementType("paragraph"); + + private static final List KNOWN_VALUES = List.of(SHORT_TEXT, LONG_TEXT, DROPDOWN, SINGLE_CHOICE, MULTIPLE_CHOICE, NUMBER, IMAGE, FILE_UPLOAD, TIME, EMAIL, ADDRESS, PHONE, COUNTRY, DATE_PICKER, CONSENT, SECTION_HEADER, SEPARATOR, HEADING, PARAGRAPH); + + private ElementType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ElementType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ElementType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Options extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("value", "label"); + + private Options(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Options} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Options fromJson(JsonNode json) { + return new Options(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The value field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional value() { + return Json.optional(json, "value", Conv.STRING); + } + + /** + * The label field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public Map label() { + return Json.required(json, "label", Conv.map(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Options}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Options from) { + super(from); + } + + /** + * The value field. + * + * @param value the value + * @return this builder + */ + public Builder value(String value) { + return set("value", Conv.STRING, value); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(Map label) { + return set("label", Conv.map(Conv.STRING), label); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Options} + * @throws IllegalStateException when a required field is missing + */ + public Options build() { + require("label", false); + return new Options(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Optional format validation for short_text, long_text, or number. Enforced while the user fills the field (they cannot proceed until it passes) and re-checked by the API on submission. + */ + public static final class Validation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("pattern", "min_length", "max_length", "min", "max", "error_message"); + + private Validation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Validation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Validation fromJson(JsonNode json) { + return new Validation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Regular expression (ECMA-262 subset) the value must fully match. For short_text and long_text. Do not add ^/$ anchors; the whole value is matched. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pattern() { + return Json.optional(json, "pattern", Conv.STRING); + } + + /** + * Minimum number of characters. For short_text and long_text. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minLength() { + return Json.optional(json, "min_length", Conv.LONG); + } + + /** + * Maximum number of characters. For short_text and long_text. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxLength() { + return Json.optional(json, "max_length", Conv.LONG); + } + + /** + * Minimum numeric value. For number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional min() { + return Json.optional(json, "min", Conv.DOUBLE); + } + + /** + * Maximum numeric value. For number. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional max() { + return Json.optional(json, "max", Conv.DOUBLE); + } + + /** + * Translated message shown when validation fails, keyed by language code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> errorMessage() { + return Json.optional(json, "error_message", Conv.map(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Validation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Validation from) { + super(from); + } + + /** + * Regular expression (ECMA-262 subset) the value must fully match. For short_text and long_text. Do not add ^/$ anchors; the whole value is matched. + * + * @param pattern the value + * @return this builder + */ + public Builder pattern(String pattern) { + return set("pattern", Conv.STRING, pattern); + } + + /** + * Minimum number of characters. For short_text and long_text. + * + * @param minLength the value + * @return this builder + */ + public Builder minLength(long minLength) { + return set("min_length", Conv.LONG, minLength); + } + + /** + * Maximum number of characters. For short_text and long_text. + * + * @param maxLength the value + * @return this builder + */ + public Builder maxLength(long maxLength) { + return set("max_length", Conv.LONG, maxLength); + } + + /** + * Minimum numeric value. For number. + * + * @param min the value + * @return this builder + */ + public Builder min(double min) { + return set("min", Conv.DOUBLE, min); + } + + /** + * Maximum numeric value. For number. + * + * @param max the value + * @return this builder + */ + public Builder max(double max) { + return set("max", Conv.DOUBLE, max); + } + + /** + * Translated message shown when validation fails, keyed by language code. + * + * @param errorMessage the value + * @return this builder + */ + public Builder errorMessage(Map errorMessage) { + return set("error_message", Conv.map(Conv.STRING), errorMessage); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Validation} + */ + public Validation build() { + return new Validation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/SimpleQuestionnaireRequest.java b/src/main/java/me/didit/types/SimpleQuestionnaireRequest.java new file mode 100644 index 0000000..929e50b --- /dev/null +++ b/src/main/java/me/didit/types/SimpleQuestionnaireRequest.java @@ -0,0 +1,270 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Create a simple linear questionnaire. The API converts form_elements into the internal questionnaire graph. + */ +public final class SimpleQuestionnaireRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "description", "languages", "default_language", "is_active", "status", "form_elements"); + + private SimpleQuestionnaireRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SimpleQuestionnaireRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SimpleQuestionnaireRequest fromJson(JsonNode json) { + return new SimpleQuestionnaireRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Internal name for the questionnaire. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String title() { + return Json.required(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Languages included in every label. Must include en. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List languages() { + return Json.required(json, "languages", Conv.list(Conv.STRING)); + } + + /** + * Default language. Must be included in languages. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultLanguage() { + return Json.optional(json, "default_language", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * Omit this field to create a published questionnaire ready for workflows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SimpleQuestionnaireRequest.Status::of)); + } + + /** + * Questions in the exact order users should see them. Branching and conditional fields are not supported. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List formElements() { + return Json.required(json, "form_elements", Conv.list(Conv.model(SimpleQuestionnaireElement::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SimpleQuestionnaireRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SimpleQuestionnaireRequest from) { + super(from); + } + + /** + * Internal name for the questionnaire. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Languages included in every label. Must include en. + * + * @param languages the value + * @return this builder + */ + public Builder languages(List languages) { + return set("languages", Conv.list(Conv.STRING), languages); + } + + /** + * Default language. Must be included in languages. + * + * @param defaultLanguage the value + * @return this builder + */ + public Builder defaultLanguage(String defaultLanguage) { + return set("default_language", Conv.STRING, defaultLanguage); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * Omit this field to create a published questionnaire ready for workflows. + * + * @param status the value + * @return this builder + */ + public Builder status(SimpleQuestionnaireRequest.Status status) { + return set("status", Conv.enumeration(SimpleQuestionnaireRequest.Status::of), status); + } + + /** + * Questions in the exact order users should see them. Branching and conditional fields are not supported. + * + * @param formElements the value + * @return this builder + */ + public Builder formElements(List formElements) { + return set("form_elements", Conv.list(Conv.model(SimpleQuestionnaireElement::fromJson)), formElements); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SimpleQuestionnaireRequest} + * @throws IllegalStateException when a required field is missing + */ + public SimpleQuestionnaireRequest build() { + require("title", false); + require("languages", false); + require("form_elements", false); + return new SimpleQuestionnaireRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Omit this field to create a published questionnaire ready for workflows. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SimpleQuestionnaireUpdateRequest.java b/src/main/java/me/didit/types/SimpleQuestionnaireUpdateRequest.java new file mode 100644 index 0000000..dbbb935 --- /dev/null +++ b/src/main/java/me/didit/types/SimpleQuestionnaireUpdateRequest.java @@ -0,0 +1,263 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Update questionnaire metadata or replace the full linear form_elements list. */ +public final class SimpleQuestionnaireUpdateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "description", "languages", "default_language", "is_active", "status", "form_elements"); + + private SimpleQuestionnaireUpdateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SimpleQuestionnaireUpdateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SimpleQuestionnaireUpdateRequest fromJson(JsonNode json) { + return new SimpleQuestionnaireUpdateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The languages field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> languages() { + return Json.optional(json, "languages", Conv.list(Conv.STRING)); + } + + /** + * The default_language field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultLanguage() { + return Json.optional(json, "default_language", Conv.STRING); + } + + /** + * The is_active field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isActive() { + return Json.optional(json, "is_active", Conv.BOOLEAN); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SimpleQuestionnaireUpdateRequest.Status::of)); + } + + /** + * If provided, this replaces the full linear question list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> formElements() { + return Json.optional(json, "form_elements", Conv.list(Conv.model(SimpleQuestionnaireElement::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SimpleQuestionnaireUpdateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SimpleQuestionnaireUpdateRequest from) { + super(from); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The languages field. + * + * @param languages the value + * @return this builder + */ + public Builder languages(List languages) { + return set("languages", Conv.list(Conv.STRING), languages); + } + + /** + * The default_language field. + * + * @param defaultLanguage the value + * @return this builder + */ + public Builder defaultLanguage(String defaultLanguage) { + return set("default_language", Conv.STRING, defaultLanguage); + } + + /** + * The is_active field. + * + * @param isActive the value + * @return this builder + */ + public Builder isActive(boolean isActive) { + return set("is_active", Conv.BOOLEAN, isActive); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(SimpleQuestionnaireUpdateRequest.Status status) { + return set("status", Conv.enumeration(SimpleQuestionnaireUpdateRequest.Status::of), status); + } + + /** + * If provided, this replaces the full linear question list. + * + * @param formElements the value + * @return this builder + */ + public Builder formElements(List formElements) { + return set("form_elements", Conv.list(Conv.model(SimpleQuestionnaireElement::fromJson)), formElements); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SimpleQuestionnaireUpdateRequest} + */ + public SimpleQuestionnaireUpdateRequest build() { + return new SimpleQuestionnaireUpdateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SimpleWorkflowFeature.java b/src/main/java/me/didit/types/SimpleWorkflowFeature.java new file mode 100644 index 0000000..6de4181 --- /dev/null +++ b/src/main/java/me/didit/types/SimpleWorkflowFeature.java @@ -0,0 +1,226 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class SimpleWorkflowFeature extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "config", "label"); + + private SimpleWorkflowFeature(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SimpleWorkflowFeature} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SimpleWorkflowFeature fromJson(JsonNode json) { + return new SimpleWorkflowFeature(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Feature to run. Use the uppercase values shown here. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public SimpleWorkflowFeature.Feature feature() { + return Json.required(json, "feature", Conv.enumeration(SimpleWorkflowFeature.Feature::of)); + } + + /** + * Feature-specific settings. For QUESTIONNAIRE, include questionnaire_uuid with the questionnaire_id returned by the questionnaire create endpoint. For OCR, methods selects which ID Verification methods each country may use (document capture, non-doc lookup against a government or other authoritative source, and digital identity wallets); omit it and every country is document capture only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> config() { + return Json.optional(json, "config", Conv.OBJECT); + } + + /** + * Optional internal label for this workflow node. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SimpleWorkflowFeature}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SimpleWorkflowFeature from) { + super(from); + } + + /** + * Feature to run. Use the uppercase values shown here. + * + * @param feature the value + * @return this builder + */ + public Builder feature(SimpleWorkflowFeature.Feature feature) { + return set("feature", Conv.enumeration(SimpleWorkflowFeature.Feature::of), feature); + } + + /** + * Feature-specific settings. For QUESTIONNAIRE, include questionnaire_uuid with the questionnaire_id returned by the questionnaire create endpoint. For OCR, methods selects which ID Verification methods each country may use (document capture, non-doc lookup against a government or other authoritative source, and digital identity wallets); omit it and every country is document capture only. + * + * @param config the value + * @return this builder + */ + public Builder config(Map config) { + return setAny("config", config); + } + + /** + * Optional internal label for this workflow node. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SimpleWorkflowFeature} + * @throws IllegalStateException when a required field is missing + */ + public SimpleWorkflowFeature build() { + require("feature", false); + return new SimpleWorkflowFeature(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Feature to run. Use the uppercase values shown here. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Feature extends StringEnum { + /** The value {@code "OCR"}. */ + public static final Feature OCR = new Feature("OCR"); + + /** The value {@code "NFC"}. */ + public static final Feature NFC = new Feature("NFC"); + + /** The value {@code "LIVENESS"}. */ + public static final Feature LIVENESS = new Feature("LIVENESS"); + + /** The value {@code "FACE_MATCH"}. */ + public static final Feature FACE_MATCH = new Feature("FACE_MATCH"); + + /** The value {@code "PROOF_OF_ADDRESS"}. */ + public static final Feature PROOF_OF_ADDRESS = new Feature("PROOF_OF_ADDRESS"); + + /** The value {@code "QUESTIONNAIRE"}. */ + public static final Feature QUESTIONNAIRE = new Feature("QUESTIONNAIRE"); + + /** The value {@code "DOCUMENT_AI"}. */ + public static final Feature DOCUMENT_AI = new Feature("DOCUMENT_AI"); + + /** The value {@code "PHONE_VERIFICATION"}. */ + public static final Feature PHONE_VERIFICATION = new Feature("PHONE_VERIFICATION"); + + /** The value {@code "EMAIL_VERIFICATION"}. */ + public static final Feature EMAIL_VERIFICATION = new Feature("EMAIL_VERIFICATION"); + + /** The value {@code "DATABASE_VALIDATION"}. */ + public static final Feature DATABASE_VALIDATION = new Feature("DATABASE_VALIDATION"); + + /** The value {@code "AML"}. */ + public static final Feature AML = new Feature("AML"); + + /** The value {@code "IP_ANALYSIS"}. */ + public static final Feature IP_ANALYSIS = new Feature("IP_ANALYSIS"); + + /** The value {@code "AGE_ESTIMATION"}. */ + public static final Feature AGE_ESTIMATION = new Feature("AGE_ESTIMATION"); + + /** The value {@code "KYB_REGISTRY"}. */ + public static final Feature KYB_REGISTRY = new Feature("KYB_REGISTRY"); + + /** The value {@code "KYB_DOCUMENTS"}. */ + public static final Feature KYB_DOCUMENTS = new Feature("KYB_DOCUMENTS"); + + /** The value {@code "KYB_KEY_PEOPLE"}. */ + public static final Feature KYB_KEY_PEOPLE = new Feature("KYB_KEY_PEOPLE"); + + private static final List KNOWN_VALUES = List.of(OCR, NFC, LIVENESS, FACE_MATCH, PROOF_OF_ADDRESS, QUESTIONNAIRE, DOCUMENT_AI, PHONE_VERIFICATION, EMAIL_VERIFICATION, DATABASE_VALIDATION, AML, IP_ANALYSIS, AGE_ESTIMATION, KYB_REGISTRY, KYB_DOCUMENTS, KYB_KEY_PEOPLE); + + private Feature(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Feature of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Feature::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SimpleWorkflowRequest.java b/src/main/java/me/didit/types/SimpleWorkflowRequest.java new file mode 100644 index 0000000..ac54780 --- /dev/null +++ b/src/main/java/me/didit/types/SimpleWorkflowRequest.java @@ -0,0 +1,348 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Create a simple linear workflow. The API converts this feature list into a node-based workflow graph internally. STRICT field whitelist: any key not listed here (including workflow_type) is rejected with a 400. + */ +public final class SimpleWorkflowRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("workflow_label", "is_default", "status", "features", "is_white_label_enabled", "is_desktop_allowed", "max_retry_attempts", "retry_window_days", "face_liveness_max_attempts", "face_match_max_attempts", "session_expiration_time"); + + private SimpleWorkflowRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SimpleWorkflowRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SimpleWorkflowRequest fromJson(JsonNode json) { + return new SimpleWorkflowRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Display name for the workflow (max 50 characters). Defaults to "ID Verification" when omitted โ€” always set it so workflows stay distinguishable. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowLabel() { + return Json.optional(json, "workflow_label", Conv.STRING); + } + + /** + * Set this workflow as the default for new sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDefault() { + return Json.optional(json, "is_default", Conv.BOOLEAN); + } + + /** + * Omit this field to create a published workflow ready for sessions. Use draft only when you want to save without publishing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SimpleWorkflowRequest.Status::of)); + } + + /** + * Verification features in execution order. The API links each item to the next one and adds one final status node automatically. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List features() { + return Json.required(json, "features", Conv.list(Conv.model(SimpleWorkflowFeature::fromJson))); + } + + /** + * Enable white-label customization for sessions created with this workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isWhiteLabelEnabled() { + return Json.optional(json, "is_white_label_enabled", Conv.BOOLEAN); + } + + /** + * Allow the verification flow to run on desktop browsers. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDesktopAllowed() { + return Json.optional(json, "is_desktop_allowed", Conv.BOOLEAN); + } + + /** + * Maximum retry attempts allowed after a declined verification. 0 blocks the user after the first decline. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxRetryAttempts() { + return Json.optional(json, "max_retry_attempts", Conv.LONG); + } + + /** + * Rolling window in days used to count retries. null enforces an all-time limit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retryWindowDays() { + return Json.optional(json, "retry_window_days", Conv.LONG); + } + + /** + * Maximum liveness submissions per session. Default 3: one initial attempt plus two retries. This value is also copied into generated liveness and age-estimation workflow nodes unless the feature-level config overrides it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceLivenessMaxAttempts() { + return Json.optional(json, "face_liveness_max_attempts", Conv.LONG); + } + + /** + * Maximum face-match submissions per session. Default 3: one initial attempt plus two retries. This value is also copied into generated face-match workflow nodes unless the feature-level config overrides it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatchMaxAttempts() { + return Json.optional(json, "face_match_max_attempts", Conv.LONG); + } + + /** + * Seconds before an unfinished session expires. Minimum 1 hour (3600), maximum 4 weeks (2419200). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionExpirationTime() { + return Json.optional(json, "session_expiration_time", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SimpleWorkflowRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SimpleWorkflowRequest from) { + super(from); + } + + /** + * Display name for the workflow (max 50 characters). Defaults to "ID Verification" when omitted โ€” always set it so workflows stay distinguishable. + * + * @param workflowLabel the value + * @return this builder + */ + public Builder workflowLabel(String workflowLabel) { + return set("workflow_label", Conv.STRING, workflowLabel); + } + + /** + * Set this workflow as the default for new sessions. + * + * @param isDefault the value + * @return this builder + */ + public Builder isDefault(boolean isDefault) { + return set("is_default", Conv.BOOLEAN, isDefault); + } + + /** + * Omit this field to create a published workflow ready for sessions. Use draft only when you want to save without publishing. + * + * @param status the value + * @return this builder + */ + public Builder status(SimpleWorkflowRequest.Status status) { + return set("status", Conv.enumeration(SimpleWorkflowRequest.Status::of), status); + } + + /** + * Verification features in execution order. The API links each item to the next one and adds one final status node automatically. + * + * @param features the value + * @return this builder + */ + public Builder features(List features) { + return set("features", Conv.list(Conv.model(SimpleWorkflowFeature::fromJson)), features); + } + + /** + * Enable white-label customization for sessions created with this workflow. + * + * @param isWhiteLabelEnabled the value + * @return this builder + */ + public Builder isWhiteLabelEnabled(boolean isWhiteLabelEnabled) { + return set("is_white_label_enabled", Conv.BOOLEAN, isWhiteLabelEnabled); + } + + /** + * Allow the verification flow to run on desktop browsers. + * + * @param isDesktopAllowed the value + * @return this builder + */ + public Builder isDesktopAllowed(boolean isDesktopAllowed) { + return set("is_desktop_allowed", Conv.BOOLEAN, isDesktopAllowed); + } + + /** + * Maximum retry attempts allowed after a declined verification. 0 blocks the user after the first decline. + * + * @param maxRetryAttempts the value + * @return this builder + */ + public Builder maxRetryAttempts(long maxRetryAttempts) { + return set("max_retry_attempts", Conv.LONG, maxRetryAttempts); + } + + /** + * Rolling window in days used to count retries. null enforces an all-time limit. + * + * @param retryWindowDays the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retryWindowDays(@Nullable Long retryWindowDays) { + return setNullable("retry_window_days", Conv.LONG, retryWindowDays); + } + + /** + * Maximum liveness submissions per session. Default 3: one initial attempt plus two retries. This value is also copied into generated liveness and age-estimation workflow nodes unless the feature-level config overrides it. + * + * @param faceLivenessMaxAttempts the value + * @return this builder + */ + public Builder faceLivenessMaxAttempts(long faceLivenessMaxAttempts) { + return set("face_liveness_max_attempts", Conv.LONG, faceLivenessMaxAttempts); + } + + /** + * Maximum face-match submissions per session. Default 3: one initial attempt plus two retries. This value is also copied into generated face-match workflow nodes unless the feature-level config overrides it. + * + * @param faceMatchMaxAttempts the value + * @return this builder + */ + public Builder faceMatchMaxAttempts(long faceMatchMaxAttempts) { + return set("face_match_max_attempts", Conv.LONG, faceMatchMaxAttempts); + } + + /** + * Seconds before an unfinished session expires. Minimum 1 hour (3600), maximum 4 weeks (2419200). + * + * @param sessionExpirationTime the value + * @return this builder + */ + public Builder sessionExpirationTime(long sessionExpirationTime) { + return set("session_expiration_time", Conv.LONG, sessionExpirationTime); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SimpleWorkflowRequest} + * @throws IllegalStateException when a required field is missing + */ + public SimpleWorkflowRequest build() { + require("features", false); + return new SimpleWorkflowRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Omit this field to create a published workflow ready for sessions. Use draft only when you want to save without publishing. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SimpleWorkflowUpdateRequest.java b/src/main/java/me/didit/types/SimpleWorkflowUpdateRequest.java new file mode 100644 index 0000000..0dc9099 --- /dev/null +++ b/src/main/java/me/didit/types/SimpleWorkflowUpdateRequest.java @@ -0,0 +1,346 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Update workflow metadata or replace the full linear feature list. STRICT field whitelist: any key not listed here is rejected with a 400. + */ +public final class SimpleWorkflowUpdateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("workflow_label", "is_default", "status", "features", "is_white_label_enabled", "is_desktop_allowed", "max_retry_attempts", "retry_window_days", "face_liveness_max_attempts", "face_match_max_attempts", "session_expiration_time"); + + private SimpleWorkflowUpdateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SimpleWorkflowUpdateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SimpleWorkflowUpdateRequest fromJson(JsonNode json) { + return new SimpleWorkflowUpdateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Display name for the workflow (max 50 characters). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowLabel() { + return Json.optional(json, "workflow_label", Conv.STRING); + } + + /** + * Set this workflow as the default for new sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDefault() { + return Json.optional(json, "is_default", Conv.BOOLEAN); + } + + /** + * Controls versioning. Omit to update the current version in place (drafts auto-publish). published on an already-published version creates and returns a NEW version. draft is only valid while the version is still a draft. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(SimpleWorkflowUpdateRequest.Status::of)); + } + + /** + * If provided, this replaces the full feature order and configuration. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.list(Conv.model(SimpleWorkflowFeature::fromJson))); + } + + /** + * Enable white-label customization for sessions created with this workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isWhiteLabelEnabled() { + return Json.optional(json, "is_white_label_enabled", Conv.BOOLEAN); + } + + /** + * Allow the verification flow to run on desktop browsers. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDesktopAllowed() { + return Json.optional(json, "is_desktop_allowed", Conv.BOOLEAN); + } + + /** + * Maximum retry attempts allowed after a declined verification. 0 blocks the user after the first decline. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxRetryAttempts() { + return Json.optional(json, "max_retry_attempts", Conv.LONG); + } + + /** + * Rolling window in days used to count retries. null enforces an all-time limit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retryWindowDays() { + return Json.optional(json, "retry_window_days", Conv.LONG); + } + + /** + * Maximum liveness submissions per session. This value is also copied into generated liveness and age-estimation workflow nodes unless the feature-level config overrides it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceLivenessMaxAttempts() { + return Json.optional(json, "face_liveness_max_attempts", Conv.LONG); + } + + /** + * Maximum face-match submissions per session. This value is also copied into generated face-match workflow nodes unless the feature-level config overrides it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional faceMatchMaxAttempts() { + return Json.optional(json, "face_match_max_attempts", Conv.LONG); + } + + /** + * Seconds before an unfinished session expires. Minimum 1 hour (3600), maximum 4 weeks (2419200). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionExpirationTime() { + return Json.optional(json, "session_expiration_time", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SimpleWorkflowUpdateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SimpleWorkflowUpdateRequest from) { + super(from); + } + + /** + * Display name for the workflow (max 50 characters). + * + * @param workflowLabel the value + * @return this builder + */ + public Builder workflowLabel(String workflowLabel) { + return set("workflow_label", Conv.STRING, workflowLabel); + } + + /** + * Set this workflow as the default for new sessions. + * + * @param isDefault the value + * @return this builder + */ + public Builder isDefault(boolean isDefault) { + return set("is_default", Conv.BOOLEAN, isDefault); + } + + /** + * Controls versioning. Omit to update the current version in place (drafts auto-publish). published on an already-published version creates and returns a NEW version. draft is only valid while the version is still a draft. + * + * @param status the value + * @return this builder + */ + public Builder status(SimpleWorkflowUpdateRequest.Status status) { + return set("status", Conv.enumeration(SimpleWorkflowUpdateRequest.Status::of), status); + } + + /** + * If provided, this replaces the full feature order and configuration. + * + * @param features the value + * @return this builder + */ + public Builder features(List features) { + return set("features", Conv.list(Conv.model(SimpleWorkflowFeature::fromJson)), features); + } + + /** + * Enable white-label customization for sessions created with this workflow. + * + * @param isWhiteLabelEnabled the value + * @return this builder + */ + public Builder isWhiteLabelEnabled(boolean isWhiteLabelEnabled) { + return set("is_white_label_enabled", Conv.BOOLEAN, isWhiteLabelEnabled); + } + + /** + * Allow the verification flow to run on desktop browsers. + * + * @param isDesktopAllowed the value + * @return this builder + */ + public Builder isDesktopAllowed(boolean isDesktopAllowed) { + return set("is_desktop_allowed", Conv.BOOLEAN, isDesktopAllowed); + } + + /** + * Maximum retry attempts allowed after a declined verification. 0 blocks the user after the first decline. + * + * @param maxRetryAttempts the value + * @return this builder + */ + public Builder maxRetryAttempts(long maxRetryAttempts) { + return set("max_retry_attempts", Conv.LONG, maxRetryAttempts); + } + + /** + * Rolling window in days used to count retries. null enforces an all-time limit. + * + * @param retryWindowDays the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retryWindowDays(@Nullable Long retryWindowDays) { + return setNullable("retry_window_days", Conv.LONG, retryWindowDays); + } + + /** + * Maximum liveness submissions per session. This value is also copied into generated liveness and age-estimation workflow nodes unless the feature-level config overrides it. + * + * @param faceLivenessMaxAttempts the value + * @return this builder + */ + public Builder faceLivenessMaxAttempts(long faceLivenessMaxAttempts) { + return set("face_liveness_max_attempts", Conv.LONG, faceLivenessMaxAttempts); + } + + /** + * Maximum face-match submissions per session. This value is also copied into generated face-match workflow nodes unless the feature-level config overrides it. + * + * @param faceMatchMaxAttempts the value + * @return this builder + */ + public Builder faceMatchMaxAttempts(long faceMatchMaxAttempts) { + return set("face_match_max_attempts", Conv.LONG, faceMatchMaxAttempts); + } + + /** + * Seconds before an unfinished session expires. Minimum 1 hour (3600), maximum 4 weeks (2419200). + * + * @param sessionExpirationTime the value + * @return this builder + */ + public Builder sessionExpirationTime(long sessionExpirationTime) { + return set("session_expiration_time", Conv.LONG, sessionExpirationTime); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SimpleWorkflowUpdateRequest} + */ + public SimpleWorkflowUpdateRequest build() { + return new SimpleWorkflowUpdateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Controls versioning. Omit to update the current version in place (drafts auto-publish). published on an already-published version creates and returns a NEW version. draft is only valid while the version is still a draft. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SocialFootprintCategorySummary.java b/src/main/java/me/didit/types/SocialFootprintCategorySummary.java new file mode 100644 index 0000000..483b56b --- /dev/null +++ b/src/main/java/me/didit/types/SocialFootprintCategorySummary.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class SocialFootprintCategorySummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("registered", "ratio"); + + private SocialFootprintCategorySummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SocialFootprintCategorySummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SocialFootprintCategorySummary fromJson(JsonNode json) { + return new SocialFootprintCategorySummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Platforms in this category where registration is confirmed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional registered() { + return Json.optional(json, "registered", Conv.LONG); + } + + /** + * Share of the category's checked platforms with a registration, 0.0-1.0. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ratio() { + return Json.optional(json, "ratio", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SocialFootprintCategorySummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SocialFootprintCategorySummary from) { + super(from); + } + + /** + * Platforms in this category where registration is confirmed. + * + * @param registered the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder registered(@Nullable Long registered) { + return setNullable("registered", Conv.LONG, registered); + } + + /** + * Share of the category's checked platforms with a registration, 0.0-1.0. + * + * @param ratio the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ratio(@Nullable Double ratio) { + return setNullable("ratio", Conv.DOUBLE, ratio); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SocialFootprintCategorySummary} + */ + public SocialFootprintCategorySummary build() { + return new SocialFootprintCategorySummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/SocialFootprintPlatform.java b/src/main/java/me/didit/types/SocialFootprintPlatform.java new file mode 100644 index 0000000..027a4a8 --- /dev/null +++ b/src/main/java/me/didit/types/SocialFootprintPlatform.java @@ -0,0 +1,182 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class SocialFootprintPlatform extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("platform", "category", "scope"); + + private SocialFootprintPlatform(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SocialFootprintPlatform} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SocialFootprintPlatform fromJson(JsonNode json) { + return new SocialFootprintPlatform(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Platform identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platform() { + return Json.optional(json, "platform", Conv.STRING); + } + + /** + * Platform category, e.g. MESSAGING, SOCIAL_MEDIA, ECOMMERCE, PROFESSIONAL, EMAIL_PROVIDER. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * global for worldwide platforms, local for region-specific ones. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scope() { + return Json.optional(json, "scope", Conv.enumeration(SocialFootprintPlatform.Scope::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SocialFootprintPlatform}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SocialFootprintPlatform from) { + super(from); + } + + /** + * Platform identifier. + * + * @param platform the value + * @return this builder + */ + public Builder platform(String platform) { + return set("platform", Conv.STRING, platform); + } + + /** + * Platform category, e.g. MESSAGING, SOCIAL_MEDIA, ECOMMERCE, PROFESSIONAL, EMAIL_PROVIDER. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * global for worldwide platforms, local for region-specific ones. + * + * @param scope the value + * @return this builder + */ + public Builder scope(SocialFootprintPlatform.Scope scope) { + return set("scope", Conv.enumeration(SocialFootprintPlatform.Scope::of), scope); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SocialFootprintPlatform} + */ + public SocialFootprintPlatform build() { + return new SocialFootprintPlatform(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * global for worldwide platforms, local for region-specific ones. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Scope extends StringEnum { + /** The value {@code "global"}. */ + public static final Scope GLOBAL = new Scope("global"); + + /** The value {@code "local"}. */ + public static final Scope LOCAL = new Scope("local"); + + private static final List KNOWN_VALUES = List.of(GLOBAL, LOCAL); + + private Scope(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Scope of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Scope::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/SocialFootprintProfile.java b/src/main/java/me/didit/types/SocialFootprintProfile.java new file mode 100644 index 0000000..2c4adb7 --- /dev/null +++ b/src/main/java/me/didit/types/SocialFootprintProfile.java @@ -0,0 +1,223 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class SocialFootprintProfile extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "photo", "about", "privacy_status", "business_account"); + + private SocialFootprintProfile(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SocialFootprintProfile} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SocialFootprintProfile fromJson(JsonNode json) { + return new SocialFootprintProfile(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profile name, when the platform exposes one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * Profile photo URL, when the platform exposes one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional photo() { + return Json.optional(json, "photo", Conv.STRING); + } + + /** + * Profile about/bio text, when the platform exposes one. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional about() { + return Json.optional(json, "about", Conv.STRING); + } + + /** + * Profile visibility, when the platform exposes it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional privacyStatus() { + return Json.optional(json, "privacy_status", Conv.enumeration(SocialFootprintProfile.PrivacyStatus::of)); + } + + /** + * Whether the profile is a business account, when the platform exposes it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional businessAccount() { + return Json.optional(json, "business_account", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SocialFootprintProfile}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SocialFootprintProfile from) { + super(from); + } + + /** + * Profile name, when the platform exposes one. + * + * @param name the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder name(@Nullable String name) { + return setNullable("name", Conv.STRING, name); + } + + /** + * Profile photo URL, when the platform exposes one. + * + * @param photo the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder photo(@Nullable String photo) { + return setNullable("photo", Conv.STRING, photo); + } + + /** + * Profile about/bio text, when the platform exposes one. + * + * @param about the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder about(@Nullable String about) { + return setNullable("about", Conv.STRING, about); + } + + /** + * Profile visibility, when the platform exposes it. + * + * @param privacyStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder privacyStatus(SocialFootprintProfile.@Nullable PrivacyStatus privacyStatus) { + return setNullable("privacy_status", Conv.enumeration(SocialFootprintProfile.PrivacyStatus::of), privacyStatus); + } + + /** + * Whether the profile is a business account, when the platform exposes it. + * + * @param businessAccount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder businessAccount(@Nullable Boolean businessAccount) { + return setNullable("business_account", Conv.BOOLEAN, businessAccount); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SocialFootprintProfile} + */ + public SocialFootprintProfile build() { + return new SocialFootprintProfile(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Profile visibility, when the platform exposes it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PrivacyStatus extends StringEnum { + /** The value {@code "PUBLIC"}. */ + public static final PrivacyStatus PUBLIC = new PrivacyStatus("PUBLIC"); + + /** The value {@code "PRIVATE"}. */ + public static final PrivacyStatus PRIVATE = new PrivacyStatus("PRIVATE"); + + private static final List KNOWN_VALUES = List.of(PUBLIC, PRIVATE); + + private PrivacyStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PrivacyStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PrivacyStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionDetail.java b/src/main/java/me/didit/types/TransactionDetail.java new file mode 100644 index 0000000..25c20a8 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionDetail.java @@ -0,0 +1,5403 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Full monitoring record for one transaction, as returned by GET /v3/transactions/{transaction_id}/ and POST /v3/transactions/. + */ +public final class TransactionDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "environment", "transaction_number", "txn_id", "txn_date", "zone_id", "transaction_type", "action_type", "direction", "status", "source", "amount", "currency", "currency_type", "amount_in_default_currency", "default_currency_code", "preferred_currency_amount", "preferred_currency_code", "payment_details", "payment_txn_id", "score", "severity", "decision_reason_code", "decision_reason_label", "vendor_data", "metadata", "props", "tags", "parties", "payment_methods", "documents", "activities", "alerts", "rule_runs", "provider_results", "travel_rule", "network_snapshot", "remediation", "action_required", "cost_breakdown"); + + private TransactionDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionDetail fromJson(JsonNode json) { + return new TransactionDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit-stable transaction identifier. Use as {transaction_id} for follow-up calls. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Environment of the application that owns the transaction. A sandbox transaction is stored but never evaluated, screened, notified or billed, so its empty rule_runs means "not evaluated". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional environment() { + return Json.optional(json, "environment", Conv.enumeration(TransactionDetail.Environment::of)); + } + + /** + * Application-scoped sequential transaction number shown in Console (e.g. 4123). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionNumber() { + return Json.optional(json, "transaction_number", Conv.LONG); + } + + /** + * The transaction_id you supplied at create time (max 128 chars). Unique per application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional txnId() { + return Json.optional(json, "txn_id", Conv.STRING); + } + + /** + * When the transaction occurred (from transaction_at; defaults to submission time). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional txnDate() { + return Json.optional(json, "txn_date", Conv.DATE_TIME); + } + + /** + * IANA time zone identifier provided at create time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional zoneId() { + return Json.optional(json, "zone_id", Conv.STRING); + } + + /** + * Top-level category as stored: finance, kyc, travelRule, userPlatformEvent, gamblingBet, gamblingLimitChange, gamblingBonusChange, auditTrailEvent. Note multi-word values are echoed back in camelCase even when submitted in snake_case. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionType() { + return Json.optional(json, "transaction_type", Conv.STRING); + } + + /** + * Sub-type within the category (e.g. deposit, withdrawal, transfer). Defaults to the category when not supplied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actionType() { + return Json.optional(json, "action_type", Conv.STRING); + } + + /** + * Direction relative to the subject. Stored uppercase regardless of the casing submitted (in/out/inbound/outbound are accepted on input). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional direction() { + return Json.optional(json, "direction", Conv.enumeration(TransactionDetail.Direction::of)); + } + + /** + * Current monitoring verdict. Transactions are created APPROVED; rules may flip them to IN_REVIEW/DECLINED synchronously. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(TransactionDetail.Status::of)); + } + + /** + * How the record originated: LIVE for transactions submitted through the API or SDK, IMPORTED for transactions loaded through the console import. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(TransactionDetail.Source::of)); + } + + /** + * Transaction amount as a decimal string with trailing zeros stripped (e.g. "1500", "0.5", "0.123456789012345678"). Up to 18 decimal places. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amount() { + return Json.optional(json, "amount", Conv.STRING); + } + + /** + * Currency code of amount. Any ISO 4217 alphabetic code is accepted (e.g. EUR, USD, NGN), as is a crypto asset symbol (e.g. BTC). Prefer a currently-circulating code. Not every accepted code has an exchange rate: when none is available for the code (for example the ISO accounting unit XSU, or a crypto symbol Didit does not price), automatic conversion fails and preferred_currency_amount is returned null unless the request supplied a pre-converted amount_in_default_currency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currency() { + return Json.optional(json, "currency", Conv.STRING); + } + + /** + * fiat or crypto, as submitted in currency_kind. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currencyType() { + return Json.optional(json, "currency_type", Conv.STRING); + } + + /** + * Pre-converted amount you supplied, as a decimal string with trailing zeros stripped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amountInDefaultCurrency() { + return Json.optional(json, "amount_in_default_currency", Conv.STRING); + } + + /** + * The default_currency_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultCurrencyCode() { + return Json.optional(json, "default_currency_code", Conv.STRING); + } + + /** + * amount converted to the application's preferred currency, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional preferredCurrencyAmount() { + return Json.optional(json, "preferred_currency_amount", Conv.STRING); + } + + /** + * The preferred_currency_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional preferredCurrencyCode() { + return Json.optional(json, "preferred_currency_code", Conv.STRING); + } + + /** + * Free-text payment reference or memo from the submission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentDetails() { + return Json.optional(json, "payment_details", Conv.STRING); + } + + /** + * External payment system reference (e.g. blockchain transaction hash) from payment_reference_id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentTxnId() { + return Json.optional(json, "payment_txn_id", Conv.STRING); + } + + /** + * Risk score accumulated by rules (typically 0โ€“100). Higher = riskier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * Categorical risk severity set by rules/providers (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL). null until something sets it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional severity() { + return Json.optional(json, "severity", Conv.enumeration(TransactionDetail.Severity::of)); + } + + /** + * Machine-readable reason for the current status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional decisionReasonCode() { + return Json.optional(json, "decision_reason_code", Conv.STRING); + } + + /** + * Human-readable label for decision_reason_code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional decisionReasonLabel() { + return Json.optional(json, "decision_reason_label", Conv.STRING); + } + + /** + * Convenience copy of the applicant's vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Snapshot of the subject and counterparty payloads as submitted at create time. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The custom_properties you supplied at create time. Each key is addressable in rule conditions as custom_values.<key>. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> props() { + return Json.optional(json, "props", Conv.OBJECT); + } + + /** + * Tags attached to the transaction (manually or by rules). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(TransactionDetail.Tags::fromJson))); + } + + /** + * Transaction parties (applicant, counterparty). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> parties() { + return Json.optional(json, "parties", Conv.list(Conv.model(TransactionDetail.Parties::fromJson))); + } + + /** + * Payment methods linked to the transaction. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> paymentMethods() { + return Json.optional(json, "payment_methods", Conv.list(Conv.model(TransactionDetail.PaymentMethods::fromJson))); + } + + /** + * Files attached to the transaction from the console. [] when none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> documents() { + return Json.optional(json, "documents", Conv.list(Conv.model(TransactionDetail.Documents::fromJson))); + } + + /** + * Activity log entries (creation, notes, manual reviews, status changes). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> activities() { + return Json.optional(json, "activities", Conv.list(Conv.model(TransactionDetail.Activities::fromJson))); + } + + /** + * Alerts raised by rules and providers. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> alerts() { + return Json.optional(json, "alerts", Conv.list(Conv.model(TransactionDetail.Alerts::fromJson))); + } + + /** + * Per-rule execution results โ€” which rule fired, with what score impact. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> ruleRuns() { + return Json.optional(json, "rule_runs", Conv.list(Conv.model(TransactionDetail.RuleRuns::fromJson))); + } + + /** + * Raw provider payloads (AML screening, blockchain analytics, etc.). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> providerResults() { + return Json.optional(json, "provider_results", Conv.list(Conv.model(TransactionDetail.ProviderResults::fromJson))); + } + + /** + * Travel Rule transfer or check. Populated when travel_rule_details was submitted, and also when Travel Rule is enabled and the transaction was created with transaction_category: travelRule (Didit initiates the exchange itself, even without travel_rule_details). null when no transfer or check exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelRule() { + return Json.optional(json, "travel_rule", Conv.model(TransactionDetail.TravelRule::fromJson)); + } + + /** + * Graph snapshot of related transactions/parties used by the rules engine. Either the network_snapshot submitted with the transaction or the graph Didit builds from a successful AML wallet screening (which replaces a submitted one). null when neither exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkSnapshot() { + return Json.optional(json, "network_snapshot", Conv.model(TransactionDetail.NetworkSnapshot::fromJson)); + } + + /** + * Remediation session offered to the user when re-verification is required. Superseded by action_required, which is the canonical block; kept for backward compatibility. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional remediation() { + return Json.optional(json, "remediation", Conv.model(TransactionDetail.Remediation::fromJson)); + } + + /** + * Pending end-user action required to complete this transaction, or null when there is none. The Didit SDKs auto-launch the action by default and refresh the transaction when it finishes. Two variants, discriminated by type: verification_session (a hosted verification session created by a rule action) and wallet_ownership (a wallet-ownership widget session auto-minted for a Travel Rule transfer that needs proof of wallet control, gated by the auto_wallet_verification Travel Rule setting). When both could apply, wallet_ownership takes precedence because it blocks the Travel Rule exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actionRequired() { + return Json.optional(json, "action_required", Conv.union(TransactionDetail.ActionRequired::fromJson)); + } + + /** + * Cost of this transaction: total_price and items, one per charge, each with usage_type, price, details and created_at. A re-screen of the same transaction is a new item. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> costBreakdown() { + return Json.optional(json, "cost_breakdown", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionDetail from) { + super(from); + } + + /** + * Didit-stable transaction identifier. Use as {transaction_id} for follow-up calls. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Environment of the application that owns the transaction. A sandbox transaction is stored but never evaluated, screened, notified or billed, so its empty rule_runs means "not evaluated". + * + * @param environment the value + * @return this builder + */ + public Builder environment(TransactionDetail.Environment environment) { + return set("environment", Conv.enumeration(TransactionDetail.Environment::of), environment); + } + + /** + * Application-scoped sequential transaction number shown in Console (e.g. 4123). + * + * @param transactionNumber the value + * @return this builder + */ + public Builder transactionNumber(long transactionNumber) { + return set("transaction_number", Conv.LONG, transactionNumber); + } + + /** + * The transaction_id you supplied at create time (max 128 chars). Unique per application. + * + * @param txnId the value + * @return this builder + */ + public Builder txnId(String txnId) { + return set("txn_id", Conv.STRING, txnId); + } + + /** + * When the transaction occurred (from transaction_at; defaults to submission time). + * + * @param txnDate the value + * @return this builder + */ + public Builder txnDate(OffsetDateTime txnDate) { + return set("txn_date", Conv.DATE_TIME, txnDate); + } + + /** + * IANA time zone identifier provided at create time. + * + * @param zoneId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder zoneId(@Nullable String zoneId) { + return setNullable("zone_id", Conv.STRING, zoneId); + } + + /** + * Top-level category as stored: finance, kyc, travelRule, userPlatformEvent, gamblingBet, gamblingLimitChange, gamblingBonusChange, auditTrailEvent. Note multi-word values are echoed back in camelCase even when submitted in snake_case. + * + * @param transactionType the value + * @return this builder + */ + public Builder transactionType(String transactionType) { + return set("transaction_type", Conv.STRING, transactionType); + } + + /** + * Sub-type within the category (e.g. deposit, withdrawal, transfer). Defaults to the category when not supplied. + * + * @param actionType the value + * @return this builder + */ + public Builder actionType(String actionType) { + return set("action_type", Conv.STRING, actionType); + } + + /** + * Direction relative to the subject. Stored uppercase regardless of the casing submitted (in/out/inbound/outbound are accepted on input). + * + * @param direction the value + * @return this builder + */ + public Builder direction(TransactionDetail.Direction direction) { + return set("direction", Conv.enumeration(TransactionDetail.Direction::of), direction); + } + + /** + * Current monitoring verdict. Transactions are created APPROVED; rules may flip them to IN_REVIEW/DECLINED synchronously. + * + * @param status the value + * @return this builder + */ + public Builder status(TransactionDetail.Status status) { + return set("status", Conv.enumeration(TransactionDetail.Status::of), status); + } + + /** + * How the record originated: LIVE for transactions submitted through the API or SDK, IMPORTED for transactions loaded through the console import. + * + * @param source the value + * @return this builder + */ + public Builder source(TransactionDetail.Source source) { + return set("source", Conv.enumeration(TransactionDetail.Source::of), source); + } + + /** + * Transaction amount as a decimal string with trailing zeros stripped (e.g. "1500", "0.5", "0.123456789012345678"). Up to 18 decimal places. + * + * @param amount the value + * @return this builder + */ + public Builder amount(String amount) { + return set("amount", Conv.STRING, amount); + } + + /** + * Currency code of amount. Any ISO 4217 alphabetic code is accepted (e.g. EUR, USD, NGN), as is a crypto asset symbol (e.g. BTC). Prefer a currently-circulating code. Not every accepted code has an exchange rate: when none is available for the code (for example the ISO accounting unit XSU, or a crypto symbol Didit does not price), automatic conversion fails and preferred_currency_amount is returned null unless the request supplied a pre-converted amount_in_default_currency. + * + * @param currency the value + * @return this builder + */ + public Builder currency(String currency) { + return set("currency", Conv.STRING, currency); + } + + /** + * fiat or crypto, as submitted in currency_kind. + * + * @param currencyType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder currencyType(@Nullable String currencyType) { + return setNullable("currency_type", Conv.STRING, currencyType); + } + + /** + * Pre-converted amount you supplied, as a decimal string with trailing zeros stripped. + * + * @param amountInDefaultCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amountInDefaultCurrency(@Nullable String amountInDefaultCurrency) { + return setNullable("amount_in_default_currency", Conv.STRING, amountInDefaultCurrency); + } + + /** + * The default_currency_code field. + * + * @param defaultCurrencyCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder defaultCurrencyCode(@Nullable String defaultCurrencyCode) { + return setNullable("default_currency_code", Conv.STRING, defaultCurrencyCode); + } + + /** + * amount converted to the application's preferred currency, when available. + * + * @param preferredCurrencyAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder preferredCurrencyAmount(@Nullable String preferredCurrencyAmount) { + return setNullable("preferred_currency_amount", Conv.STRING, preferredCurrencyAmount); + } + + /** + * The preferred_currency_code field. + * + * @param preferredCurrencyCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder preferredCurrencyCode(@Nullable String preferredCurrencyCode) { + return setNullable("preferred_currency_code", Conv.STRING, preferredCurrencyCode); + } + + /** + * Free-text payment reference or memo from the submission. + * + * @param paymentDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder paymentDetails(@Nullable String paymentDetails) { + return setNullable("payment_details", Conv.STRING, paymentDetails); + } + + /** + * External payment system reference (e.g. blockchain transaction hash) from payment_reference_id. + * + * @param paymentTxnId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder paymentTxnId(@Nullable String paymentTxnId) { + return setNullable("payment_txn_id", Conv.STRING, paymentTxnId); + } + + /** + * Risk score accumulated by rules (typically 0โ€“100). Higher = riskier. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * Categorical risk severity set by rules/providers (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL). null until something sets it. + * + * @param severity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder severity(TransactionDetail.@Nullable Severity severity) { + return setNullable("severity", Conv.enumeration(TransactionDetail.Severity::of), severity); + } + + /** + * Machine-readable reason for the current status. + * + * @param decisionReasonCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder decisionReasonCode(@Nullable String decisionReasonCode) { + return setNullable("decision_reason_code", Conv.STRING, decisionReasonCode); + } + + /** + * Human-readable label for decision_reason_code. + * + * @param decisionReasonLabel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder decisionReasonLabel(@Nullable String decisionReasonLabel) { + return setNullable("decision_reason_label", Conv.STRING, decisionReasonLabel); + } + + /** + * Convenience copy of the applicant's vendor_data. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Snapshot of the subject and counterparty payloads as submitted at create time. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The custom_properties you supplied at create time. Each key is addressable in rule conditions as custom_values.<key>. + * + * @param props the value + * @return this builder + */ + public Builder props(Map props) { + return setAny("props", props); + } + + /** + * Tags attached to the transaction (manually or by rules). + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(TransactionDetail.Tags::fromJson)), tags); + } + + /** + * Transaction parties (applicant, counterparty). + * + * @param parties the value + * @return this builder + */ + public Builder parties(List parties) { + return set("parties", Conv.list(Conv.model(TransactionDetail.Parties::fromJson)), parties); + } + + /** + * Payment methods linked to the transaction. + * + * @param paymentMethods the value + * @return this builder + */ + public Builder paymentMethods(List paymentMethods) { + return set("payment_methods", Conv.list(Conv.model(TransactionDetail.PaymentMethods::fromJson)), paymentMethods); + } + + /** + * Files attached to the transaction from the console. [] when none. + * + * @param documents the value + * @return this builder + */ + public Builder documents(List documents) { + return set("documents", Conv.list(Conv.model(TransactionDetail.Documents::fromJson)), documents); + } + + /** + * Activity log entries (creation, notes, manual reviews, status changes). + * + * @param activities the value + * @return this builder + */ + public Builder activities(List activities) { + return set("activities", Conv.list(Conv.model(TransactionDetail.Activities::fromJson)), activities); + } + + /** + * Alerts raised by rules and providers. + * + * @param alerts the value + * @return this builder + */ + public Builder alerts(List alerts) { + return set("alerts", Conv.list(Conv.model(TransactionDetail.Alerts::fromJson)), alerts); + } + + /** + * Per-rule execution results โ€” which rule fired, with what score impact. + * + * @param ruleRuns the value + * @return this builder + */ + public Builder ruleRuns(List ruleRuns) { + return set("rule_runs", Conv.list(Conv.model(TransactionDetail.RuleRuns::fromJson)), ruleRuns); + } + + /** + * Raw provider payloads (AML screening, blockchain analytics, etc.). + * + * @param providerResults the value + * @return this builder + */ + public Builder providerResults(List providerResults) { + return set("provider_results", Conv.list(Conv.model(TransactionDetail.ProviderResults::fromJson)), providerResults); + } + + /** + * Travel Rule transfer or check. Populated when travel_rule_details was submitted, and also when Travel Rule is enabled and the transaction was created with transaction_category: travelRule (Didit initiates the exchange itself, even without travel_rule_details). null when no transfer or check exists. + * + * @param travelRule the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder travelRule(TransactionDetail.@Nullable TravelRule travelRule) { + return setNullable("travel_rule", Conv.model(TransactionDetail.TravelRule::fromJson), travelRule); + } + + /** + * Graph snapshot of related transactions/parties used by the rules engine. Either the network_snapshot submitted with the transaction or the graph Didit builds from a successful AML wallet screening (which replaces a submitted one). null when neither exists. + * + * @param networkSnapshot the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder networkSnapshot(TransactionDetail.@Nullable NetworkSnapshot networkSnapshot) { + return setNullable("network_snapshot", Conv.model(TransactionDetail.NetworkSnapshot::fromJson), networkSnapshot); + } + + /** + * Remediation session offered to the user when re-verification is required. Superseded by action_required, which is the canonical block; kept for backward compatibility. + * + * @param remediation the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder remediation(TransactionDetail.@Nullable Remediation remediation) { + return setNullable("remediation", Conv.model(TransactionDetail.Remediation::fromJson), remediation); + } + + /** + * Pending end-user action required to complete this transaction, or null when there is none. The Didit SDKs auto-launch the action by default and refresh the transaction when it finishes. Two variants, discriminated by type: verification_session (a hosted verification session created by a rule action) and wallet_ownership (a wallet-ownership widget session auto-minted for a Travel Rule transfer that needs proof of wallet control, gated by the auto_wallet_verification Travel Rule setting). When both could apply, wallet_ownership takes precedence because it blocks the Travel Rule exchange. + * + * @param actionRequired the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actionRequired(TransactionDetail.@Nullable ActionRequired actionRequired) { + return setNullable("action_required", Conv.union(TransactionDetail.ActionRequired::fromJson), actionRequired); + } + + /** + * Cost of this transaction: total_price and items, one per charge, each with usage_type, price, details and created_at. A re-screen of the same transaction is a new item. + * + * @param costBreakdown the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder costBreakdown(@Nullable Map costBreakdown) { + return setAny("cost_breakdown", costBreakdown); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionDetail} + */ + public TransactionDetail build() { + return new TransactionDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Environment of the application that owns the transaction. A sandbox transaction is stored but never evaluated, screened, notified or billed, so its empty rule_runs means "not evaluated". + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Environment extends StringEnum { + /** The value {@code "live"}. */ + public static final Environment LIVE = new Environment("live"); + + /** The value {@code "sandbox"}. */ + public static final Environment SANDBOX = new Environment("sandbox"); + + private static final List KNOWN_VALUES = List.of(LIVE, SANDBOX); + + private Environment(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Environment of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Environment::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Direction relative to the subject. Stored uppercase regardless of the casing submitted (in/out/inbound/outbound are accepted on input). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Direction extends StringEnum { + /** The value {@code "INBOUND"}. */ + public static final Direction INBOUND = new Direction("INBOUND"); + + /** The value {@code "OUTBOUND"}. */ + public static final Direction OUTBOUND = new Direction("OUTBOUND"); + + private static final List KNOWN_VALUES = List.of(INBOUND, OUTBOUND); + + private Direction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Direction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Direction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Current monitoring verdict. Transactions are created APPROVED; rules may flip them to IN_REVIEW/DECLINED synchronously. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "APPROVED"}. */ + public static final Status APPROVED = new Status("APPROVED"); + + /** The value {@code "IN_REVIEW"}. */ + public static final Status IN_REVIEW = new Status("IN_REVIEW"); + + /** The value {@code "DECLINED"}. */ + public static final Status DECLINED = new Status("DECLINED"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED, AWAITING_USER); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * How the record originated: LIVE for transactions submitted through the API or SDK, IMPORTED for transactions loaded through the console import. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "LIVE"}. */ + public static final Source LIVE = new Source("LIVE"); + + /** The value {@code "IMPORTED"}. */ + public static final Source IMPORTED = new Source("IMPORTED"); + + private static final List KNOWN_VALUES = List.of(LIVE, IMPORTED); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Categorical risk severity set by rules/providers (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL). null until something sets it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Severity extends StringEnum { + /** The value {@code "UNKNOWN"}. */ + public static final Severity UNKNOWN = new Severity("UNKNOWN"); + + /** The value {@code "LOW"}. */ + public static final Severity LOW = new Severity("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Severity MEDIUM = new Severity("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Severity HIGH = new Severity("HIGH"); + + /** The value {@code "CRITICAL"}. */ + public static final Severity CRITICAL = new Severity("CRITICAL"); + + private static final List KNOWN_VALUES = List.of(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL); + + private Severity(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Severity of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Severity::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Tags extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "color", "description", "source"); + + private Tags(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tags} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tags fromJson(JsonNode json) { + return new Tags(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The color field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional color() { + return Json.optional(json, "color", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Whether the tag is a Didit preset or a custom tag. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(TransactionDetail.Tags.Source::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tags}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tags from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The color field. + * + * @param color the value + * @return this builder + */ + public Builder color(String color) { + return set("color", Conv.STRING, color); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Whether the tag is a Didit preset or a custom tag. + * + * @param source the value + * @return this builder + */ + public Builder source(TransactionDetail.Tags.Source source) { + return set("source", Conv.enumeration(TransactionDetail.Tags.Source::of), source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tags} + */ + public Tags build() { + return new Tags(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the tag is a Didit preset or a custom tag. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "didit"}. */ + public static final Source DIDIT = new Source("didit"); + + /** The value {@code "custom"}. */ + public static final Source CUSTOM = new Source("custom"); + + private static final List KNOWN_VALUES = List.of(DIDIT, CUSTOM); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Parties extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "role", "entity_type", "kind", "vendor_data", "full_name", "first_name", "last_name", "country_code", "dob", "address", "institution_info", "device", "external_party_snapshot"); + + private Parties(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Parties} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Parties fromJson(JsonNode json) { + return new Parties(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Party role. The create endpoint assigns APPLICANT (the subject) and COUNTERPARTY. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(TransactionDetail.Parties.Role::of)); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.enumeration(TransactionDetail.Parties.EntityType::of)); + } + + /** + * USER/BUSINESS parties link back to a Didit-owned entity via vendor_data. EXTERNAL parties have no Didit entity behind them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional kind() { + return Json.optional(json, "kind", Conv.enumeration(TransactionDetail.Parties.Kind::of)); + } + + /** + * Your internal user/business identifier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The full_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Country code from the submitted address.country (typically ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional countryCode() { + return Json.optional(json, "country_code", Conv.STRING); + } + + /** + * Date of birth from the submitted date_of_birth. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dob() { + return Json.optional(json, "dob", Conv.DATE); + } + + /** + * Address object as submitted. {} when omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> address() { + return Json.optional(json, "address", Conv.OBJECT); + } + + /** + * Institution details as submitted. {} when omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> institutionInfo() { + return Json.optional(json, "institution_info", Conv.OBJECT); + } + + /** + * Normalized device context, including server-side IP enrichment under network_context (geolocation, VPN/data-center flags) when an IP was provided. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional device() { + return Json.optional(json, "device", Conv.model(TransactionDetail.Parties.Device::fromJson)); + } + + /** + * Frozen copy of the party data for EXTERNAL parties. null while the party is linked to a Didit user or business. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> externalPartySnapshot() { + return Json.optional(json, "external_party_snapshot", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Parties}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Parties from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Party role. The create endpoint assigns APPLICANT (the subject) and COUNTERPARTY. + * + * @param role the value + * @return this builder + */ + public Builder role(TransactionDetail.Parties.Role role) { + return set("role", Conv.enumeration(TransactionDetail.Parties.Role::of), role); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(TransactionDetail.Parties.EntityType entityType) { + return set("entity_type", Conv.enumeration(TransactionDetail.Parties.EntityType::of), entityType); + } + + /** + * USER/BUSINESS parties link back to a Didit-owned entity via vendor_data. EXTERNAL parties have no Didit entity behind them. + * + * @param kind the value + * @return this builder + */ + public Builder kind(TransactionDetail.Parties.Kind kind) { + return set("kind", Conv.enumeration(TransactionDetail.Parties.Kind::of), kind); + } + + /** + * Your internal user/business identifier. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The full_name field. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The first_name field. + * + * @param firstName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstName(@Nullable String firstName) { + return setNullable("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastName(@Nullable String lastName) { + return setNullable("last_name", Conv.STRING, lastName); + } + + /** + * Country code from the submitted address.country (typically ISO 3166-1 alpha-3). + * + * @param countryCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder countryCode(@Nullable String countryCode) { + return setNullable("country_code", Conv.STRING, countryCode); + } + + /** + * Date of birth from the submitted date_of_birth. + * + * @param dob the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dob(@Nullable LocalDate dob) { + return setNullable("dob", Conv.DATE, dob); + } + + /** + * Address object as submitted. {} when omitted. + * + * @param address the value + * @return this builder + */ + public Builder address(Map address) { + return setAny("address", address); + } + + /** + * Institution details as submitted. {} when omitted. + * + * @param institutionInfo the value + * @return this builder + */ + public Builder institutionInfo(Map institutionInfo) { + return setAny("institution_info", institutionInfo); + } + + /** + * Normalized device context, including server-side IP enrichment under network_context (geolocation, VPN/data-center flags) when an IP was provided. + * + * @param device the value + * @return this builder + */ + public Builder device(TransactionDetail.Parties.Device device) { + return set("device", Conv.model(TransactionDetail.Parties.Device::fromJson), device); + } + + /** + * Frozen copy of the party data for EXTERNAL parties. null while the party is linked to a Didit user or business. + * + * @param externalPartySnapshot the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder externalPartySnapshot(@Nullable Map externalPartySnapshot) { + return setAny("external_party_snapshot", externalPartySnapshot); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Parties} + */ + public Parties build() { + return new Parties(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Party role. The create endpoint assigns APPLICANT (the subject) and COUNTERPARTY. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "APPLICANT"}. */ + public static final Role APPLICANT = new Role("APPLICANT"); + + /** The value {@code "REMITTER"}. */ + public static final Role REMITTER = new Role("REMITTER"); + + /** The value {@code "BENEFICIARY"}. */ + public static final Role BENEFICIARY = new Role("BENEFICIARY"); + + /** The value {@code "COUNTERPARTY"}. */ + public static final Role COUNTERPARTY = new Role("COUNTERPARTY"); + + private static final List KNOWN_VALUES = List.of(APPLICANT, REMITTER, BENEFICIARY, COUNTERPARTY); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EntityType extends StringEnum { + /** The value {@code "individual"}. */ + public static final EntityType INDIVIDUAL = new EntityType("individual"); + + /** The value {@code "company"}. */ + public static final EntityType COMPANY = new EntityType("company"); + + /** The value {@code "external"}. */ + public static final EntityType EXTERNAL = new EntityType("external"); + + /** The value {@code "unhostedWallet"}. */ + public static final EntityType UNHOSTED_WALLET = new EntityType("unhostedWallet"); + + private static final List KNOWN_VALUES = List.of(INDIVIDUAL, COMPANY, EXTERNAL, UNHOSTED_WALLET); + + private EntityType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EntityType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EntityType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * USER/BUSINESS parties link back to a Didit-owned entity via vendor_data. EXTERNAL parties have no Didit entity behind them. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Kind extends StringEnum { + /** The value {@code "USER"}. */ + public static final Kind USER = new Kind("USER"); + + /** The value {@code "BUSINESS"}. */ + public static final Kind BUSINESS = new Kind("BUSINESS"); + + /** The value {@code "EXTERNAL"}. */ + public static final Kind EXTERNAL = new Kind("EXTERNAL"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS, EXTERNAL); + + private Kind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Kind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Kind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Normalized device context, including server-side IP enrichment under network_context (geolocation, VPN/data-center flags) when an IP was provided. + */ + public static final class Device extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("fingerprint", "persistent_device_id", "user_agent", "browser_family", "browser_version", "platform", "os_family", "os_version", "accept_language", "session_id", "session_age_ms", "network_context"); + + private Device(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Device} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Device fromJson(JsonNode json) { + return new Device(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique device fingerprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fingerprint() { + return Json.optional(json, "fingerprint", Conv.STRING); + } + + /** + * Stable cross-session device identifier (v2 fingerprint schema). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional persistentDeviceId() { + return Json.optional(json, "persistent_device_id", Conv.STRING); + } + + /** + * Browser or app user agent string. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + /** + * Browser family (e.g. Chrome, Firefox, Safari). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserFamily() { + return Json.optional(json, "browser_family", Conv.STRING); + } + + /** + * Browser version string. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserVersion() { + return Json.optional(json, "browser_version", Conv.STRING); + } + + /** + * Platform identifier (web, ios, android, macos, windows, linux). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platform() { + return Json.optional(json, "platform", Conv.STRING); + } + + /** + * Operating system family (e.g. iOS, Android, Windows). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osFamily() { + return Json.optional(json, "os_family", Conv.STRING); + } + + /** + * Operating system version string. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osVersion() { + return Json.optional(json, "os_version", Conv.STRING); + } + + /** + * Accept-Language header value. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional acceptLanguage() { + return Json.optional(json, "accept_language", Conv.STRING); + } + + /** + * Session identifier (stored in metadata). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Session age in milliseconds. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionAgeMs() { + return Json.optional(json, "session_age_ms", Conv.DOUBLE); + } + + /** + * Network context with IP address and geo-location. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkContext() { + return Json.optional(json, "network_context", Conv.model(TransactionDetail.Parties.Device.NetworkContext::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Device}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Device from) { + super(from); + } + + /** + * Unique device fingerprint. + * + * @param fingerprint the value + * @return this builder + */ + public Builder fingerprint(String fingerprint) { + return set("fingerprint", Conv.STRING, fingerprint); + } + + /** + * Stable cross-session device identifier (v2 fingerprint schema). + * + * @param persistentDeviceId the value + * @return this builder + */ + public Builder persistentDeviceId(String persistentDeviceId) { + return set("persistent_device_id", Conv.STRING, persistentDeviceId); + } + + /** + * Browser or app user agent string. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Browser family (e.g. Chrome, Firefox, Safari). + * + * @param browserFamily the value + * @return this builder + */ + public Builder browserFamily(String browserFamily) { + return set("browser_family", Conv.STRING, browserFamily); + } + + /** + * Browser version string. + * + * @param browserVersion the value + * @return this builder + */ + public Builder browserVersion(String browserVersion) { + return set("browser_version", Conv.STRING, browserVersion); + } + + /** + * Platform identifier (web, ios, android, macos, windows, linux). + * + * @param platform the value + * @return this builder + */ + public Builder platform(String platform) { + return set("platform", Conv.STRING, platform); + } + + /** + * Operating system family (e.g. iOS, Android, Windows). + * + * @param osFamily the value + * @return this builder + */ + public Builder osFamily(String osFamily) { + return set("os_family", Conv.STRING, osFamily); + } + + /** + * Operating system version string. + * + * @param osVersion the value + * @return this builder + */ + public Builder osVersion(String osVersion) { + return set("os_version", Conv.STRING, osVersion); + } + + /** + * Accept-Language header value. + * + * @param acceptLanguage the value + * @return this builder + */ + public Builder acceptLanguage(String acceptLanguage) { + return set("accept_language", Conv.STRING, acceptLanguage); + } + + /** + * Session identifier (stored in metadata). + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Session age in milliseconds. + * + * @param sessionAgeMs the value + * @return this builder + */ + public Builder sessionAgeMs(double sessionAgeMs) { + return set("session_age_ms", Conv.DOUBLE, sessionAgeMs); + } + + /** + * Network context with IP address and geo-location. + * + * @param networkContext the value + * @return this builder + */ + public Builder networkContext(TransactionDetail.Parties.Device.NetworkContext networkContext) { + return set("network_context", Conv.model(TransactionDetail.Parties.Device.NetworkContext::fromJson), networkContext); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Device} + */ + public Device build() { + return new Device(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Network context with IP address and geo-location. */ + public static final class NetworkContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip_address", "ip_country_code", "latitude", "longitude"); + + private NetworkContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkContext fromJson(JsonNode json) { + return new NetworkContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Client IP address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Geo-resolved country of the IP (ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * Geographic latitude of the IP. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Geographic longitude of the IP. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkContext from) { + super(from); + } + + /** + * Client IP address. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Geo-resolved country of the IP (ISO 3166-1 alpha-3). + * + * @param ipCountryCode the value + * @return this builder + */ + public Builder ipCountryCode(String ipCountryCode) { + return set("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * Geographic latitude of the IP. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * Geographic longitude of the IP. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkContext} + */ + public NetworkContext build() { + return new NetworkContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class PaymentMethods extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "payment_method_type", "label", "fingerprint", "account_id", "issuing_country", "owner_kind", "vendor_data", "owner_name", "institution_info", "details", "external_owner_snapshot", "role"); + + private PaymentMethods(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PaymentMethods} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PaymentMethods fromJson(JsonNode json) { + return new PaymentMethods(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The payment_method_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentMethodType() { + return Json.optional(json, "payment_method_type", Conv.enumeration(TransactionDetail.PaymentMethods.PaymentMethodType::of)); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * SHA-256 over type:account_id:issuing_country โ€” stable identifier to correlate reuse of the same instrument. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fingerprint() { + return Json.optional(json, "fingerprint", Conv.STRING); + } + + /** + * Account identifier (IBAN, wallet address, card token, โ€ฆ). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional accountId() { + return Json.optional(json, "account_id", Conv.STRING); + } + + /** + * The issuing_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingCountry() { + return Json.optional(json, "issuing_country", Conv.STRING); + } + + /** + * The owner_kind field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownerKind() { + return Json.optional(json, "owner_kind", Conv.enumeration(TransactionDetail.PaymentMethods.OwnerKind::of)); + } + + /** + * Your identifier for the owning user/business. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The owner_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownerName() { + return Json.optional(json, "owner_name", Conv.STRING); + } + + /** + * The institution_info field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> institutionInfo() { + return Json.optional(json, "institution_info", Conv.OBJECT); + } + + /** + * Raw payment_method object as submitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> details() { + return Json.optional(json, "details", Conv.OBJECT); + } + + /** + * The external_owner_snapshot field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> externalOwnerSnapshot() { + return Json.optional(json, "external_owner_snapshot", Conv.OBJECT); + } + + /** + * How this method was used in the transaction. The create endpoint assigns SOURCE/DESTINATION from the direction (outbound: subject = SOURCE; inbound: subject = DESTINATION). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional role() { + return Json.optional(json, "role", Conv.enumeration(TransactionDetail.PaymentMethods.Role::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PaymentMethods}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PaymentMethods from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The payment_method_type field. + * + * @param paymentMethodType the value + * @return this builder + */ + public Builder paymentMethodType(TransactionDetail.PaymentMethods.PaymentMethodType paymentMethodType) { + return set("payment_method_type", Conv.enumeration(TransactionDetail.PaymentMethods.PaymentMethodType::of), paymentMethodType); + } + + /** + * The label field. + * + * @param label the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder label(@Nullable String label) { + return setNullable("label", Conv.STRING, label); + } + + /** + * SHA-256 over type:account_id:issuing_country โ€” stable identifier to correlate reuse of the same instrument. + * + * @param fingerprint the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fingerprint(@Nullable String fingerprint) { + return setNullable("fingerprint", Conv.STRING, fingerprint); + } + + /** + * Account identifier (IBAN, wallet address, card token, โ€ฆ). + * + * @param accountId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder accountId(@Nullable String accountId) { + return setNullable("account_id", Conv.STRING, accountId); + } + + /** + * The issuing_country field. + * + * @param issuingCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder issuingCountry(@Nullable String issuingCountry) { + return setNullable("issuing_country", Conv.STRING, issuingCountry); + } + + /** + * The owner_kind field. + * + * @param ownerKind the value + * @return this builder + */ + public Builder ownerKind(TransactionDetail.PaymentMethods.OwnerKind ownerKind) { + return set("owner_kind", Conv.enumeration(TransactionDetail.PaymentMethods.OwnerKind::of), ownerKind); + } + + /** + * Your identifier for the owning user/business. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The owner_name field. + * + * @param ownerName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownerName(@Nullable String ownerName) { + return setNullable("owner_name", Conv.STRING, ownerName); + } + + /** + * The institution_info field. + * + * @param institutionInfo the value + * @return this builder + */ + public Builder institutionInfo(Map institutionInfo) { + return setAny("institution_info", institutionInfo); + } + + /** + * Raw payment_method object as submitted. + * + * @param details the value + * @return this builder + */ + public Builder details(Map details) { + return setAny("details", details); + } + + /** + * The external_owner_snapshot field. + * + * @param externalOwnerSnapshot the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder externalOwnerSnapshot(@Nullable Map externalOwnerSnapshot) { + return setAny("external_owner_snapshot", externalOwnerSnapshot); + } + + /** + * How this method was used in the transaction. The create endpoint assigns SOURCE/DESTINATION from the direction (outbound: subject = SOURCE; inbound: subject = DESTINATION). + * + * @param role the value + * @return this builder + */ + public Builder role(TransactionDetail.PaymentMethods.Role role) { + return set("role", Conv.enumeration(TransactionDetail.PaymentMethods.Role::of), role); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PaymentMethods} + */ + public PaymentMethods build() { + return new PaymentMethods(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PaymentMethodType extends StringEnum { + /** The value {@code "bank_card"}. */ + public static final PaymentMethodType BANK_CARD = new PaymentMethodType("bank_card"); + + /** The value {@code "bank_account"}. */ + public static final PaymentMethodType BANK_ACCOUNT = new PaymentMethodType("bank_account"); + + /** The value {@code "e_wallet"}. */ + public static final PaymentMethodType E_WALLET = new PaymentMethodType("e_wallet"); + + /** The value {@code "crypto_wallet"}. */ + public static final PaymentMethodType CRYPTO_WALLET = new PaymentMethodType("crypto_wallet"); + + /** The value {@code "unhosted_wallet"}. */ + public static final PaymentMethodType UNHOSTED_WALLET = new PaymentMethodType("unhosted_wallet"); + + /** The value {@code "other"}. */ + public static final PaymentMethodType OTHER = new PaymentMethodType("other"); + + private static final List KNOWN_VALUES = List.of(BANK_CARD, BANK_ACCOUNT, E_WALLET, CRYPTO_WALLET, UNHOSTED_WALLET, OTHER); + + private PaymentMethodType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PaymentMethodType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PaymentMethodType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class OwnerKind extends StringEnum { + /** The value {@code "USER"}. */ + public static final OwnerKind USER = new OwnerKind("USER"); + + /** The value {@code "BUSINESS"}. */ + public static final OwnerKind BUSINESS = new OwnerKind("BUSINESS"); + + /** The value {@code "EXTERNAL"}. */ + public static final OwnerKind EXTERNAL = new OwnerKind("EXTERNAL"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS, EXTERNAL); + + private OwnerKind(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static OwnerKind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, OwnerKind::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * How this method was used in the transaction. The create endpoint assigns SOURCE/DESTINATION from the direction (outbound: subject = SOURCE; inbound: subject = DESTINATION). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Role extends StringEnum { + /** The value {@code "SOURCE"}. */ + public static final Role SOURCE = new Role("SOURCE"); + + /** The value {@code "DESTINATION"}. */ + public static final Role DESTINATION = new Role("DESTINATION"); + + /** The value {@code "FUNDING"}. */ + public static final Role FUNDING = new Role("FUNDING"); + + /** The value {@code "BENEFICIARY"}. */ + public static final Role BENEFICIARY = new Role("BENEFICIARY"); + + private static final List KNOWN_VALUES = List.of(SOURCE, DESTINATION, FUNDING, BENEFICIARY); + + private Role(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Role of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Role::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Documents extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "label", "note", "uploaded_by", "created_at", "files"); + + private Documents(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Documents} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Documents fromJson(JsonNode json) { + return new Documents(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The note field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional note() { + return Json.optional(json, "note", Conv.STRING); + } + + /** + * The uploaded_by field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uploadedBy() { + return Json.optional(json, "uploaded_by", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The files field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> files() { + return Json.optional(json, "files", Conv.list(Conv.model(TransactionDetail.Documents.Files::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Documents}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Documents from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The label field. + * + * @param label the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder label(@Nullable String label) { + return setNullable("label", Conv.STRING, label); + } + + /** + * The note field. + * + * @param note the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder note(@Nullable String note) { + return setNullable("note", Conv.STRING, note); + } + + /** + * The uploaded_by field. + * + * @param uploadedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder uploadedBy(@Nullable String uploadedBy) { + return setNullable("uploaded_by", Conv.STRING, uploadedBy); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The files field. + * + * @param files the value + * @return this builder + */ + public Builder files(List files) { + return set("files", Conv.list(Conv.model(TransactionDetail.Documents.Files::fromJson)), files); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Documents} + */ + public Documents build() { + return new Documents(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Files extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "file_url", "original_filename", "file_size"); + + private Files(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Files} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Files fromJson(JsonNode json) { + return new Files(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Short-lived signed download URL; fetch it when needed rather than storing it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileUrl() { + return Json.optional(json, "file_url", Conv.STRING); + } + + /** + * The original_filename field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional originalFilename() { + return Json.optional(json, "original_filename", Conv.STRING); + } + + /** + * The file_size field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fileSize() { + return Json.optional(json, "file_size", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Files}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Files from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Short-lived signed download URL; fetch it when needed rather than storing it. + * + * @param fileUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileUrl(@Nullable String fileUrl) { + return setNullable("file_url", Conv.STRING, fileUrl); + } + + /** + * The original_filename field. + * + * @param originalFilename the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder originalFilename(@Nullable String originalFilename) { + return setNullable("original_filename", Conv.STRING, originalFilename); + } + + /** + * The file_size field. + * + * @param fileSize the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fileSize(@Nullable Long fileSize) { + return setNullable("file_size", Conv.LONG, fileSize); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Files} + */ + public Files build() { + return new Files(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + public static final class Activities extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "activity_type", "source", "status", "title", "description", "metadata", "occurred_at"); + + private Activities(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Activities} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Activities fromJson(JsonNode json) { + return new Activities(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * E.g. TRANSACTION_CREATED, TRANSACTION_NOTE_ADDED, TRANSACTION_STATUS_CHANGED. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional activityType() { + return Json.optional(json, "activity_type", Conv.STRING); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The occurred_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional occurredAt() { + return Json.optional(json, "occurred_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Activities}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Activities from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * E.g. TRANSACTION_CREATED, TRANSACTION_NOTE_ADDED, TRANSACTION_STATUS_CHANGED. + * + * @param activityType the value + * @return this builder + */ + public Builder activityType(String activityType) { + return set("activity_type", Conv.STRING, activityType); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * The status field. + * + * @param status the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder status(@Nullable String status) { + return setNullable("status", Conv.STRING, status); + } + + /** + * The title field. + * + * @param title the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder title(@Nullable String title) { + return setNullable("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The occurred_at field. + * + * @param occurredAt the value + * @return this builder + */ + public Builder occurredAt(OffsetDateTime occurredAt) { + return set("occurred_at", Conv.DATE_TIME, occurredAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Activities} + */ + public Activities build() { + return new Activities(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Alerts extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "title", "description", "severity", "status", "source", "metadata", "created_at", "due_at"); + + private Alerts(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Alerts} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Alerts fromJson(JsonNode json) { + return new Alerts(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The severity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional severity() { + return Json.optional(json, "severity", Conv.enumeration(TransactionDetail.Alerts.Severity::of)); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(TransactionDetail.Alerts.Status::of)); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(TransactionDetail.Alerts.Source::of)); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The due_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dueAt() { + return Json.optional(json, "due_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Alerts}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Alerts from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The severity field. + * + * @param severity the value + * @return this builder + */ + public Builder severity(TransactionDetail.Alerts.Severity severity) { + return set("severity", Conv.enumeration(TransactionDetail.Alerts.Severity::of), severity); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(TransactionDetail.Alerts.Status status) { + return set("status", Conv.enumeration(TransactionDetail.Alerts.Status::of), status); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(TransactionDetail.Alerts.Source source) { + return set("source", Conv.enumeration(TransactionDetail.Alerts.Source::of), source); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The due_at field. + * + * @param dueAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dueAt(@Nullable OffsetDateTime dueAt) { + return setNullable("due_at", Conv.DATE_TIME, dueAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Alerts} + */ + public Alerts build() { + return new Alerts(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Severity extends StringEnum { + /** The value {@code "UNKNOWN"}. */ + public static final Severity UNKNOWN = new Severity("UNKNOWN"); + + /** The value {@code "LOW"}. */ + public static final Severity LOW = new Severity("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Severity MEDIUM = new Severity("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Severity HIGH = new Severity("HIGH"); + + /** The value {@code "CRITICAL"}. */ + public static final Severity CRITICAL = new Severity("CRITICAL"); + + private static final List KNOWN_VALUES = List.of(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL); + + private Severity(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Severity of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Severity::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "OPEN"}. */ + public static final Status OPEN = new Status("OPEN"); + + /** The value {@code "INVESTIGATING"}. */ + public static final Status INVESTIGATING = new Status("INVESTIGATING"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + /** The value {@code "PENDING_SAR"}. */ + public static final Status PENDING_SAR = new Status("PENDING_SAR"); + + /** The value {@code "SAR_FILED"}. */ + public static final Status SAR_FILED = new Status("SAR_FILED"); + + /** The value {@code "RESOLVED"}. */ + public static final Status RESOLVED = new Status("RESOLVED"); + + /** The value {@code "DISMISSED"}. */ + public static final Status DISMISSED = new Status("DISMISSED"); + + private static final List KNOWN_VALUES = List.of(OPEN, INVESTIGATING, AWAITING_USER, PENDING_SAR, SAR_FILED, RESOLVED, DISMISSED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "RULE"}. */ + public static final Source RULE = new Source("RULE"); + + /** The value {@code "PROVIDER"}. */ + public static final Source PROVIDER = new Source("PROVIDER"); + + /** The value {@code "MANUAL"}. */ + public static final Source MANUAL = new Source("MANUAL"); + + private static final List KNOWN_VALUES = List.of(RULE, PROVIDER, MANUAL); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class RuleRuns extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "rule", "rule_title", "rule_description", "rule_category", "matched", "is_test", "mode", "severity", "score_delta", "status_target", "action_summary", "metadata", "created_at"); + + private RuleRuns(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RuleRuns} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RuleRuns fromJson(JsonNode json) { + return new RuleRuns(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * UUID of the rule that ran. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rule() { + return Json.optional(json, "rule", Conv.STRING); + } + + /** + * The rule_title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleTitle() { + return Json.optional(json, "rule_title", Conv.STRING); + } + + /** + * The rule_description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleDescription() { + return Json.optional(json, "rule_description", Conv.STRING); + } + + /** + * The rule_category field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ruleCategory() { + return Json.optional(json, "rule_category", Conv.STRING); + } + + /** + * Whether the rule's conditions matched this transaction. A run is recorded only for matched rules, so live evaluations always carry true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matched() { + return Json.optional(json, "matched", Conv.BOOLEAN); + } + + /** + * True when the rule ran in TEST mode (no effect on status/score). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isTest() { + return Json.optional(json, "is_test", Conv.BOOLEAN); + } + + /** + * The mode field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TransactionDetail.RuleRuns.Mode::of)); + } + + /** + * The severity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional severity() { + return Json.optional(json, "severity", Conv.STRING); + } + + /** + * Score added by this rule's add_score actions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scoreDelta() { + return Json.optional(json, "score_delta", Conv.LONG); + } + + /** + * Status set by a change_status action, if any. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional statusTarget() { + return Json.optional(json, "status_target", Conv.STRING); + } + + /** + * Summary of the actions the rule executed, joined with ; (e.g. score +30; change_status:IN_REVIEW; add_tag:high_risk_country). Parts: score +N, change_status:<STATUS>, add_tag:<name>, add_note, add_to_list, open_case. null when the rule executed no action. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actionSummary() { + return Json.optional(json, "action_summary", Conv.STRING); + } + + /** + * Evaluation detail: scope_match, conditions[] and aggregations[]. Each condition entry carries field, operator, expected_value, the current_value read from the transaction, matched, group_index and group_logic. Each aggregation entry (velocity / count / sum) carries metric, field, operator, expected_value, the computed_value the aggregate evaluated to, window, filters, matched and sample_references; deferred async aggregations have computed_value: null and deferred: true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RuleRuns}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RuleRuns from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * UUID of the rule that ran. + * + * @param rule the value + * @return this builder + */ + public Builder rule(String rule) { + return set("rule", Conv.STRING, rule); + } + + /** + * The rule_title field. + * + * @param ruleTitle the value + * @return this builder + */ + public Builder ruleTitle(String ruleTitle) { + return set("rule_title", Conv.STRING, ruleTitle); + } + + /** + * The rule_description field. + * + * @param ruleDescription the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ruleDescription(@Nullable String ruleDescription) { + return setNullable("rule_description", Conv.STRING, ruleDescription); + } + + /** + * The rule_category field. + * + * @param ruleCategory the value + * @return this builder + */ + public Builder ruleCategory(String ruleCategory) { + return set("rule_category", Conv.STRING, ruleCategory); + } + + /** + * Whether the rule's conditions matched this transaction. A run is recorded only for matched rules, so live evaluations always carry true. + * + * @param matched the value + * @return this builder + */ + public Builder matched(boolean matched) { + return set("matched", Conv.BOOLEAN, matched); + } + + /** + * True when the rule ran in TEST mode (no effect on status/score). + * + * @param isTest the value + * @return this builder + */ + public Builder isTest(boolean isTest) { + return set("is_test", Conv.BOOLEAN, isTest); + } + + /** + * The mode field. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TransactionDetail.RuleRuns.Mode mode) { + return set("mode", Conv.enumeration(TransactionDetail.RuleRuns.Mode::of), mode); + } + + /** + * The severity field. + * + * @param severity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder severity(@Nullable String severity) { + return setNullable("severity", Conv.STRING, severity); + } + + /** + * Score added by this rule's add_score actions. + * + * @param scoreDelta the value + * @return this builder + */ + public Builder scoreDelta(long scoreDelta) { + return set("score_delta", Conv.LONG, scoreDelta); + } + + /** + * Status set by a change_status action, if any. + * + * @param statusTarget the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder statusTarget(@Nullable String statusTarget) { + return setNullable("status_target", Conv.STRING, statusTarget); + } + + /** + * Summary of the actions the rule executed, joined with ; (e.g. score +30; change_status:IN_REVIEW; add_tag:high_risk_country). Parts: score +N, change_status:<STATUS>, add_tag:<name>, add_note, add_to_list, open_case. null when the rule executed no action. + * + * @param actionSummary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actionSummary(@Nullable String actionSummary) { + return setNullable("action_summary", Conv.STRING, actionSummary); + } + + /** + * Evaluation detail: scope_match, conditions[] and aggregations[]. Each condition entry carries field, operator, expected_value, the current_value read from the transaction, matched, group_index and group_logic. Each aggregation entry (velocity / count / sum) carries metric, field, operator, expected_value, the computed_value the aggregate evaluated to, window, filters, matched and sample_references; deferred async aggregations have computed_value: null and deferred: true. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RuleRuns} + */ + public RuleRuns build() { + return new RuleRuns(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Mode ACTIVE = new Mode("ACTIVE"); + + /** The value {@code "DISABLED"}. */ + public static final Mode DISABLED = new Mode("DISABLED"); + + /** The value {@code "TEST"}. */ + public static final Mode TEST = new Mode("TEST"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISABLED, TEST); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class ProviderResults extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "provider", "result_type", "status", "severity", "score", "summary", "payload", "created_at"); + + private ProviderResults(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ProviderResults} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ProviderResults fromJson(JsonNode json) { + return new ProviderResults(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The provider field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional provider() { + return Json.optional(json, "provider", Conv.STRING); + } + + /** + * The result_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional resultType() { + return Json.optional(json, "result_type", Conv.enumeration(TransactionDetail.ProviderResults.ResultType::of)); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The severity field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional severity() { + return Json.optional(json, "severity", Conv.STRING); + } + + /** + * The score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * The summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.STRING); + } + + /** + * Raw provider response payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> payload() { + return Json.optional(json, "payload", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ProviderResults}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ProviderResults from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The provider field. + * + * @param provider the value + * @return this builder + */ + public Builder provider(String provider) { + return set("provider", Conv.STRING, provider); + } + + /** + * The result_type field. + * + * @param resultType the value + * @return this builder + */ + public Builder resultType(TransactionDetail.ProviderResults.ResultType resultType) { + return set("result_type", Conv.enumeration(TransactionDetail.ProviderResults.ResultType::of), resultType); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The severity field. + * + * @param severity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder severity(@Nullable String severity) { + return setNullable("severity", Conv.STRING, severity); + } + + /** + * The score field. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * The summary field. + * + * @param summary the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder summary(@Nullable String summary) { + return setNullable("summary", Conv.STRING, summary); + } + + /** + * Raw provider response payload. + * + * @param payload the value + * @return this builder + */ + public Builder payload(Map payload) { + return setAny("payload", payload); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ProviderResults} + */ + public ProviderResults build() { + return new ProviderResults(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ResultType extends StringEnum { + /** The value {@code "FIAT_MONITORING"}. */ + public static final ResultType FIAT_MONITORING = new ResultType("FIAT_MONITORING"); + + /** The value {@code "WALLET_SCREENING"}. */ + public static final ResultType WALLET_SCREENING = new ResultType("WALLET_SCREENING"); + + /** The value {@code "TRANSACTION_SCREENING"}. */ + public static final ResultType TRANSACTION_SCREENING = new ResultType("TRANSACTION_SCREENING"); + + /** The value {@code "TRAVEL_RULE"}. */ + public static final ResultType TRAVEL_RULE = new ResultType("TRAVEL_RULE"); + + /** The value {@code "NETWORK_GRAPH"}. */ + public static final ResultType NETWORK_GRAPH = new ResultType("NETWORK_GRAPH"); + + /** The value {@code "CUSTOM"}. */ + public static final ResultType CUSTOM = new ResultType("CUSTOM"); + + private static final List KNOWN_VALUES = List.of(FIAT_MONITORING, WALLET_SCREENING, TRANSACTION_SCREENING, TRAVEL_RULE, NETWORK_GRAPH, CUSTOM); + + private ResultType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ResultType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ResultType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Travel Rule transfer or check. Populated when travel_rule_details was submitted, and also when Travel Rule is enabled and the transaction was created with transaction_category: travelRule (Didit initiates the exchange itself, even without travel_rule_details). null when no transfer or check exists. + */ + public static final class TravelRule extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "status", "protocol", "required", "obligations_count", "originator_data", "beneficiary_data", "metadata"); + + private TravelRule(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRule} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRule fromJson(JsonNode json) { + return new TravelRule(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The protocol field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional protocol() { + return Json.optional(json, "protocol", Conv.STRING); + } + + /** + * The required field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional required() { + return Json.optional(json, "required", Conv.BOOLEAN); + } + + /** + * The obligations_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional obligationsCount() { + return Json.optional(json, "obligations_count", Conv.LONG); + } + + /** + * The originator_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> originatorData() { + return Json.optional(json, "originator_data", Conv.OBJECT); + } + + /** + * The beneficiary_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficiaryData() { + return Json.optional(json, "beneficiary_data", Conv.OBJECT); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRule}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRule from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The protocol field. + * + * @param protocol the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder protocol(@Nullable String protocol) { + return setNullable("protocol", Conv.STRING, protocol); + } + + /** + * The required field. + * + * @param required the value + * @return this builder + */ + public Builder required(boolean required) { + return set("required", Conv.BOOLEAN, required); + } + + /** + * The obligations_count field. + * + * @param obligationsCount the value + * @return this builder + */ + public Builder obligationsCount(long obligationsCount) { + return set("obligations_count", Conv.LONG, obligationsCount); + } + + /** + * The originator_data field. + * + * @param originatorData the value + * @return this builder + */ + public Builder originatorData(Map originatorData) { + return setAny("originator_data", originatorData); + } + + /** + * The beneficiary_data field. + * + * @param beneficiaryData the value + * @return this builder + */ + public Builder beneficiaryData(Map beneficiaryData) { + return setAny("beneficiary_data", beneficiaryData); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRule} + */ + public TravelRule build() { + return new TravelRule(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Graph snapshot of related transactions/parties used by the rules engine. Either the network_snapshot submitted with the transaction or the graph Didit builds from a successful AML wallet screening (which replaces a submitted one). null when neither exists. + */ + public static final class NetworkSnapshot extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "nodes", "edges", "metrics"); + + private NetworkSnapshot(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkSnapshot} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkSnapshot fromJson(JsonNode json) { + return new NetworkSnapshot(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The nodes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> nodes() { + return Json.optional(json, "nodes", Conv.list(Conv.OBJECT)); + } + + /** + * The edges field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> edges() { + return Json.optional(json, "edges", Conv.list(Conv.OBJECT)); + } + + /** + * The metrics field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metrics() { + return Json.optional(json, "metrics", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkSnapshot}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkSnapshot from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The nodes field. + * + * @param nodes the value + * @return this builder + */ + public Builder nodes(List> nodes) { + return setAny("nodes", nodes); + } + + /** + * The edges field. + * + * @param edges the value + * @return this builder + */ + public Builder edges(List> edges) { + return setAny("edges", edges); + } + + /** + * The metrics field. + * + * @param metrics the value + * @return this builder + */ + public Builder metrics(Map metrics) { + return setAny("metrics", metrics); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkSnapshot} + */ + public NetworkSnapshot build() { + return new NetworkSnapshot(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Remediation session offered to the user when re-verification is required. Superseded by action_required, which is the canonical block; kept for backward compatibility. + */ + public static final class Remediation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("session_id", "session_token", "url", "status"); + + private Remediation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Remediation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Remediation fromJson(JsonNode json) { + return new Remediation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The session_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * The session_token field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionToken() { + return Json.optional(json, "session_token", Conv.STRING); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Remediation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Remediation from) { + super(from); + } + + /** + * The session_id field. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * The session_token field. + * + * @param sessionToken the value + * @return this builder + */ + public Builder sessionToken(String sessionToken) { + return set("session_token", Conv.STRING, sessionToken); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Remediation} + */ + public Remediation build() { + return new Remediation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Pending end-user action required to complete this transaction, or null when there is none. The Didit SDKs auto-launch the action by default and refresh the transaction when it finishes. Two variants, discriminated by type: verification_session (a hosted verification session created by a rule action) and wallet_ownership (a wallet-ownership widget session auto-minted for a Travel Rule transfer that needs proof of wallet control, gated by the auto_wallet_verification Travel Rule setting). When both could apply, wallet_ownership takes precedence because it blocks the Travel Rule exchange. + * + *

One of: {@code VerificationSession}, {@code WalletOwnership}. Check with the {@code is...} + * methods and read with the {@code as...} methods; the fields every variant has are readable directly. + */ + public static final class ActionRequired extends JsonUnion { + private ActionRequired(JsonNode json) { + super(json); + } + + /** + * Reads a {@code ActionRequired} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static ActionRequired fromJson(JsonNode json) { + return new ActionRequired(json.deepCopy()); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String type() { + return Json.required(json, "type", Conv.STRING); + } + + /** + * Hosted verification URL to open for the end user. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String url() { + return Json.required(json, "url", Conv.STRING); + } + + /** + * Wraps a {@code VerificationSession} value. + * + * @param value the value + * @return the union + */ + public static ActionRequired ofVerificationSession(TransactionDetail.ActionRequired.VerificationSession value) { + return new ActionRequired(Conv.model(TransactionDetail.ActionRequired.VerificationSession::fromJson).write(value)); + } + + /** + * Whether this value is a {@code VerificationSession}. + * + * Verification session + * + * @return true when it matches + */ + public boolean isVerificationSession() { + return Json.hasValue(json, "type", "verification_session"); + } + + /** + * Reads this value as a {@code VerificationSession}. + * + * @return the value, or empty when {@link #isVerificationSession()} is false + */ + public Optional asVerificationSession() { + return isVerificationSession() ? Optional.of(Conv.model(TransactionDetail.ActionRequired.VerificationSession::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code WalletOwnership} value. + * + * @param value the value + * @return the union + */ + public static ActionRequired ofWalletOwnership(TransactionDetail.ActionRequired.WalletOwnership value) { + return new ActionRequired(Conv.model(TransactionDetail.ActionRequired.WalletOwnership::fromJson).write(value)); + } + + /** + * Whether this value is a {@code WalletOwnership}. + * + * Wallet ownership + * + * @return true when it matches + */ + public boolean isWalletOwnership() { + return Json.hasValue(json, "type", "wallet_ownership"); + } + + /** + * Reads this value as a {@code WalletOwnership}. + * + * @return the value, or empty when {@link #isWalletOwnership()} is false + */ + public Optional asWalletOwnership() { + return isWalletOwnership() ? Optional.of(Conv.model(TransactionDetail.ActionRequired.WalletOwnership::fromJson).read(json)) : Optional.empty(); + } + + /** Verification session */ + public static final class VerificationSession extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "url", "session_id", "session_token", "status"); + + private VerificationSession(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VerificationSession} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VerificationSession fromJson(JsonNode json) { + return new VerificationSession(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionDetail.ActionRequired.VerificationSession.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionDetail.ActionRequired.VerificationSession.Type::of)); + } + + /** + * Hosted verification URL to open for the end user. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String url() { + return Json.required(json, "url", Conv.STRING); + } + + /** + * Verification session id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Session token, used by the mobile SDKs to launch the flow natively. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionToken() { + return Json.optional(json, "session_token", Conv.STRING); + } + + /** + * Verification session status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VerificationSession}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VerificationSession from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionDetail.ActionRequired.VerificationSession.Type type) { + return set("type", Conv.enumeration(TransactionDetail.ActionRequired.VerificationSession.Type::of), type); + } + + /** + * Hosted verification URL to open for the end user. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Verification session id. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Session token, used by the mobile SDKs to launch the flow natively. + * + * @param sessionToken the value + * @return this builder + */ + public Builder sessionToken(String sessionToken) { + return set("session_token", Conv.STRING, sessionToken); + } + + /** + * Verification session status. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VerificationSession} + * @throws IllegalStateException when a required field is missing + */ + public VerificationSession build() { + require("type", false); + require("url", false); + return new VerificationSession(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "verification_session"}. */ + public static final Type VERIFICATION_SESSION = new Type("verification_session"); + + private static final List KNOWN_VALUES = List.of(VERIFICATION_SESSION); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Wallet ownership */ + public static final class WalletOwnership extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "url", "widget_session_id", "expires_at"); + + private WalletOwnership(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletOwnership} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletOwnership fromJson(JsonNode json) { + return new WalletOwnership(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionDetail.ActionRequired.WalletOwnership.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionDetail.ActionRequired.WalletOwnership.Type::of)); + } + + /** + * Hosted wallet-ownership widget URL. Open it in a real browser surface - on mobile use SFSafariViewController or a Chrome Custom Tab, never an embedded webview. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String url() { + return Json.required(json, "url", Conv.STRING); + } + + /** + * Wallet-ownership widget session id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional widgetSessionId() { + return Json.optional(json, "widget_session_id", Conv.STRING); + } + + /** + * When the widget session expires. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletOwnership}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletOwnership from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionDetail.ActionRequired.WalletOwnership.Type type) { + return set("type", Conv.enumeration(TransactionDetail.ActionRequired.WalletOwnership.Type::of), type); + } + + /** + * Hosted wallet-ownership widget URL. Open it in a real browser surface - on mobile use SFSafariViewController or a Chrome Custom Tab, never an embedded webview. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Wallet-ownership widget session id. + * + * @param widgetSessionId the value + * @return this builder + */ + public Builder widgetSessionId(String widgetSessionId) { + return set("widget_session_id", Conv.STRING, widgetSessionId); + } + + /** + * When the widget session expires. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletOwnership} + * @throws IllegalStateException when a required field is missing + */ + public WalletOwnership build() { + require("type", false); + require("url", false); + return new WalletOwnership(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "wallet_ownership"}. */ + public static final Type WALLET_OWNERSHIP = new Type("wallet_ownership"); + + private static final List KNOWN_VALUES = List.of(WALLET_OWNERSHIP); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleAction.java b/src/main/java/me/didit/types/TransactionRuleAction.java new file mode 100644 index 0000000..11329dc --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleAction.java @@ -0,0 +1,1299 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.StringEnum; + +/** + * One rule action. A rule can carry several; all are applied together when it matches. Rules in TEST mode record what they would have done without applying any action. + * + *

One of: {@code AddScore}, {@code ChangeStatus}, {@code AddTags}, {@code AddNote}, {@code AddToList}, {@code OpenCase}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ +public final class TransactionRuleAction extends JsonUnion { + private TransactionRuleAction(JsonNode json) { + super(json); + } + + /** + * Reads a {@code TransactionRuleAction} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static TransactionRuleAction fromJson(JsonNode json) { + return new TransactionRuleAction(json.deepCopy()); + } + + /** + * Wraps a {@code AddScore} value. + * + * @param value the value + * @return the union + */ + public static TransactionRuleAction ofAddScore(TransactionRuleAction.AddScore value) { + return new TransactionRuleAction(Conv.model(TransactionRuleAction.AddScore::fromJson).write(value)); + } + + /** + * Whether this value is a {@code AddScore}. + * + * Add points to the transaction's cumulative risk score; the total decides the status via the application's review/decline thresholds. + * + * @return true when it matches + */ + public boolean isAddScore() { + return Json.hasValue(json, "type", "add_score"); + } + + /** + * Reads this value as a {@code AddScore}. + * + * @return the value, or empty when {@link #isAddScore()} is false + */ + public Optional asAddScore() { + return isAddScore() ? Optional.of(Conv.model(TransactionRuleAction.AddScore::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code ChangeStatus} value. + * + * @param value the value + * @return the union + */ + public static TransactionRuleAction ofChangeStatus(TransactionRuleAction.ChangeStatus value) { + return new TransactionRuleAction(Conv.model(TransactionRuleAction.ChangeStatus::fromJson).write(value)); + } + + /** + * Whether this value is a {@code ChangeStatus}. + * + * Directly set the transaction status. DECLINED always wins across matched rules. + * + * @return true when it matches + */ + public boolean isChangeStatus() { + return Json.hasValue(json, "type", "change_status"); + } + + /** + * Reads this value as a {@code ChangeStatus}. + * + * @return the value, or empty when {@link #isChangeStatus()} is false + */ + public Optional asChangeStatus() { + return isChangeStatus() ? Optional.of(Conv.model(TransactionRuleAction.ChangeStatus::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code AddTags} value. + * + * @param value the value + * @return the union + */ + public static TransactionRuleAction ofAddTags(TransactionRuleAction.AddTags value) { + return new TransactionRuleAction(Conv.model(TransactionRuleAction.AddTags::fromJson).write(value)); + } + + /** + * Whether this value is a {@code AddTags}. + * + * Attach an application tag to the matched transaction. + * + * @return true when it matches + */ + public boolean isAddTags() { + return Json.hasValue(json, "type", "add_tags"); + } + + /** + * Reads this value as a {@code AddTags}. + * + * @return the value, or empty when {@link #isAddTags()} is false + */ + public Optional asAddTags() { + return isAddTags() ? Optional.of(Conv.model(TransactionRuleAction.AddTags::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code AddNote} value. + * + * @param value the value + * @return the union + */ + public static TransactionRuleAction ofAddNote(TransactionRuleAction.AddNote value) { + return new TransactionRuleAction(Conv.model(TransactionRuleAction.AddNote::fromJson).write(value)); + } + + /** + * Whether this value is a {@code AddNote}. + * + * Attach an automated analyst note to the matched transaction. + * + * @return true when it matches + */ + public boolean isAddNote() { + return Json.hasValue(json, "type", "add_note"); + } + + /** + * Reads this value as a {@code AddNote}. + * + * @return the value, or empty when {@link #isAddNote()} is false + */ + public Optional asAddNote() { + return isAddNote() ? Optional.of(Conv.model(TransactionRuleAction.AddNote::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code AddToList} value. + * + * @param value the value + * @return the union + */ + public static TransactionRuleAction ofAddToList(TransactionRuleAction.AddToList value) { + return new TransactionRuleAction(Conv.model(TransactionRuleAction.AddToList::fromJson).write(value)); + } + + /** + * Whether this value is a {@code AddToList}. + * + * Add the subject's vendor_data to a blocklist, allowlist or custom list. + * + * @return true when it matches + */ + public boolean isAddToList() { + return Json.hasValue(json, "type", "add_to_list"); + } + + /** + * Reads this value as a {@code AddToList}. + * + * @return the value, or empty when {@link #isAddToList()} is false + */ + public Optional asAddToList() { + return isAddToList() ? Optional.of(Conv.model(TransactionRuleAction.AddToList::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code OpenCase} value. + * + * @param value the value + * @return the union + */ + public static TransactionRuleAction ofOpenCase(TransactionRuleAction.OpenCase value) { + return new TransactionRuleAction(Conv.model(TransactionRuleAction.OpenCase::fromJson).write(value)); + } + + /** + * Whether this value is a {@code OpenCase}. + * + * Open (or add to) an investigation case. Only the first open_case action on a rule is applied. + * + * @return true when it matches + */ + public boolean isOpenCase() { + return Json.hasValue(json, "type", "open_case"); + } + + /** + * Reads this value as a {@code OpenCase}. + * + * @return the value, or empty when {@link #isOpenCase()} is false + */ + public Optional asOpenCase() { + return isOpenCase() ? Optional.of(Conv.model(TransactionRuleAction.OpenCase::fromJson).read(json)) : Optional.empty(); + } + + /** + * Add points to the transaction's cumulative risk score; the total decides the status via the application's review/decline thresholds. + */ + public static final class AddScore extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "value"); + + private AddScore(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AddScore} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AddScore fromJson(JsonNode json) { + return new AddScore(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.AddScore.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionRuleAction.AddScore.Type::of)); + } + + /** + * Points added to the transaction's risk score. May be negative. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long value() { + return Json.required(json, "value", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AddScore}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AddScore from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionRuleAction.AddScore.Type type) { + return set("type", Conv.enumeration(TransactionRuleAction.AddScore.Type::of), type); + } + + /** + * Points added to the transaction's risk score. May be negative. + * + * @param value the value + * @return this builder + */ + public Builder value(long value) { + return set("value", Conv.LONG, value); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AddScore} + * @throws IllegalStateException when a required field is missing + */ + public AddScore build() { + require("type", false); + require("value", false); + return new AddScore(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "add_score"}. */ + public static final Type ADD_SCORE = new Type("add_score"); + + private static final List KNOWN_VALUES = List.of(ADD_SCORE); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Directly set the transaction status. DECLINED always wins across matched rules. */ + public static final class ChangeStatus extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "value", "workflow_id"); + + private ChangeStatus(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code ChangeStatus} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static ChangeStatus fromJson(JsonNode json) { + return new ChangeStatus(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.ChangeStatus.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionRuleAction.ChangeStatus.Type::of)); + } + + /** + * Status to set immediately, regardless of score. Alias key: status. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.ChangeStatus.Value value() { + return Json.required(json, "value", Conv.enumeration(TransactionRuleAction.ChangeStatus.Value::of)); + } + + /** + * REQUIRED when value is AWAITING_USER: the verification workflow the subject is asked to complete. Alias key: remediation_workflow_id. Didit creates a hosted remediation session for the subject when the rule fires. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowId() { + return Json.optional(json, "workflow_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link ChangeStatus}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(ChangeStatus from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionRuleAction.ChangeStatus.Type type) { + return set("type", Conv.enumeration(TransactionRuleAction.ChangeStatus.Type::of), type); + } + + /** + * Status to set immediately, regardless of score. Alias key: status. + * + * @param value the value + * @return this builder + */ + public Builder value(TransactionRuleAction.ChangeStatus.Value value) { + return set("value", Conv.enumeration(TransactionRuleAction.ChangeStatus.Value::of), value); + } + + /** + * REQUIRED when value is AWAITING_USER: the verification workflow the subject is asked to complete. Alias key: remediation_workflow_id. Didit creates a hosted remediation session for the subject when the rule fires. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code ChangeStatus} + * @throws IllegalStateException when a required field is missing + */ + public ChangeStatus build() { + require("type", false); + require("value", false); + return new ChangeStatus(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "change_status"}. */ + public static final Type CHANGE_STATUS = new Type("change_status"); + + private static final List KNOWN_VALUES = List.of(CHANGE_STATUS); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Status to set immediately, regardless of score. Alias key: status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Value extends StringEnum { + /** The value {@code "APPROVED"}. */ + public static final Value APPROVED = new Value("APPROVED"); + + /** The value {@code "IN_REVIEW"}. */ + public static final Value IN_REVIEW = new Value("IN_REVIEW"); + + /** The value {@code "DECLINED"}. */ + public static final Value DECLINED = new Value("DECLINED"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Value AWAITING_USER = new Value("AWAITING_USER"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED, AWAITING_USER); + + private Value(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Value of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Value::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Attach an application tag to the matched transaction. */ + public static final class AddTags extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "tag_uuid", "tag_name", "tag_color"); + + private AddTags(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AddTags} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AddTags fromJson(JsonNode json) { + return new AddTags(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.AddTags.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionRuleAction.AddTags.Type::of)); + } + + /** + * Existing application tag to attach. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tagUuid() { + return Json.optional(json, "tag_uuid", Conv.STRING); + } + + /** + * Tag name to attach; created on first use (stored uppercased). Provide tag_uuid or tag_name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tagName() { + return Json.optional(json, "tag_name", Conv.STRING); + } + + /** + * Hex color used when tag_name creates a new tag, e.g. #007AFE. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tagColor() { + return Json.optional(json, "tag_color", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AddTags}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AddTags from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionRuleAction.AddTags.Type type) { + return set("type", Conv.enumeration(TransactionRuleAction.AddTags.Type::of), type); + } + + /** + * Existing application tag to attach. + * + * @param tagUuid the value + * @return this builder + */ + public Builder tagUuid(String tagUuid) { + return set("tag_uuid", Conv.STRING, tagUuid); + } + + /** + * Tag name to attach; created on first use (stored uppercased). Provide tag_uuid or tag_name. + * + * @param tagName the value + * @return this builder + */ + public Builder tagName(String tagName) { + return set("tag_name", Conv.STRING, tagName); + } + + /** + * Hex color used when tag_name creates a new tag, e.g. #007AFE. + * + * @param tagColor the value + * @return this builder + */ + public Builder tagColor(String tagColor) { + return set("tag_color", Conv.STRING, tagColor); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AddTags} + * @throws IllegalStateException when a required field is missing + */ + public AddTags build() { + require("type", false); + return new AddTags(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "add_tags"}. */ + public static final Type ADD_TAGS = new Type("add_tags"); + + private static final List KNOWN_VALUES = List.of(ADD_TAGS); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Attach an automated analyst note to the matched transaction. */ + public static final class AddNote extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "note"); + + private AddNote(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AddNote} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AddNote fromJson(JsonNode json) { + return new AddNote(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.AddNote.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionRuleAction.AddNote.Type::of)); + } + + /** + * Note text attached to the transaction (author: Rule Engine). Alias key: value. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String note() { + return Json.required(json, "note", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AddNote}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AddNote from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionRuleAction.AddNote.Type type) { + return set("type", Conv.enumeration(TransactionRuleAction.AddNote.Type::of), type); + } + + /** + * Note text attached to the transaction (author: Rule Engine). Alias key: value. + * + * @param note the value + * @return this builder + */ + public Builder note(String note) { + return set("note", Conv.STRING, note); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AddNote} + * @throws IllegalStateException when a required field is missing + */ + public AddNote build() { + require("type", false); + require("note", false); + return new AddNote(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "add_note"}. */ + public static final Type ADD_NOTE = new Type("add_note"); + + private static final List KNOWN_VALUES = List.of(ADD_NOTE); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Add the subject's vendor_data to a blocklist, allowlist or custom list. */ + public static final class AddToList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "list_id"); + + private AddToList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code AddToList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static AddToList fromJson(JsonNode json) { + return new AddToList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.AddToList.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionRuleAction.AddToList.Type::of)); + } + + /** + * List to add the subject's vendor_data to. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String listId() { + return Json.required(json, "list_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link AddToList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(AddToList from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionRuleAction.AddToList.Type type) { + return set("type", Conv.enumeration(TransactionRuleAction.AddToList.Type::of), type); + } + + /** + * List to add the subject's vendor_data to. + * + * @param listId the value + * @return this builder + */ + public Builder listId(String listId) { + return set("list_id", Conv.STRING, listId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code AddToList} + * @throws IllegalStateException when a required field is missing + */ + public AddToList build() { + require("type", false); + require("list_id", false); + return new AddToList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "add_to_list"}. */ + public static final Type ADD_TO_LIST = new Type("add_to_list"); + + private static final List KNOWN_VALUES = List.of(ADD_TO_LIST); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** + * Open (or add to) an investigation case. Only the first open_case action on a rule is applied. + */ + public static final class OpenCase extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("type", "blueprint", "grouping", "attach_matched_transaction"); + + private OpenCase(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code OpenCase} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static OpenCase fromJson(JsonNode json) { + return new OpenCase(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The type field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleAction.OpenCase.Type type() { + return Json.required(json, "type", Conv.enumeration(TransactionRuleAction.OpenCase.Type::of)); + } + + /** + * Case blueprint UUID; defaults to the application's default blueprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blueprint() { + return Json.optional(json, "blueprint", Conv.STRING); + } + + /** + * Whether repeat matches join one case per applicant or one per rule+applicant. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional grouping() { + return Json.optional(json, "grouping", Conv.enumeration(TransactionRuleAction.OpenCase.Grouping::of)); + } + + /** + * Attach the matched transaction to the case. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional attachMatchedTransaction() { + return Json.optional(json, "attach_matched_transaction", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link OpenCase}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(OpenCase from) { + super(from); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(TransactionRuleAction.OpenCase.Type type) { + return set("type", Conv.enumeration(TransactionRuleAction.OpenCase.Type::of), type); + } + + /** + * Case blueprint UUID; defaults to the application's default blueprint. + * + * @param blueprint the value + * @return this builder + */ + public Builder blueprint(String blueprint) { + return set("blueprint", Conv.STRING, blueprint); + } + + /** + * Whether repeat matches join one case per applicant or one per rule+applicant. + * + * @param grouping the value + * @return this builder + */ + public Builder grouping(TransactionRuleAction.OpenCase.Grouping grouping) { + return set("grouping", Conv.enumeration(TransactionRuleAction.OpenCase.Grouping::of), grouping); + } + + /** + * Attach the matched transaction to the case. + * + * @param attachMatchedTransaction the value + * @return this builder + */ + public Builder attachMatchedTransaction(boolean attachMatchedTransaction) { + return set("attach_matched_transaction", Conv.BOOLEAN, attachMatchedTransaction); + } + + /** + * Builds the value. + * + * @return a new immutable {@code OpenCase} + * @throws IllegalStateException when a required field is missing + */ + public OpenCase build() { + require("type", false); + return new OpenCase(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "open_case"}. */ + public static final Type OPEN_CASE = new Type("open_case"); + + private static final List KNOWN_VALUES = List.of(OPEN_CASE); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Whether repeat matches join one case per applicant or one per rule+applicant. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Grouping extends StringEnum { + /** The value {@code "by_applicant"}. */ + public static final Grouping BY_APPLICANT = new Grouping("by_applicant"); + + /** The value {@code "by_rule_and_applicant"}. */ + public static final Grouping BY_RULE_AND_APPLICANT = new Grouping("by_rule_and_applicant"); + + private static final List KNOWN_VALUES = List.of(BY_APPLICANT, BY_RULE_AND_APPLICANT); + + private Grouping(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Grouping of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Grouping::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleAggregation.java b/src/main/java/me/didit/types/TransactionRuleAggregation.java new file mode 100644 index 0000000..6f0b95d --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleAggregation.java @@ -0,0 +1,314 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** + * Velocity check over the application's historical transactions inside the window. Every aggregation entry must match for the rule to match, regardless of evaluation_mode. An aggregation constrains only the window; the transaction being evaluated is constrained by scope and conditions, so repeat direction, currency or transaction_type on both halves when the rule promises them. + */ +public final class TransactionRuleAggregation extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("metric", "field", "operator", "value", "window", "filters"); + + private TransactionRuleAggregation(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleAggregation} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleAggregation fromJson(JsonNode json) { + return new TransactionRuleAggregation(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * How the matching historical transactions are aggregated. unique_count is accepted as an alias of distinct_count. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional metric() { + return Json.optional(json, "metric", Conv.enumeration(TransactionRuleAggregation.Metric::of)); + } + + /** + * Field aggregated by sum/max/min/avg/distinct_count. Ignored for count. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional field() { + return Json.optional(json, "field", Conv.STRING); + } + + /** + * Comparison applied to the computed metric. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional operator() { + return Json.optional(json, "operator", Conv.enumeration(TransactionRuleAggregation.Operator::of)); + } + + /** + * Threshold the computed metric is compared against. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double value() { + return Json.required(json, "value", Conv.DOUBLE); + } + + /** + * Look-back window ending at the transaction's txn_date: <N>m (MINUTES, not months), <N>h (hours) or <N>d (days), e.g. 30m, 24h, 7d, 30d. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional window() { + return Json.optional(json, "window", Conv.STRING); + } + + /** + * Narrows which historical transactions are aggregated. Keys are field paths from the condition field catalog; a value of "__current__" resolves to the same field's value on the transaction being evaluated (e.g. {"subject_vendor_data": "__current__"} scopes the window to the same subject), and a list value means membership. Filters compare by equality or membership ONLY - there is no lt/gte filter, so a range such as "historical transactions under 10,000" cannot be expressed here. Put the range on the metric instead (metric max with operator lt keeps every transaction in the window below the threshold). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> filters() { + return Json.optional(json, "filters", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleAggregation}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleAggregation from) { + super(from); + } + + /** + * How the matching historical transactions are aggregated. unique_count is accepted as an alias of distinct_count. + * + * @param metric the value + * @return this builder + */ + public Builder metric(TransactionRuleAggregation.Metric metric) { + return set("metric", Conv.enumeration(TransactionRuleAggregation.Metric::of), metric); + } + + /** + * Field aggregated by sum/max/min/avg/distinct_count. Ignored for count. + * + * @param field the value + * @return this builder + */ + public Builder field(String field) { + return set("field", Conv.STRING, field); + } + + /** + * Comparison applied to the computed metric. + * + * @param operator the value + * @return this builder + */ + public Builder operator(TransactionRuleAggregation.Operator operator) { + return set("operator", Conv.enumeration(TransactionRuleAggregation.Operator::of), operator); + } + + /** + * Threshold the computed metric is compared against. + * + * @param value the value + * @return this builder + */ + public Builder value(double value) { + return set("value", Conv.DOUBLE, value); + } + + /** + * Look-back window ending at the transaction's txn_date: <N>m (MINUTES, not months), <N>h (hours) or <N>d (days), e.g. 30m, 24h, 7d, 30d. + * + * @param window the value + * @return this builder + */ + public Builder window(String window) { + return set("window", Conv.STRING, window); + } + + /** + * Narrows which historical transactions are aggregated. Keys are field paths from the condition field catalog; a value of "__current__" resolves to the same field's value on the transaction being evaluated (e.g. {"subject_vendor_data": "__current__"} scopes the window to the same subject), and a list value means membership. Filters compare by equality or membership ONLY - there is no lt/gte filter, so a range such as "historical transactions under 10,000" cannot be expressed here. Put the range on the metric instead (metric max with operator lt keeps every transaction in the window below the threshold). + * + * @param filters the value + * @return this builder + */ + public Builder filters(Map filters) { + return setAny("filters", filters); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleAggregation} + * @throws IllegalStateException when a required field is missing + */ + public TransactionRuleAggregation build() { + require("value", false); + return new TransactionRuleAggregation(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * How the matching historical transactions are aggregated. unique_count is accepted as an alias of distinct_count. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Metric extends StringEnum { + /** The value {@code "count"}. */ + public static final Metric COUNT = new Metric("count"); + + /** The value {@code "sum"}. */ + public static final Metric SUM = new Metric("sum"); + + /** The value {@code "max"}. */ + public static final Metric MAX = new Metric("max"); + + /** The value {@code "min"}. */ + public static final Metric MIN = new Metric("min"); + + /** The value {@code "avg"}. */ + public static final Metric AVG = new Metric("avg"); + + /** The value {@code "distinct_count"}. */ + public static final Metric DISTINCT_COUNT = new Metric("distinct_count"); + + private static final List KNOWN_VALUES = List.of(COUNT, SUM, MAX, MIN, AVG, DISTINCT_COUNT); + + private Metric(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Metric of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Metric::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Comparison applied to the computed metric. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Operator extends StringEnum { + /** The value {@code "eq"}. */ + public static final Operator EQ = new Operator("eq"); + + /** The value {@code "ne"}. */ + public static final Operator NE = new Operator("ne"); + + /** The value {@code "gt"}. */ + public static final Operator GT = new Operator("gt"); + + /** The value {@code "gte"}. */ + public static final Operator GTE = new Operator("gte"); + + /** The value {@code "lt"}. */ + public static final Operator LT = new Operator("lt"); + + /** The value {@code "lte"}. */ + public static final Operator LTE = new Operator("lte"); + + private static final List KNOWN_VALUES = List.of(EQ, NE, GT, GTE, LT, LTE); + + private Operator(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Operator of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Operator::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleBacktestRequest.java b/src/main/java/me/didit/types/TransactionRuleBacktestRequest.java new file mode 100644 index 0000000..f18a058 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleBacktestRequest.java @@ -0,0 +1,224 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** + * Hypothetical rule configuration to evaluate against recent transactions. Read-only and free: nothing is created or modified. Send the same conditions, aggregation, evaluation_mode AND scope as the rule you intend to activate. Omitted conditions, aggregation and scope add no constraints of their own; dropping scope can include directions or transaction types the saved rule skips. Omitted evaluation_mode defaults to ALL (which can reduce matches for an ANY rule), and omitted period_days defaults to 90 days, not unlimited history. + */ +public final class TransactionRuleBacktestRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("conditions", "aggregation", "evaluation_mode", "scope", "period_days"); + + private TransactionRuleBacktestRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleBacktestRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleBacktestRequest fromJson(JsonNode json) { + return new TransactionRuleBacktestRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson))); + } + + /** + * The aggregation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aggregation() { + return Json.optional(json, "aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson))); + } + + /** + * The evaluation_mode field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional evaluationMode() { + return Json.optional(json, "evaluation_mode", Conv.enumeration(TransactionRuleBacktestRequest.EvaluationMode::of)); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scope() { + return Json.optional(json, "scope", Conv.model(TransactionRuleScope::fromJson)); + } + + /** + * The period_days field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional periodDays() { + return Json.optional(json, "period_days", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleBacktestRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleBacktestRequest from) { + super(from); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson)), conditions); + } + + /** + * The aggregation field. + * + * @param aggregation the value + * @return this builder + */ + public Builder aggregation(List aggregation) { + return set("aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson)), aggregation); + } + + /** + * The evaluation_mode field. + * + * @param evaluationMode the value + * @return this builder + */ + public Builder evaluationMode(TransactionRuleBacktestRequest.EvaluationMode evaluationMode) { + return set("evaluation_mode", Conv.enumeration(TransactionRuleBacktestRequest.EvaluationMode::of), evaluationMode); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @param scope the value + * @return this builder + */ + public Builder scope(TransactionRuleScope scope) { + return set("scope", Conv.model(TransactionRuleScope::fromJson), scope); + } + + /** + * The period_days field. + * + * @param periodDays the value + * @return this builder + */ + public Builder periodDays(long periodDays) { + return set("period_days", Conv.LONG, periodDays); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleBacktestRequest} + */ + public TransactionRuleBacktestRequest build() { + return new TransactionRuleBacktestRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EvaluationMode extends StringEnum { + /** The value {@code "ALL"}. */ + public static final EvaluationMode ALL = new EvaluationMode("ALL"); + + /** The value {@code "ANY"}. */ + public static final EvaluationMode ANY = new EvaluationMode("ANY"); + + private static final List KNOWN_VALUES = List.of(ALL, ANY); + + private EvaluationMode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EvaluationMode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EvaluationMode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleBacktestResult.java b/src/main/java/me/didit/types/TransactionRuleBacktestResult.java new file mode 100644 index 0000000..cfc8a92 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleBacktestResult.java @@ -0,0 +1,158 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TransactionRuleBacktestResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("evaluated", "matched", "affected_entities", "period_days"); + + private TransactionRuleBacktestResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleBacktestResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleBacktestResult fromJson(JsonNode json) { + return new TransactionRuleBacktestResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Transactions evaluated (most recent first, capped). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional evaluated() { + return Json.optional(json, "evaluated", Conv.LONG); + } + + /** + * Transactions the configuration would have matched. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional matched() { + return Json.optional(json, "matched", Conv.LONG); + } + + /** + * Distinct subjects (by vendor_data) among the matches. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional affectedEntities() { + return Json.optional(json, "affected_entities", Conv.LONG); + } + + /** + * The period_days field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional periodDays() { + return Json.optional(json, "period_days", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleBacktestResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleBacktestResult from) { + super(from); + } + + /** + * Transactions evaluated (most recent first, capped). + * + * @param evaluated the value + * @return this builder + */ + public Builder evaluated(long evaluated) { + return set("evaluated", Conv.LONG, evaluated); + } + + /** + * Transactions the configuration would have matched. + * + * @param matched the value + * @return this builder + */ + public Builder matched(long matched) { + return set("matched", Conv.LONG, matched); + } + + /** + * Distinct subjects (by vendor_data) among the matches. + * + * @param affectedEntities the value + * @return this builder + */ + public Builder affectedEntities(long affectedEntities) { + return set("affected_entities", Conv.LONG, affectedEntities); + } + + /** + * The period_days field. + * + * @param periodDays the value + * @return this builder + */ + public Builder periodDays(long periodDays) { + return set("period_days", Conv.LONG, periodDays); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleBacktestResult} + */ + public TransactionRuleBacktestResult build() { + return new TransactionRuleBacktestResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleCondition.java b/src/main/java/me/didit/types/TransactionRuleCondition.java new file mode 100644 index 0000000..1d11963 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleCondition.java @@ -0,0 +1,472 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * A condition reads only the transaction being evaluated - it never filters the aggregation window. + */ +public final class TransactionRuleCondition extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("field", "operator", "value", "value_type", "score", "group_index", "group_logic", "groups_logic"); + + private TransactionRuleCondition(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleCondition} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleCondition fromJson(JsonNode json) { + return new TransactionRuleCondition(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Transaction field path to evaluate. Core fields: amount, currency, direction, action_type, score, severity, transaction_type, payment_details, preferred_currency_amount (falls back to amount_in_default_currency), default_currency_code, subject_country, counterparty_country, subject_vendor_data, counterparty_vendor_data, subject_device_fingerprint, counterparty_device_fingerprint, subject_browser_family, subject_browser_version, subject_platform, subject_accept_language, subject_session_age_ms, subject_ip_country, counterparty_ip_country, subject_ip_address, counterparty_ip_address, subject_payment_method_type, subject_payment_method_country, subject_payment_method_fingerprint, subject_payment_method_account_id (and the counterparty_payment_method_* equivalents), travel_rule_status, travel_rule_required, travel_rule_obligations_count, subject_days_since_previous_transaction, tags, and custom_values.<key> for any key submitted in custom_properties on transaction create. Country-code fields accept ISO-2 or ISO-3; both sides are normalized to ISO-3 before comparison. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String field() { + return Json.required(json, "field", Conv.STRING); + } + + /** + * Comparison operator. in/not_in test membership (value may be a list or a single scalar). contains/not_contains are case-insensitive substring checks against a string value. contains_any takes a list of strings and matches when any is a case-insensitive substring of the field value. regex matches the value pattern against the field. fuzzy_match compares against the value string with the required score threshold (0-100). gt/gte/lt/lte never match when either side is missing. exists/is_not_empty/is_not_null (aliases) and not_exists/is_empty/is_null (aliases) are presence checks that ignore value. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleCondition.Operator operator() { + return Json.required(json, "operator", Conv.enumeration(TransactionRuleCondition.Operator::of)); + } + + /** + * Comparison value. Its shape depends on the operator and value_type; omit for the presence-check operators. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional value() { + return Json.optional(json, "value", Conv.ANY); + } + + /** + * Optional value interpretation. list: value is a List UUID and the list's entries become the comparison value. field: value is another field path, compared field-to-field. relative_date: value is a relative-date object, e.g. {"direction": "past", "unit": "days", "amount": 30}. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional valueType() { + return Json.optional(json, "value_type", Conv.enumeration(TransactionRuleCondition.ValueType::of)); + } + + /** + * Required when operator is fuzzy_match: the 0-100 similarity threshold. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.DOUBLE); + } + + /** + * Optional grouped logic. When any condition carries group_index, conditions sharing an index form a group and grouped evaluation replaces evaluation_mode. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional groupIndex() { + return Json.optional(json, "group_index", Conv.LONG); + } + + /** + * How conditions combine WITHIN a group. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional groupLogic() { + return Json.optional(json, "group_logic", Conv.enumeration(TransactionRuleCondition.GroupLogic::of)); + } + + /** + * How group outcomes combine ACROSS groups. Read from the first condition. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional groupsLogic() { + return Json.optional(json, "groups_logic", Conv.enumeration(TransactionRuleCondition.GroupsLogic::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleCondition}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleCondition from) { + super(from); + } + + /** + * Transaction field path to evaluate. Core fields: amount, currency, direction, action_type, score, severity, transaction_type, payment_details, preferred_currency_amount (falls back to amount_in_default_currency), default_currency_code, subject_country, counterparty_country, subject_vendor_data, counterparty_vendor_data, subject_device_fingerprint, counterparty_device_fingerprint, subject_browser_family, subject_browser_version, subject_platform, subject_accept_language, subject_session_age_ms, subject_ip_country, counterparty_ip_country, subject_ip_address, counterparty_ip_address, subject_payment_method_type, subject_payment_method_country, subject_payment_method_fingerprint, subject_payment_method_account_id (and the counterparty_payment_method_* equivalents), travel_rule_status, travel_rule_required, travel_rule_obligations_count, subject_days_since_previous_transaction, tags, and custom_values.<key> for any key submitted in custom_properties on transaction create. Country-code fields accept ISO-2 or ISO-3; both sides are normalized to ISO-3 before comparison. + * + * @param field the value + * @return this builder + */ + public Builder field(String field) { + return set("field", Conv.STRING, field); + } + + /** + * Comparison operator. in/not_in test membership (value may be a list or a single scalar). contains/not_contains are case-insensitive substring checks against a string value. contains_any takes a list of strings and matches when any is a case-insensitive substring of the field value. regex matches the value pattern against the field. fuzzy_match compares against the value string with the required score threshold (0-100). gt/gte/lt/lte never match when either side is missing. exists/is_not_empty/is_not_null (aliases) and not_exists/is_empty/is_null (aliases) are presence checks that ignore value. + * + * @param operator the value + * @return this builder + */ + public Builder operator(TransactionRuleCondition.Operator operator) { + return set("operator", Conv.enumeration(TransactionRuleCondition.Operator::of), operator); + } + + /** + * Comparison value. Its shape depends on the operator and value_type; omit for the presence-check operators. + * + * @param value the value + * @return this builder + */ + public Builder value(@Nullable Object value) { + return setAny("value", value); + } + + /** + * Optional value interpretation. list: value is a List UUID and the list's entries become the comparison value. field: value is another field path, compared field-to-field. relative_date: value is a relative-date object, e.g. {"direction": "past", "unit": "days", "amount": 30}. + * + * @param valueType the value + * @return this builder + */ + public Builder valueType(TransactionRuleCondition.ValueType valueType) { + return set("value_type", Conv.enumeration(TransactionRuleCondition.ValueType::of), valueType); + } + + /** + * Required when operator is fuzzy_match: the 0-100 similarity threshold. + * + * @param score the value + * @return this builder + */ + public Builder score(double score) { + return set("score", Conv.DOUBLE, score); + } + + /** + * Optional grouped logic. When any condition carries group_index, conditions sharing an index form a group and grouped evaluation replaces evaluation_mode. + * + * @param groupIndex the value + * @return this builder + */ + public Builder groupIndex(long groupIndex) { + return set("group_index", Conv.LONG, groupIndex); + } + + /** + * How conditions combine WITHIN a group. + * + * @param groupLogic the value + * @return this builder + */ + public Builder groupLogic(TransactionRuleCondition.GroupLogic groupLogic) { + return set("group_logic", Conv.enumeration(TransactionRuleCondition.GroupLogic::of), groupLogic); + } + + /** + * How group outcomes combine ACROSS groups. Read from the first condition. + * + * @param groupsLogic the value + * @return this builder + */ + public Builder groupsLogic(TransactionRuleCondition.GroupsLogic groupsLogic) { + return set("groups_logic", Conv.enumeration(TransactionRuleCondition.GroupsLogic::of), groupsLogic); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleCondition} + * @throws IllegalStateException when a required field is missing + */ + public TransactionRuleCondition build() { + require("field", false); + require("operator", false); + return new TransactionRuleCondition(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Comparison operator. in/not_in test membership (value may be a list or a single scalar). contains/not_contains are case-insensitive substring checks against a string value. contains_any takes a list of strings and matches when any is a case-insensitive substring of the field value. regex matches the value pattern against the field. fuzzy_match compares against the value string with the required score threshold (0-100). gt/gte/lt/lte never match when either side is missing. exists/is_not_empty/is_not_null (aliases) and not_exists/is_empty/is_null (aliases) are presence checks that ignore value. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Operator extends StringEnum { + /** The value {@code "eq"}. */ + public static final Operator EQ = new Operator("eq"); + + /** The value {@code "ne"}. */ + public static final Operator NE = new Operator("ne"); + + /** The value {@code "gt"}. */ + public static final Operator GT = new Operator("gt"); + + /** The value {@code "gte"}. */ + public static final Operator GTE = new Operator("gte"); + + /** The value {@code "lt"}. */ + public static final Operator LT = new Operator("lt"); + + /** The value {@code "lte"}. */ + public static final Operator LTE = new Operator("lte"); + + /** The value {@code "in"}. */ + public static final Operator IN = new Operator("in"); + + /** The value {@code "not_in"}. */ + public static final Operator NOT_IN = new Operator("not_in"); + + /** The value {@code "contains"}. */ + public static final Operator CONTAINS = new Operator("contains"); + + /** The value {@code "not_contains"}. */ + public static final Operator NOT_CONTAINS = new Operator("not_contains"); + + /** The value {@code "contains_any"}. */ + public static final Operator CONTAINS_ANY = new Operator("contains_any"); + + /** The value {@code "regex"}. */ + public static final Operator REGEX = new Operator("regex"); + + /** The value {@code "fuzzy_match"}. */ + public static final Operator FUZZY_MATCH = new Operator("fuzzy_match"); + + /** The value {@code "exists"}. */ + public static final Operator EXISTS = new Operator("exists"); + + /** The value {@code "is_not_empty"}. */ + public static final Operator IS_NOT_EMPTY = new Operator("is_not_empty"); + + /** The value {@code "is_not_null"}. */ + public static final Operator IS_NOT_NULL = new Operator("is_not_null"); + + /** The value {@code "not_exists"}. */ + public static final Operator NOT_EXISTS = new Operator("not_exists"); + + /** The value {@code "is_empty"}. */ + public static final Operator IS_EMPTY = new Operator("is_empty"); + + /** The value {@code "is_null"}. */ + public static final Operator IS_NULL = new Operator("is_null"); + + private static final List KNOWN_VALUES = List.of(EQ, NE, GT, GTE, LT, LTE, IN, NOT_IN, CONTAINS, NOT_CONTAINS, CONTAINS_ANY, REGEX, FUZZY_MATCH, EXISTS, IS_NOT_EMPTY, IS_NOT_NULL, NOT_EXISTS, IS_EMPTY, IS_NULL); + + private Operator(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Operator of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Operator::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Optional value interpretation. list: value is a List UUID and the list's entries become the comparison value. field: value is another field path, compared field-to-field. relative_date: value is a relative-date object, e.g. {"direction": "past", "unit": "days", "amount": 30}. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ValueType extends StringEnum { + /** The value {@code "list"}. */ + public static final ValueType LIST = new ValueType("list"); + + /** The value {@code "field"}. */ + public static final ValueType FIELD = new ValueType("field"); + + /** The value {@code "relative_date"}. */ + public static final ValueType RELATIVE_DATE = new ValueType("relative_date"); + + private static final List KNOWN_VALUES = List.of(LIST, FIELD, RELATIVE_DATE); + + private ValueType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ValueType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ValueType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * How conditions combine WITHIN a group. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class GroupLogic extends StringEnum { + /** The value {@code "AND"}. */ + public static final GroupLogic AND = new GroupLogic("AND"); + + /** The value {@code "OR"}. */ + public static final GroupLogic OR = new GroupLogic("OR"); + + private static final List KNOWN_VALUES = List.of(AND, OR); + + private GroupLogic(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static GroupLogic of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, GroupLogic::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * How group outcomes combine ACROSS groups. Read from the first condition. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class GroupsLogic extends StringEnum { + /** The value {@code "AND"}. */ + public static final GroupsLogic AND = new GroupsLogic("AND"); + + /** The value {@code "OR"}. */ + public static final GroupsLogic OR = new GroupsLogic("OR"); + + private static final List KNOWN_VALUES = List.of(AND, OR); + + private GroupsLogic(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static GroupsLogic of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, GroupsLogic::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleCreateRequest.java b/src/main/java/me/didit/types/TransactionRuleCreateRequest.java new file mode 100644 index 0000000..4fec926 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleCreateRequest.java @@ -0,0 +1,376 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Creates a CUSTOM rule. Rules in ACTIVE mode take effect immediately for new transactions - create in TEST mode and backtest first. + */ +public final class TransactionRuleCreateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "description", "category", "mode", "evaluation_mode", "scope", "conditions", "aggregation", "actions", "metadata"); + + private TransactionRuleCreateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleCreateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleCreateRequest fromJson(JsonNode json) { + return new TransactionRuleCreateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Rule name. Unique per application among non-deleted rules; duplicates return 400. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String title() { + return Json.required(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Risk theme used for grouping and reporting, e.g. finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String category() { + return Json.required(json, "category", Conv.STRING); + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionRuleCreateRequest.Mode mode() { + return Json.required(json, "mode", Conv.enumeration(TransactionRuleCreateRequest.Mode::of)); + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional evaluationMode() { + return Json.optional(json, "evaluation_mode", Conv.enumeration(TransactionRuleCreateRequest.EvaluationMode::of)); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scope() { + return Json.optional(json, "scope", Conv.model(TransactionRuleScope::fromJson)); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson))); + } + + /** + * The aggregation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aggregation() { + return Json.optional(json, "aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson))); + } + + /** + * The actions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> actions() { + return Json.optional(json, "actions", Conv.list(Conv.union(TransactionRuleAction::fromJson))); + } + + /** + * Free-form metadata stored on the rule. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleCreateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleCreateRequest from) { + super(from); + } + + /** + * Rule name. Unique per application among non-deleted rules; duplicates return 400. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Risk theme used for grouping and reporting, e.g. finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TransactionRuleCreateRequest.Mode mode) { + return set("mode", Conv.enumeration(TransactionRuleCreateRequest.Mode::of), mode); + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + * @param evaluationMode the value + * @return this builder + */ + public Builder evaluationMode(TransactionRuleCreateRequest.EvaluationMode evaluationMode) { + return set("evaluation_mode", Conv.enumeration(TransactionRuleCreateRequest.EvaluationMode::of), evaluationMode); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @param scope the value + * @return this builder + */ + public Builder scope(TransactionRuleScope scope) { + return set("scope", Conv.model(TransactionRuleScope::fromJson), scope); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson)), conditions); + } + + /** + * The aggregation field. + * + * @param aggregation the value + * @return this builder + */ + public Builder aggregation(List aggregation) { + return set("aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson)), aggregation); + } + + /** + * The actions field. + * + * @param actions the value + * @return this builder + */ + public Builder actions(List actions) { + return set("actions", Conv.list(Conv.union(TransactionRuleAction::fromJson)), actions); + } + + /** + * Free-form metadata stored on the rule. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleCreateRequest} + * @throws IllegalStateException when a required field is missing + */ + public TransactionRuleCreateRequest build() { + require("title", false); + require("category", false); + require("mode", false); + return new TransactionRuleCreateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Mode ACTIVE = new Mode("ACTIVE"); + + /** The value {@code "DISABLED"}. */ + public static final Mode DISABLED = new Mode("DISABLED"); + + /** The value {@code "TEST"}. */ + public static final Mode TEST = new Mode("TEST"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISABLED, TEST); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EvaluationMode extends StringEnum { + /** The value {@code "ALL"}. */ + public static final EvaluationMode ALL = new EvaluationMode("ALL"); + + /** The value {@code "ANY"}. */ + public static final EvaluationMode ANY = new EvaluationMode("ANY"); + + private static final List KNOWN_VALUES = List.of(ALL, ANY); + + private EvaluationMode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EvaluationMode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EvaluationMode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleDetail.java b/src/main/java/me/didit/types/TransactionRuleDetail.java new file mode 100644 index 0000000..7714b49 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleDetail.java @@ -0,0 +1,765 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class TransactionRuleDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "title", "description", "category", "mode", "evaluation_mode", "scope", "conditions", "aggregation", "actions", "metadata", "severity", "source", "library_key", "latest_triggered_at", "run_count", "approved_count", "reviewed_count", "declined_count", "awaiting_user_count", "approved_pct", "reviewed_pct", "declined_pct", "created_at", "updated_at"); + + private TransactionRuleDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleDetail fromJson(JsonNode json) { + return new TransactionRuleDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Rule name. Unique per application among non-deleted rules; duplicates return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Risk theme used for grouping and reporting, e.g. finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TransactionRuleDetail.Mode::of)); + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional evaluationMode() { + return Json.optional(json, "evaluation_mode", Conv.enumeration(TransactionRuleDetail.EvaluationMode::of)); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scope() { + return Json.optional(json, "scope", Conv.model(TransactionRuleScope::fromJson)); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson))); + } + + /** + * The aggregation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aggregation() { + return Json.optional(json, "aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson))); + } + + /** + * The actions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> actions() { + return Json.optional(json, "actions", Conv.list(Conv.union(TransactionRuleAction::fromJson))); + } + + /** + * Free-form metadata stored on the rule. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Informational severity carried by library rules; not settable on custom rules. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional severity() { + return Json.optional(json, "severity", Conv.enumeration(TransactionRuleDetail.Severity::of)); + } + + /** + * PRESET rules come from the library (install/uninstall, mode-only edits); CUSTOM rules are fully yours. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(TransactionRuleDetail.Source::of)); + } + + /** + * Stable library identifier; null for custom rules. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional libraryKey() { + return Json.optional(json, "library_key", Conv.STRING); + } + + /** + * The latest_triggered_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latestTriggeredAt() { + return Json.optional(json, "latest_triggered_at", Conv.DATE_TIME); + } + + /** + * How many transactions matched this rule. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional runCount() { + return Json.optional(json, "run_count", Conv.LONG); + } + + /** + * The approved_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approvedCount() { + return Json.optional(json, "approved_count", Conv.LONG); + } + + /** + * The reviewed_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewedCount() { + return Json.optional(json, "reviewed_count", Conv.LONG); + } + + /** + * The declined_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declinedCount() { + return Json.optional(json, "declined_count", Conv.LONG); + } + + /** + * The awaiting_user_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional awaitingUserCount() { + return Json.optional(json, "awaiting_user_count", Conv.LONG); + } + + /** + * The approved_pct field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approvedPct() { + return Json.optional(json, "approved_pct", Conv.DOUBLE); + } + + /** + * The reviewed_pct field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional reviewedPct() { + return Json.optional(json, "reviewed_pct", Conv.DOUBLE); + } + + /** + * The declined_pct field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declinedPct() { + return Json.optional(json, "declined_pct", Conv.DOUBLE); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Rule name. Unique per application among non-deleted rules; duplicates return 400. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Risk theme used for grouping and reporting, e.g. finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TransactionRuleDetail.Mode mode) { + return set("mode", Conv.enumeration(TransactionRuleDetail.Mode::of), mode); + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + * @param evaluationMode the value + * @return this builder + */ + public Builder evaluationMode(TransactionRuleDetail.EvaluationMode evaluationMode) { + return set("evaluation_mode", Conv.enumeration(TransactionRuleDetail.EvaluationMode::of), evaluationMode); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @param scope the value + * @return this builder + */ + public Builder scope(TransactionRuleScope scope) { + return set("scope", Conv.model(TransactionRuleScope::fromJson), scope); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson)), conditions); + } + + /** + * The aggregation field. + * + * @param aggregation the value + * @return this builder + */ + public Builder aggregation(List aggregation) { + return set("aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson)), aggregation); + } + + /** + * The actions field. + * + * @param actions the value + * @return this builder + */ + public Builder actions(List actions) { + return set("actions", Conv.list(Conv.union(TransactionRuleAction::fromJson)), actions); + } + + /** + * Free-form metadata stored on the rule. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Informational severity carried by library rules; not settable on custom rules. + * + * @param severity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder severity(TransactionRuleDetail.@Nullable Severity severity) { + return setNullable("severity", Conv.enumeration(TransactionRuleDetail.Severity::of), severity); + } + + /** + * PRESET rules come from the library (install/uninstall, mode-only edits); CUSTOM rules are fully yours. + * + * @param source the value + * @return this builder + */ + public Builder source(TransactionRuleDetail.Source source) { + return set("source", Conv.enumeration(TransactionRuleDetail.Source::of), source); + } + + /** + * Stable library identifier; null for custom rules. + * + * @param libraryKey the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder libraryKey(@Nullable String libraryKey) { + return setNullable("library_key", Conv.STRING, libraryKey); + } + + /** + * The latest_triggered_at field. + * + * @param latestTriggeredAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder latestTriggeredAt(@Nullable OffsetDateTime latestTriggeredAt) { + return setNullable("latest_triggered_at", Conv.DATE_TIME, latestTriggeredAt); + } + + /** + * How many transactions matched this rule. + * + * @param runCount the value + * @return this builder + */ + public Builder runCount(long runCount) { + return set("run_count", Conv.LONG, runCount); + } + + /** + * The approved_count field. + * + * @param approvedCount the value + * @return this builder + */ + public Builder approvedCount(long approvedCount) { + return set("approved_count", Conv.LONG, approvedCount); + } + + /** + * The reviewed_count field. + * + * @param reviewedCount the value + * @return this builder + */ + public Builder reviewedCount(long reviewedCount) { + return set("reviewed_count", Conv.LONG, reviewedCount); + } + + /** + * The declined_count field. + * + * @param declinedCount the value + * @return this builder + */ + public Builder declinedCount(long declinedCount) { + return set("declined_count", Conv.LONG, declinedCount); + } + + /** + * The awaiting_user_count field. + * + * @param awaitingUserCount the value + * @return this builder + */ + public Builder awaitingUserCount(long awaitingUserCount) { + return set("awaiting_user_count", Conv.LONG, awaitingUserCount); + } + + /** + * The approved_pct field. + * + * @param approvedPct the value + * @return this builder + */ + public Builder approvedPct(double approvedPct) { + return set("approved_pct", Conv.DOUBLE, approvedPct); + } + + /** + * The reviewed_pct field. + * + * @param reviewedPct the value + * @return this builder + */ + public Builder reviewedPct(double reviewedPct) { + return set("reviewed_pct", Conv.DOUBLE, reviewedPct); + } + + /** + * The declined_pct field. + * + * @param declinedPct the value + * @return this builder + */ + public Builder declinedPct(double declinedPct) { + return set("declined_pct", Conv.DOUBLE, declinedPct); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleDetail} + */ + public TransactionRuleDetail build() { + return new TransactionRuleDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Mode ACTIVE = new Mode("ACTIVE"); + + /** The value {@code "DISABLED"}. */ + public static final Mode DISABLED = new Mode("DISABLED"); + + /** The value {@code "TEST"}. */ + public static final Mode TEST = new Mode("TEST"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISABLED, TEST); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EvaluationMode extends StringEnum { + /** The value {@code "ALL"}. */ + public static final EvaluationMode ALL = new EvaluationMode("ALL"); + + /** The value {@code "ANY"}. */ + public static final EvaluationMode ANY = new EvaluationMode("ANY"); + + private static final List KNOWN_VALUES = List.of(ALL, ANY); + + private EvaluationMode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EvaluationMode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EvaluationMode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Informational severity carried by library rules; not settable on custom rules. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Severity extends StringEnum { + /** The value {@code "UNKNOWN"}. */ + public static final Severity UNKNOWN = new Severity("UNKNOWN"); + + /** The value {@code "LOW"}. */ + public static final Severity LOW = new Severity("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Severity MEDIUM = new Severity("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Severity HIGH = new Severity("HIGH"); + + /** The value {@code "CRITICAL"}. */ + public static final Severity CRITICAL = new Severity("CRITICAL"); + + private static final List KNOWN_VALUES = List.of(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL); + + private Severity(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Severity of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Severity::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * PRESET rules come from the library (install/uninstall, mode-only edits); CUSTOM rules are fully yours. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "PRESET"}. */ + public static final Source PRESET = new Source("PRESET"); + + /** The value {@code "CUSTOM"}. */ + public static final Source CUSTOM = new Source("CUSTOM"); + + private static final List KNOWN_VALUES = List.of(PRESET, CUSTOM); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleInstallRequest.java b/src/main/java/me/didit/types/TransactionRuleInstallRequest.java new file mode 100644 index 0000000..dd64dd8 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleInstallRequest.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Provide library_keys OR bundle. */ +public final class TransactionRuleInstallRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("library_keys", "bundle"); + + private TransactionRuleInstallRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleInstallRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleInstallRequest fromJson(JsonNode json) { + return new TransactionRuleInstallRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Specific presets to install or uninstall. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> libraryKeys() { + return Json.optional(json, "library_keys", Conv.list(Conv.STRING)); + } + + /** + * Install or uninstall every preset in this bundle instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bundle() { + return Json.optional(json, "bundle", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleInstallRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleInstallRequest from) { + super(from); + } + + /** + * Specific presets to install or uninstall. + * + * @param libraryKeys the value + * @return this builder + */ + public Builder libraryKeys(List libraryKeys) { + return set("library_keys", Conv.list(Conv.STRING), libraryKeys); + } + + /** + * Install or uninstall every preset in this bundle instead. + * + * @param bundle the value + * @return this builder + */ + public Builder bundle(String bundle) { + return set("bundle", Conv.STRING, bundle); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleInstallRequest} + */ + public TransactionRuleInstallRequest build() { + return new TransactionRuleInstallRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleInstallResult.java b/src/main/java/me/didit/types/TransactionRuleInstallResult.java new file mode 100644 index 0000000..6777deb --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleInstallResult.java @@ -0,0 +1,138 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TransactionRuleInstallResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("installed_library_keys", "installed_count", "uninstalled_count"); + + private TransactionRuleInstallResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleInstallResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleInstallResult fromJson(JsonNode json) { + return new TransactionRuleInstallResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * POST (install) only: presets installed by this call. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> installedLibraryKeys() { + return Json.optional(json, "installed_library_keys", Conv.list(Conv.STRING)); + } + + /** + * POST (install) only. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional installedCount() { + return Json.optional(json, "installed_count", Conv.LONG); + } + + /** + * DELETE (uninstall) only: presets removed by this call. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uninstalledCount() { + return Json.optional(json, "uninstalled_count", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleInstallResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleInstallResult from) { + super(from); + } + + /** + * POST (install) only: presets installed by this call. + * + * @param installedLibraryKeys the value + * @return this builder + */ + public Builder installedLibraryKeys(List installedLibraryKeys) { + return set("installed_library_keys", Conv.list(Conv.STRING), installedLibraryKeys); + } + + /** + * POST (install) only. + * + * @param installedCount the value + * @return this builder + */ + public Builder installedCount(long installedCount) { + return set("installed_count", Conv.LONG, installedCount); + } + + /** + * DELETE (uninstall) only: presets removed by this call. + * + * @param uninstalledCount the value + * @return this builder + */ + public Builder uninstalledCount(long uninstalledCount) { + return set("uninstalled_count", Conv.LONG, uninstalledCount); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleInstallResult} + */ + public TransactionRuleInstallResult build() { + return new TransactionRuleInstallResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleLibraryEntry.java b/src/main/java/me/didit/types/TransactionRuleLibraryEntry.java new file mode 100644 index 0000000..68477bf --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleLibraryEntry.java @@ -0,0 +1,422 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class TransactionRuleLibraryEntry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("library_key", "title", "description", "category", "evaluation_mode", "scope", "conditions", "aggregation", "actions", "metadata", "bundle", "tags", "industries", "source", "is_installed"); + + private TransactionRuleLibraryEntry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleLibraryEntry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleLibraryEntry fromJson(JsonNode json) { + return new TransactionRuleLibraryEntry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The library_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional libraryKey() { + return Json.optional(json, "library_key", Conv.STRING); + } + + /** + * The title field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The category field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * The evaluation_mode field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional evaluationMode() { + return Json.optional(json, "evaluation_mode", Conv.enumeration(TransactionRuleLibraryEntry.EvaluationMode::of)); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scope() { + return Json.optional(json, "scope", Conv.model(TransactionRuleScope::fromJson)); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson))); + } + + /** + * The aggregation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aggregation() { + return Json.optional(json, "aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson))); + } + + /** + * The actions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> actions() { + return Json.optional(json, "actions", Conv.list(Conv.union(TransactionRuleAction::fromJson))); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Functional family, e.g. finance, aml_ctf, crypto_monitoring, travel_rule, responsible_gaming. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bundle() { + return Json.optional(json, "bundle", Conv.STRING); + } + + /** + * The tags field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + /** + * The industries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> industries() { + return Json.optional(json, "industries", Conv.list(Conv.STRING)); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.STRING); + } + + /** + * Whether this preset is currently installed on the application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isInstalled() { + return Json.optional(json, "is_installed", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleLibraryEntry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleLibraryEntry from) { + super(from); + } + + /** + * The library_key field. + * + * @param libraryKey the value + * @return this builder + */ + public Builder libraryKey(String libraryKey) { + return set("library_key", Conv.STRING, libraryKey); + } + + /** + * The title field. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The category field. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * The evaluation_mode field. + * + * @param evaluationMode the value + * @return this builder + */ + public Builder evaluationMode(TransactionRuleLibraryEntry.EvaluationMode evaluationMode) { + return set("evaluation_mode", Conv.enumeration(TransactionRuleLibraryEntry.EvaluationMode::of), evaluationMode); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @param scope the value + * @return this builder + */ + public Builder scope(TransactionRuleScope scope) { + return set("scope", Conv.model(TransactionRuleScope::fromJson), scope); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson)), conditions); + } + + /** + * The aggregation field. + * + * @param aggregation the value + * @return this builder + */ + public Builder aggregation(List aggregation) { + return set("aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson)), aggregation); + } + + /** + * The actions field. + * + * @param actions the value + * @return this builder + */ + public Builder actions(List actions) { + return set("actions", Conv.list(Conv.union(TransactionRuleAction::fromJson)), actions); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Functional family, e.g. finance, aml_ctf, crypto_monitoring, travel_rule, responsible_gaming. + * + * @param bundle the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder bundle(@Nullable String bundle) { + return setNullable("bundle", Conv.STRING, bundle); + } + + /** + * The tags field. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + /** + * The industries field. + * + * @param industries the value + * @return this builder + */ + public Builder industries(List industries) { + return set("industries", Conv.list(Conv.STRING), industries); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(String source) { + return set("source", Conv.STRING, source); + } + + /** + * Whether this preset is currently installed on the application. + * + * @param isInstalled the value + * @return this builder + */ + public Builder isInstalled(boolean isInstalled) { + return set("is_installed", Conv.BOOLEAN, isInstalled); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleLibraryEntry} + */ + public TransactionRuleLibraryEntry build() { + return new TransactionRuleLibraryEntry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EvaluationMode extends StringEnum { + /** The value {@code "ALL"}. */ + public static final EvaluationMode ALL = new EvaluationMode("ALL"); + + /** The value {@code "ANY"}. */ + public static final EvaluationMode ANY = new EvaluationMode("ANY"); + + private static final List KNOWN_VALUES = List.of(ALL, ANY); + + private EvaluationMode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EvaluationMode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EvaluationMode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleScope.java b/src/main/java/me/didit/types/TransactionRuleScope.java new file mode 100644 index 0000000..652eba4 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleScope.java @@ -0,0 +1,182 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Which transactions the rule applies to. Only these three keys are accepted. */ +public final class TransactionRuleScope extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("transaction_types", "directions", "action_types"); + + private TransactionRuleScope(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleScope} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleScope fromJson(JsonNode json) { + return new TransactionRuleScope(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Restrict to transaction types, e.g. finance, kyc, travel_rule, user_event. Empty or missing = no restriction. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> transactionTypes() { + return Json.optional(json, "transaction_types", Conv.list(Conv.STRING)); + } + + /** + * Restrict to transaction directions (case-insensitive on write). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> directions() { + return Json.optional(json, "directions", Conv.list(Conv.enumeration(TransactionRuleScope.Directions::of))); + } + + /** + * Restrict to your action_type values, e.g. withdrawal, deposit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> actionTypes() { + return Json.optional(json, "action_types", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleScope}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleScope from) { + super(from); + } + + /** + * Restrict to transaction types, e.g. finance, kyc, travel_rule, user_event. Empty or missing = no restriction. + * + * @param transactionTypes the value + * @return this builder + */ + public Builder transactionTypes(List transactionTypes) { + return set("transaction_types", Conv.list(Conv.STRING), transactionTypes); + } + + /** + * Restrict to transaction directions (case-insensitive on write). + * + * @param directions the value + * @return this builder + */ + public Builder directions(List directions) { + return set("directions", Conv.list(Conv.enumeration(TransactionRuleScope.Directions::of)), directions); + } + + /** + * Restrict to your action_type values, e.g. withdrawal, deposit. + * + * @param actionTypes the value + * @return this builder + */ + public Builder actionTypes(List actionTypes) { + return set("action_types", Conv.list(Conv.STRING), actionTypes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleScope} + */ + public TransactionRuleScope build() { + return new TransactionRuleScope(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Directions extends StringEnum { + /** The value {@code "INBOUND"}. */ + public static final Directions INBOUND = new Directions("INBOUND"); + + /** The value {@code "OUTBOUND"}. */ + public static final Directions OUTBOUND = new Directions("OUTBOUND"); + + private static final List KNOWN_VALUES = List.of(INBOUND, OUTBOUND); + + private Directions(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Directions of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Directions::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionRuleUpdateRequest.java b/src/main/java/me/didit/types/TransactionRuleUpdateRequest.java new file mode 100644 index 0000000..e9db6e1 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionRuleUpdateRequest.java @@ -0,0 +1,372 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Partial update. Custom rules accept every field; library (PRESET) rules accept only mode - anything else returns 400. + */ +public final class TransactionRuleUpdateRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("title", "description", "category", "mode", "evaluation_mode", "scope", "conditions", "aggregation", "actions", "metadata"); + + private TransactionRuleUpdateRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionRuleUpdateRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionRuleUpdateRequest fromJson(JsonNode json) { + return new TransactionRuleUpdateRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Rule name. Unique per application among non-deleted rules; duplicates return 400. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional title() { + return Json.optional(json, "title", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Risk theme used for grouping and reporting, e.g. finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TransactionRuleUpdateRequest.Mode::of)); + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional evaluationMode() { + return Json.optional(json, "evaluation_mode", Conv.enumeration(TransactionRuleUpdateRequest.EvaluationMode::of)); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional scope() { + return Json.optional(json, "scope", Conv.model(TransactionRuleScope::fromJson)); + } + + /** + * The conditions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> conditions() { + return Json.optional(json, "conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson))); + } + + /** + * The aggregation field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> aggregation() { + return Json.optional(json, "aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson))); + } + + /** + * The actions field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> actions() { + return Json.optional(json, "actions", Conv.list(Conv.union(TransactionRuleAction::fromJson))); + } + + /** + * Free-form metadata stored on the rule. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionRuleUpdateRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionRuleUpdateRequest from) { + super(from); + } + + /** + * Rule name. Unique per application among non-deleted rules; duplicates return 400. + * + * @param title the value + * @return this builder + */ + public Builder title(String title) { + return set("title", Conv.STRING, title); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Risk theme used for grouping and reporting, e.g. finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TransactionRuleUpdateRequest.Mode mode) { + return set("mode", Conv.enumeration(TransactionRuleUpdateRequest.Mode::of), mode); + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + * @param evaluationMode the value + * @return this builder + */ + public Builder evaluationMode(TransactionRuleUpdateRequest.EvaluationMode evaluationMode) { + return set("evaluation_mode", Conv.enumeration(TransactionRuleUpdateRequest.EvaluationMode::of), evaluationMode); + } + + /** + * Which transactions the rule applies to. Only these three keys are accepted. + * + * @param scope the value + * @return this builder + */ + public Builder scope(TransactionRuleScope scope) { + return set("scope", Conv.model(TransactionRuleScope::fromJson), scope); + } + + /** + * The conditions field. + * + * @param conditions the value + * @return this builder + */ + public Builder conditions(List conditions) { + return set("conditions", Conv.list(Conv.model(TransactionRuleCondition::fromJson)), conditions); + } + + /** + * The aggregation field. + * + * @param aggregation the value + * @return this builder + */ + public Builder aggregation(List aggregation) { + return set("aggregation", Conv.list(Conv.model(TransactionRuleAggregation::fromJson)), aggregation); + } + + /** + * The actions field. + * + * @param actions the value + * @return this builder + */ + public Builder actions(List actions) { + return set("actions", Conv.list(Conv.union(TransactionRuleAction::fromJson)), actions); + } + + /** + * Free-form metadata stored on the rule. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionRuleUpdateRequest} + */ + public TransactionRuleUpdateRequest build() { + return new TransactionRuleUpdateRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or status - the recommended starting mode. DISABLED is skipped. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Mode ACTIVE = new Mode("ACTIVE"); + + /** The value {@code "DISABLED"}. */ + public static final Mode DISABLED = new Mode("DISABLED"); + + /** The value {@code "TEST"}. */ + public static final Mode TEST = new Mode("TEST"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISABLED, TEST); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Whether every condition must match (ALL) or at least one (ANY). Ignored when conditions use group_index. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class EvaluationMode extends StringEnum { + /** The value {@code "ALL"}. */ + public static final EvaluationMode ALL = new EvaluationMode("ALL"); + + /** The value {@code "ANY"}. */ + public static final EvaluationMode ANY = new EvaluationMode("ANY"); + + private static final List KNOWN_VALUES = List.of(ALL, ANY); + + private EvaluationMode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static EvaluationMode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, EvaluationMode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsCreateParams.java b/src/main/java/me/didit/types/TransactionsCreateParams.java new file mode 100644 index 0000000..c827d46 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsCreateParams.java @@ -0,0 +1,3106 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code transactions.create}. */ +public final class TransactionsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("transaction_id", "transaction_at", "time_zone", "transaction_category", "transaction_details", "subject", "counterparty", "custom_properties", "travel_rule_details", "network_snapshot", "include_crypto_screening"); + + private TransactionsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsCreateParams fromJson(JsonNode json) { + return new TransactionsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your unique identifier for this transaction (max 128 characters). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String transactionId() { + return Json.required(json, "transaction_id", Conv.STRING); + } + + /** + * When the transaction occurred. Defaults to now if omitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionAt() { + return Json.optional(json, "transaction_at", Conv.DATE_TIME); + } + + /** + * IANA time zone identifier, e.g. Europe/Madrid. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeZone() { + return Json.optional(json, "time_zone", Conv.STRING); + } + + /** + * Category of the transaction. CamelCase aliases (travelRule, userPlatformEvent, gamblingBet, โ€ฆ) are also accepted; the stored/echoed value is camelCase for multi-word categories. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionsCreateParams.TransactionCategory transactionCategory() { + return Json.required(json, "transaction_category", Conv.enumeration(TransactionsCreateParams.TransactionCategory::of)); + } + + /** + * Core financial details of the transaction. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionsCreateParams.TransactionDetails transactionDetails() { + return Json.required(json, "transaction_details", Conv.model(TransactionsCreateParams.TransactionDetails::fromJson)); + } + + /** + * The subject (applicant) of the transaction. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionsCreateParams.Subject subject() { + return Json.required(json, "subject", Conv.model(TransactionsCreateParams.Subject::fromJson)); + } + + /** + * The counterparty of the transaction (optional). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional counterparty() { + return Json.optional(json, "counterparty", Conv.model(TransactionsCreateParams.Counterparty::fromJson)); + } + + /** + * Arbitrary key-value pairs attached to the transaction. Each key can be referenced in rule conditions with the field path custom_values.<key>. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> customProperties() { + return Json.optional(json, "custom_properties", Conv.OBJECT); + } + + /** + * Travel Rule compliance metadata. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelRuleDetails() { + return Json.optional(json, "travel_rule_details", Conv.model(TransactionsCreateParams.TravelRuleDetails::fromJson)); + } + + /** + * Pre-computed network graph snapshot. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkSnapshot() { + return Json.optional(json, "network_snapshot", Conv.model(TransactionsCreateParams.NetworkSnapshot::fromJson)); + } + + /** + * Per-transaction override for crypto blockchain analytics screening. When true, crypto screening is performed regardless of the application default. When false, crypto screening is skipped even if enabled in the application settings. When omitted or null, the application-level default configured in the Console is used. Crypto screening requires transaction_details.direction, currency_kind: "crypto", a chain/currency, and the wallet address selected by the direction: inbound pre-transfer screening uses counterparty.payment_method.account_id, inbound transaction-hash screening uses subject.payment_method.account_id, and outbound screening uses counterparty.payment_method.account_id. When transaction_details.payment_reference_id contains a blockchain transaction hash, Didit performs transaction screening and returns transaction summary enrichment when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional includeCryptoScreening() { + return Json.optional(json, "include_crypto_screening", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsCreateParams from) { + super(from); + } + + /** + * Your unique identifier for this transaction (max 128 characters). + * + * @param transactionId the value + * @return this builder + */ + public Builder transactionId(String transactionId) { + return set("transaction_id", Conv.STRING, transactionId); + } + + /** + * When the transaction occurred. Defaults to now if omitted. + * + * @param transactionAt the value + * @return this builder + */ + public Builder transactionAt(OffsetDateTime transactionAt) { + return set("transaction_at", Conv.DATE_TIME, transactionAt); + } + + /** + * IANA time zone identifier, e.g. Europe/Madrid. + * + * @param timeZone the value + * @return this builder + */ + public Builder timeZone(String timeZone) { + return set("time_zone", Conv.STRING, timeZone); + } + + /** + * Category of the transaction. CamelCase aliases (travelRule, userPlatformEvent, gamblingBet, โ€ฆ) are also accepted; the stored/echoed value is camelCase for multi-word categories. + * + * @param transactionCategory the value + * @return this builder + */ + public Builder transactionCategory(TransactionsCreateParams.TransactionCategory transactionCategory) { + return set("transaction_category", Conv.enumeration(TransactionsCreateParams.TransactionCategory::of), transactionCategory); + } + + /** + * Core financial details of the transaction. + * + * @param transactionDetails the value + * @return this builder + */ + public Builder transactionDetails(TransactionsCreateParams.TransactionDetails transactionDetails) { + return set("transaction_details", Conv.model(TransactionsCreateParams.TransactionDetails::fromJson), transactionDetails); + } + + /** + * The subject (applicant) of the transaction. + * + * @param subject the value + * @return this builder + */ + public Builder subject(TransactionsCreateParams.Subject subject) { + return set("subject", Conv.model(TransactionsCreateParams.Subject::fromJson), subject); + } + + /** + * The counterparty of the transaction (optional). + * + * @param counterparty the value + * @return this builder + */ + public Builder counterparty(TransactionsCreateParams.Counterparty counterparty) { + return set("counterparty", Conv.model(TransactionsCreateParams.Counterparty::fromJson), counterparty); + } + + /** + * Arbitrary key-value pairs attached to the transaction. Each key can be referenced in rule conditions with the field path custom_values.<key>. + * + * @param customProperties the value + * @return this builder + */ + public Builder customProperties(Map customProperties) { + return setAny("custom_properties", customProperties); + } + + /** + * Travel Rule compliance metadata. + * + * @param travelRuleDetails the value + * @return this builder + */ + public Builder travelRuleDetails(TransactionsCreateParams.TravelRuleDetails travelRuleDetails) { + return set("travel_rule_details", Conv.model(TransactionsCreateParams.TravelRuleDetails::fromJson), travelRuleDetails); + } + + /** + * Pre-computed network graph snapshot. + * + * @param networkSnapshot the value + * @return this builder + */ + public Builder networkSnapshot(TransactionsCreateParams.NetworkSnapshot networkSnapshot) { + return set("network_snapshot", Conv.model(TransactionsCreateParams.NetworkSnapshot::fromJson), networkSnapshot); + } + + /** + * Per-transaction override for crypto blockchain analytics screening. When true, crypto screening is performed regardless of the application default. When false, crypto screening is skipped even if enabled in the application settings. When omitted or null, the application-level default configured in the Console is used. Crypto screening requires transaction_details.direction, currency_kind: "crypto", a chain/currency, and the wallet address selected by the direction: inbound pre-transfer screening uses counterparty.payment_method.account_id, inbound transaction-hash screening uses subject.payment_method.account_id, and outbound screening uses counterparty.payment_method.account_id. When transaction_details.payment_reference_id contains a blockchain transaction hash, Didit performs transaction screening and returns transaction summary enrichment when available. + * + * @param includeCryptoScreening the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder includeCryptoScreening(@Nullable Boolean includeCryptoScreening) { + return setNullable("include_crypto_screening", Conv.BOOLEAN, includeCryptoScreening); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public TransactionsCreateParams build() { + require("transaction_id", false); + require("transaction_category", false); + require("transaction_details", false); + require("subject", false); + return new TransactionsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Category of the transaction. CamelCase aliases (travelRule, userPlatformEvent, gamblingBet, โ€ฆ) are also accepted; the stored/echoed value is camelCase for multi-word categories. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TransactionCategory extends StringEnum { + /** The value {@code "finance"}. */ + public static final TransactionCategory FINANCE = new TransactionCategory("finance"); + + /** The value {@code "kyc"}. */ + public static final TransactionCategory KYC = new TransactionCategory("kyc"); + + /** The value {@code "travel_rule"}. */ + public static final TransactionCategory TRAVEL_RULE = new TransactionCategory("travel_rule"); + + /** The value {@code "user_event"}. */ + public static final TransactionCategory USER_EVENT = new TransactionCategory("user_event"); + + /** The value {@code "audit_trail_event"}. */ + public static final TransactionCategory AUDIT_TRAIL_EVENT = new TransactionCategory("audit_trail_event"); + + /** The value {@code "gambling_bet"}. */ + public static final TransactionCategory GAMBLING_BET = new TransactionCategory("gambling_bet"); + + /** The value {@code "gambling_limit_change"}. */ + public static final TransactionCategory GAMBLING_LIMIT_CHANGE = new TransactionCategory("gambling_limit_change"); + + /** The value {@code "gambling_bonus_change"}. */ + public static final TransactionCategory GAMBLING_BONUS_CHANGE = new TransactionCategory("gambling_bonus_change"); + + /** The value {@code "travelRule"}. */ + public static final TransactionCategory TRAVEL_RULE_2 = new TransactionCategory("travelRule"); + + private static final List KNOWN_VALUES = List.of(FINANCE, KYC, TRAVEL_RULE, USER_EVENT, AUDIT_TRAIL_EVENT, GAMBLING_BET, GAMBLING_LIMIT_CHANGE, GAMBLING_BONUS_CHANGE, TRAVEL_RULE_2); + + private TransactionCategory(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TransactionCategory of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TransactionCategory::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Core financial details of the transaction. */ + public static final class TransactionDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("direction", "amount", "currency", "currency_kind", "amount_in_default_currency", "default_currency", "payment_details", "payment_reference_id", "action_type", "crypto_params"); + + private TransactionDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionDetails fromJson(JsonNode json) { + return new TransactionDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Direction of the transaction relative to the subject. Case-insensitive; in/out are accepted as aliases. Echoed back uppercase (INBOUND/OUTBOUND). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TransactionsCreateParams.TransactionDetails.Direction direction() { + return Json.required(json, "direction", Conv.enumeration(TransactionsCreateParams.TransactionDetails.Direction::of)); + } + + /** + * Transaction amount (up to 18 decimal places). Send it as a decimal string (e.g. "0.123456789012345678") when exact precision matters: a JSON number is parsed as a binary float first, so digits beyond about 15 significant digits are rounded before the amount is stored. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double amount() { + return Json.required(json, "amount", Conv.DOUBLE); + } + + /** + * Currency code. Any ISO 4217 alphabetic code is accepted (e.g. EUR, USD, NGN), as is a crypto asset symbol (e.g. BTC). Prefer a currently-circulating code. Not every accepted code has an exchange rate: when none is available for the code (for example the ISO accounting unit XSU, or a crypto symbol Didit does not price), automatic conversion fails and preferred_currency_amount is returned null unless the request supplied a pre-converted amount_in_default_currency. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String currency() { + return Json.required(json, "currency", Conv.STRING); + } + + /** + * Whether the currency is fiat or crypto. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currencyKind() { + return Json.optional(json, "currency_kind", Conv.STRING); + } + + /** + * Pre-converted amount in the default currency. If omitted, automatic FX conversion is attempted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amountInDefaultCurrency() { + return Json.optional(json, "amount_in_default_currency", Conv.DOUBLE); + } + + /** + * The default currency code for the converted amount. Any currently-circulating ISO 4217 code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional defaultCurrency() { + return Json.optional(json, "default_currency", Conv.STRING); + } + + /** + * Free-text payment reference or memo. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentDetails() { + return Json.optional(json, "payment_details", Conv.STRING); + } + + /** + * External payment system reference. For crypto AML transaction-hash screening, send the blockchain transaction hash and also provide subject.payment_method.account_id with the related address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentReferenceId() { + return Json.optional(json, "payment_reference_id", Conv.STRING); + } + + /** + * Sub-type of the transaction, e.g. deposit, withdrawal, transfer. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actionType() { + return Json.optional(json, "action_type", Conv.STRING); + } + + /** + * Crypto network selection, separate from currency (the asset symbol). Recording a custom token symbol does not guarantee transaction-hash coverage for its contract. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional cryptoParams() { + return Json.optional(json, "crypto_params", Conv.model(TransactionsCreateParams.TransactionDetails.CryptoParams::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionDetails from) { + super(from); + } + + /** + * Direction of the transaction relative to the subject. Case-insensitive; in/out are accepted as aliases. Echoed back uppercase (INBOUND/OUTBOUND). + * + * @param direction the value + * @return this builder + */ + public Builder direction(TransactionsCreateParams.TransactionDetails.Direction direction) { + return set("direction", Conv.enumeration(TransactionsCreateParams.TransactionDetails.Direction::of), direction); + } + + /** + * Transaction amount (up to 18 decimal places). Send it as a decimal string (e.g. "0.123456789012345678") when exact precision matters: a JSON number is parsed as a binary float first, so digits beyond about 15 significant digits are rounded before the amount is stored. + * + * @param amount the value + * @return this builder + */ + public Builder amount(double amount) { + return set("amount", Conv.DOUBLE, amount); + } + + /** + * Currency code. Any ISO 4217 alphabetic code is accepted (e.g. EUR, USD, NGN), as is a crypto asset symbol (e.g. BTC). Prefer a currently-circulating code. Not every accepted code has an exchange rate: when none is available for the code (for example the ISO accounting unit XSU, or a crypto symbol Didit does not price), automatic conversion fails and preferred_currency_amount is returned null unless the request supplied a pre-converted amount_in_default_currency. + * + * @param currency the value + * @return this builder + */ + public Builder currency(String currency) { + return set("currency", Conv.STRING, currency); + } + + /** + * Whether the currency is fiat or crypto. + * + * @param currencyKind the value + * @return this builder + */ + public Builder currencyKind(String currencyKind) { + return set("currency_kind", Conv.STRING, currencyKind); + } + + /** + * Pre-converted amount in the default currency. If omitted, automatic FX conversion is attempted. + * + * @param amountInDefaultCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amountInDefaultCurrency(@Nullable Double amountInDefaultCurrency) { + return setNullable("amount_in_default_currency", Conv.DOUBLE, amountInDefaultCurrency); + } + + /** + * The default currency code for the converted amount. Any currently-circulating ISO 4217 code. + * + * @param defaultCurrency the value + * @return this builder + */ + public Builder defaultCurrency(String defaultCurrency) { + return set("default_currency", Conv.STRING, defaultCurrency); + } + + /** + * Free-text payment reference or memo. + * + * @param paymentDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder paymentDetails(@Nullable String paymentDetails) { + return setNullable("payment_details", Conv.STRING, paymentDetails); + } + + /** + * External payment system reference. For crypto AML transaction-hash screening, send the blockchain transaction hash and also provide subject.payment_method.account_id with the related address. + * + * @param paymentReferenceId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder paymentReferenceId(@Nullable String paymentReferenceId) { + return setNullable("payment_reference_id", Conv.STRING, paymentReferenceId); + } + + /** + * Sub-type of the transaction, e.g. deposit, withdrawal, transfer. + * + * @param actionType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actionType(@Nullable String actionType) { + return setNullable("action_type", Conv.STRING, actionType); + } + + /** + * Crypto network selection, separate from currency (the asset symbol). Recording a custom token symbol does not guarantee transaction-hash coverage for its contract. + * + * @param cryptoParams the value + * @return this builder + */ + public Builder cryptoParams(TransactionsCreateParams.TransactionDetails.CryptoParams cryptoParams) { + return set("crypto_params", Conv.model(TransactionsCreateParams.TransactionDetails.CryptoParams::fromJson), cryptoParams); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionDetails} + * @throws IllegalStateException when a required field is missing + */ + public TransactionDetails build() { + require("direction", false); + require("amount", false); + require("currency", false); + return new TransactionDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Direction of the transaction relative to the subject. Case-insensitive; in/out are accepted as aliases. Echoed back uppercase (INBOUND/OUTBOUND). + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Direction extends StringEnum { + /** The value {@code "inbound"}. */ + public static final Direction INBOUND = new Direction("inbound"); + + /** The value {@code "outbound"}. */ + public static final Direction OUTBOUND = new Direction("outbound"); + + /** The value {@code "in"}. */ + public static final Direction IN = new Direction("in"); + + /** The value {@code "out"}. */ + public static final Direction OUT = new Direction("out"); + + private static final List KNOWN_VALUES = List.of(INBOUND, OUTBOUND, IN, OUT); + + private Direction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Direction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Direction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Crypto network selection, separate from currency (the asset symbol). Recording a custom token symbol does not guarantee transaction-hash coverage for its contract. + */ + public static final class CryptoParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("crypto_chain"); + + private CryptoParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CryptoParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CryptoParams fromJson(JsonNode json) { + return new CryptoParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Actual network used for screening. Managed screening supports BTC, ETH, LTC, XRP, BCH, DOGE, TRX, SOL, MATIC, BNB, BASE (Base), OP (Optimism) and ARB (Arbitrum One). Always specify this for multi-network tokens. Connected-provider coverage varies; LIGHTNING requires a supported connected provider. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional cryptoChain() { + return Json.optional(json, "crypto_chain", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CryptoParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CryptoParams from) { + super(from); + } + + /** + * Actual network used for screening. Managed screening supports BTC, ETH, LTC, XRP, BCH, DOGE, TRX, SOL, MATIC, BNB, BASE (Base), OP (Optimism) and ARB (Arbitrum One). Always specify this for multi-network tokens. Connected-provider coverage varies; LIGHTNING requires a supported connected provider. + * + * @param cryptoChain the value + * @return this builder + */ + public Builder cryptoChain(String cryptoChain) { + return set("crypto_chain", Conv.STRING, cryptoChain); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CryptoParams} + */ + public CryptoParams build() { + return new CryptoParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** The subject (applicant) of the transaction. */ + public static final class Subject extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entity_type", "vendor_data", "full_name", "first_name", "last_name", "date_of_birth", "address", "institution_details", "device_context", "payment_method"); + + private Subject(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Subject} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Subject fromJson(JsonNode json) { + return new Subject(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entity type: individual or company. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * Your internal user/business identifier. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String vendorData() { + return Json.required(json, "vendor_data", Conv.STRING); + } + + /** + * Full name of the subject. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String fullName() { + return Json.required(json, "full_name", Conv.STRING); + } + + /** + * First name of the subject. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * Last name of the subject. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * Date of birth (YYYY-MM-DD). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Address object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.model(TransactionsCreateParams.Subject.Address::fromJson)); + } + + /** + * Institution details (for institutional subjects). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional institutionDetails() { + return Json.optional(json, "institution_details", Conv.model(TransactionsCreateParams.Subject.InstitutionDetails::fromJson)); + } + + /** + * Device context captured at transaction time. browser_family and platform must be sent as explicit top-level keys โ€” they are not derived from user_agent. The camelCase alias device is also accepted on the request. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceContext() { + return Json.optional(json, "device_context", Conv.model(TransactionsCreateParams.Subject.DeviceContext::fromJson)); + } + + /** + * Payment method used by the subject. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentMethod() { + return Json.optional(json, "payment_method", Conv.model(TransactionsCreateParams.Subject.PaymentMethod::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Subject}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Subject from) { + super(from); + } + + /** + * Entity type: individual or company. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * Your internal user/business identifier. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Full name of the subject. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * First name of the subject. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * Last name of the subject. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * Date of birth (YYYY-MM-DD). + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Address object. + * + * @param address the value + * @return this builder + */ + public Builder address(TransactionsCreateParams.Subject.Address address) { + return set("address", Conv.model(TransactionsCreateParams.Subject.Address::fromJson), address); + } + + /** + * Institution details (for institutional subjects). + * + * @param institutionDetails the value + * @return this builder + */ + public Builder institutionDetails(TransactionsCreateParams.Subject.InstitutionDetails institutionDetails) { + return set("institution_details", Conv.model(TransactionsCreateParams.Subject.InstitutionDetails::fromJson), institutionDetails); + } + + /** + * Device context captured at transaction time. browser_family and platform must be sent as explicit top-level keys โ€” they are not derived from user_agent. The camelCase alias device is also accepted on the request. + * + * @param deviceContext the value + * @return this builder + */ + public Builder deviceContext(TransactionsCreateParams.Subject.DeviceContext deviceContext) { + return set("device_context", Conv.model(TransactionsCreateParams.Subject.DeviceContext::fromJson), deviceContext); + } + + /** + * Payment method used by the subject. + * + * @param paymentMethod the value + * @return this builder + */ + public Builder paymentMethod(TransactionsCreateParams.Subject.PaymentMethod paymentMethod) { + return set("payment_method", Conv.model(TransactionsCreateParams.Subject.PaymentMethod::fromJson), paymentMethod); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Subject} + * @throws IllegalStateException when a required field is missing + */ + public Subject build() { + require("vendor_data", false); + require("full_name", false); + return new Subject(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Address object. */ + public static final class Address extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("country", "town", "state", "street", "post_code"); + + private Address(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Address} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Address fromJson(JsonNode json) { + return new Address(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Country code (ISO 3166-1 alpha-3 recommended). Copied to the party's country_code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The town field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional town() { + return Json.optional(json, "town", Conv.STRING); + } + + /** + * The state field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional state() { + return Json.optional(json, "state", Conv.STRING); + } + + /** + * The street field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional street() { + return Json.optional(json, "street", Conv.STRING); + } + + /** + * The post_code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional postCode() { + return Json.optional(json, "post_code", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Address}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Address from) { + super(from); + } + + /** + * Country code (ISO 3166-1 alpha-3 recommended). Copied to the party's country_code. + * + * @param country the value + * @return this builder + */ + public Builder country(String country) { + return set("country", Conv.STRING, country); + } + + /** + * The town field. + * + * @param town the value + * @return this builder + */ + public Builder town(String town) { + return set("town", Conv.STRING, town); + } + + /** + * The state field. + * + * @param state the value + * @return this builder + */ + public Builder state(String state) { + return set("state", Conv.STRING, state); + } + + /** + * The street field. + * + * @param street the value + * @return this builder + */ + public Builder street(String street) { + return set("street", Conv.STRING, street); + } + + /** + * The post_code field. + * + * @param postCode the value + * @return this builder + */ + public Builder postCode(String postCode) { + return set("post_code", Conv.STRING, postCode); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Address} + */ + public Address build() { + return new Address(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Institution details (for institutional subjects). */ + public static final class InstitutionDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "code", "address"); + + private InstitutionDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code InstitutionDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static InstitutionDetails fromJson(JsonNode json) { + return new InstitutionDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The code field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional code() { + return Json.optional(json, "code", Conv.STRING); + } + + /** + * The address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> address() { + return Json.optional(json, "address", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link InstitutionDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(InstitutionDetails from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The code field. + * + * @param code the value + * @return this builder + */ + public Builder code(String code) { + return set("code", Conv.STRING, code); + } + + /** + * The address field. + * + * @param address the value + * @return this builder + */ + public Builder address(Map address) { + return setAny("address", address); + } + + /** + * Builds the value. + * + * @return a new immutable {@code InstitutionDetails} + */ + public InstitutionDetails build() { + return new InstitutionDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** + * Device context captured at transaction time. browser_family and platform must be sent as explicit top-level keys โ€” they are not derived from user_agent. The camelCase alias device is also accepted on the request. + */ + public static final class DeviceContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("fingerprint", "persistent_device_id", "user_agent", "browser_family", "browser_version", "platform", "os_family", "os_version", "accept_language", "session_id", "session_age_ms", "network_context"); + + private DeviceContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DeviceContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DeviceContext fromJson(JsonNode json) { + return new DeviceContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique device fingerprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fingerprint() { + return Json.optional(json, "fingerprint", Conv.STRING); + } + + /** + * Stable cross-session device identifier (v2 fingerprint schema). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional persistentDeviceId() { + return Json.optional(json, "persistent_device_id", Conv.STRING); + } + + /** + * Browser or app user agent string. CamelCase alias: userAgent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + /** + * Browser family (e.g. Chrome, Firefox, Safari). Must be sent explicitly โ€” it is not derived from user_agent. CamelCase alias: browserFamily. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserFamily() { + return Json.optional(json, "browser_family", Conv.STRING); + } + + /** + * Browser version string. Must be sent explicitly. CamelCase alias: browserVersion. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserVersion() { + return Json.optional(json, "browser_version", Conv.STRING); + } + + /** + * Platform identifier (web, ios, android, macos, windows, linux). Must be sent explicitly โ€” it is not derived from user_agent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platform() { + return Json.optional(json, "platform", Conv.STRING); + } + + /** + * Operating system family (e.g. iOS, Android, Windows). CamelCase alias: osFamily. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osFamily() { + return Json.optional(json, "os_family", Conv.STRING); + } + + /** + * Operating system version string. CamelCase alias: osVersion. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osVersion() { + return Json.optional(json, "os_version", Conv.STRING); + } + + /** + * Accept-Language header value. CamelCase alias: acceptLang. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional acceptLanguage() { + return Json.optional(json, "accept_language", Conv.STRING); + } + + /** + * Session identifier of the user current session. Stored in metadata. CamelCase alias: sessionId. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Age of the user session in milliseconds at transaction time. CamelCase alias: sessionAgeMs. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionAgeMs() { + return Json.optional(json, "session_age_ms", Conv.DOUBLE); + } + + /** + * Network context with IP address and geo-location. A top-level ipInfo block is also folded into this object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkContext() { + return Json.optional(json, "network_context", Conv.model(TransactionsCreateParams.Subject.DeviceContext.NetworkContext::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DeviceContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DeviceContext from) { + super(from); + } + + /** + * Unique device fingerprint. + * + * @param fingerprint the value + * @return this builder + */ + public Builder fingerprint(String fingerprint) { + return set("fingerprint", Conv.STRING, fingerprint); + } + + /** + * Stable cross-session device identifier (v2 fingerprint schema). + * + * @param persistentDeviceId the value + * @return this builder + */ + public Builder persistentDeviceId(String persistentDeviceId) { + return set("persistent_device_id", Conv.STRING, persistentDeviceId); + } + + /** + * Browser or app user agent string. CamelCase alias: userAgent. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Browser family (e.g. Chrome, Firefox, Safari). Must be sent explicitly โ€” it is not derived from user_agent. CamelCase alias: browserFamily. + * + * @param browserFamily the value + * @return this builder + */ + public Builder browserFamily(String browserFamily) { + return set("browser_family", Conv.STRING, browserFamily); + } + + /** + * Browser version string. Must be sent explicitly. CamelCase alias: browserVersion. + * + * @param browserVersion the value + * @return this builder + */ + public Builder browserVersion(String browserVersion) { + return set("browser_version", Conv.STRING, browserVersion); + } + + /** + * Platform identifier (web, ios, android, macos, windows, linux). Must be sent explicitly โ€” it is not derived from user_agent. + * + * @param platform the value + * @return this builder + */ + public Builder platform(String platform) { + return set("platform", Conv.STRING, platform); + } + + /** + * Operating system family (e.g. iOS, Android, Windows). CamelCase alias: osFamily. + * + * @param osFamily the value + * @return this builder + */ + public Builder osFamily(String osFamily) { + return set("os_family", Conv.STRING, osFamily); + } + + /** + * Operating system version string. CamelCase alias: osVersion. + * + * @param osVersion the value + * @return this builder + */ + public Builder osVersion(String osVersion) { + return set("os_version", Conv.STRING, osVersion); + } + + /** + * Accept-Language header value. CamelCase alias: acceptLang. + * + * @param acceptLanguage the value + * @return this builder + */ + public Builder acceptLanguage(String acceptLanguage) { + return set("accept_language", Conv.STRING, acceptLanguage); + } + + /** + * Session identifier of the user current session. Stored in metadata. CamelCase alias: sessionId. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Age of the user session in milliseconds at transaction time. CamelCase alias: sessionAgeMs. + * + * @param sessionAgeMs the value + * @return this builder + */ + public Builder sessionAgeMs(double sessionAgeMs) { + return set("session_age_ms", Conv.DOUBLE, sessionAgeMs); + } + + /** + * Network context with IP address and geo-location. A top-level ipInfo block is also folded into this object. + * + * @param networkContext the value + * @return this builder + */ + public Builder networkContext(TransactionsCreateParams.Subject.DeviceContext.NetworkContext networkContext) { + return set("network_context", Conv.model(TransactionsCreateParams.Subject.DeviceContext.NetworkContext::fromJson), networkContext); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DeviceContext} + */ + public DeviceContext build() { + return new DeviceContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Network context with IP address and geo-location. A top-level ipInfo block is also folded into this object. + */ + public static final class NetworkContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip_address", "ip_country_code", "latitude", "longitude"); + + private NetworkContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkContext fromJson(JsonNode json) { + return new NetworkContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Client IP address. CamelCase alias: ip. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Geo-resolved country of the IP (ISO 3166-1 alpha-3). CamelCase alias: countryCode3. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * Geographic latitude of the IP. CamelCase alias: lat. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Geographic longitude of the IP. CamelCase alias: lon. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkContext from) { + super(from); + } + + /** + * Client IP address. CamelCase alias: ip. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Geo-resolved country of the IP (ISO 3166-1 alpha-3). CamelCase alias: countryCode3. + * + * @param ipCountryCode the value + * @return this builder + */ + public Builder ipCountryCode(String ipCountryCode) { + return set("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * Geographic latitude of the IP. CamelCase alias: lat. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * Geographic longitude of the IP. CamelCase alias: lon. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkContext} + */ + public NetworkContext build() { + return new NetworkContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** Payment method used by the subject. */ + public static final class PaymentMethod extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("method_type", "account_id", "issuing_country"); + + private PaymentMethod(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PaymentMethod} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PaymentMethod fromJson(JsonNode json) { + return new PaymentMethod(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Type of payment method: bank_card, bank_account, crypto_wallet, ewallet, unhosted_wallet, other. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional methodType() { + return Json.optional(json, "method_type", Conv.STRING); + } + + /** + * Account identifier (e.g. IBAN, wallet address). For crypto screening, this should contain the wallet address for this participant. Inbound transaction-hash screening requires the service/customer deposit address on the subject. Outbound screening uses the destination wallet on the counterparty. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional accountId() { + return Json.optional(json, "account_id", Conv.STRING); + } + + /** + * ISO 3166-1 alpha-3 country code of the issuer. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingCountry() { + return Json.optional(json, "issuing_country", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PaymentMethod}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PaymentMethod from) { + super(from); + } + + /** + * Type of payment method: bank_card, bank_account, crypto_wallet, ewallet, unhosted_wallet, other. + * + * @param methodType the value + * @return this builder + */ + public Builder methodType(String methodType) { + return set("method_type", Conv.STRING, methodType); + } + + /** + * Account identifier (e.g. IBAN, wallet address). For crypto screening, this should contain the wallet address for this participant. Inbound transaction-hash screening requires the service/customer deposit address on the subject. Outbound screening uses the destination wallet on the counterparty. + * + * @param accountId the value + * @return this builder + */ + public Builder accountId(String accountId) { + return set("account_id", Conv.STRING, accountId); + } + + /** + * ISO 3166-1 alpha-3 country code of the issuer. + * + * @param issuingCountry the value + * @return this builder + */ + public Builder issuingCountry(String issuingCountry) { + return set("issuing_country", Conv.STRING, issuingCountry); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PaymentMethod} + */ + public PaymentMethod build() { + return new PaymentMethod(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** The counterparty of the transaction (optional). */ + public static final class Counterparty extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entity_type", "vendor_data", "full_name", "first_name", "last_name", "date_of_birth", "address", "institution_details", "device_context", "payment_method"); + + private Counterparty(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Counterparty} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Counterparty fromJson(JsonNode json) { + return new Counterparty(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entity type: individual or company. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * Your internal identifier for the counterparty. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Full name of the counterparty. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The first_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstName() { + return Json.optional(json, "first_name", Conv.STRING); + } + + /** + * The last_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastName() { + return Json.optional(json, "last_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Address object with country (ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> address() { + return Json.optional(json, "address", Conv.OBJECT); + } + + /** + * The institution_details field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> institutionDetails() { + return Json.optional(json, "institution_details", Conv.OBJECT); + } + + /** + * Device context for the counterparty. browser_family and platform must be sent as explicit top-level keys โ€” they are not derived from user_agent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deviceContext() { + return Json.optional(json, "device_context", Conv.model(TransactionsCreateParams.Counterparty.DeviceContext::fromJson)); + } + + /** + * Payment method used by the counterparty. On travelRule transactions, method_type: "unhosted_wallet" declares the counterparty wallet as self-hosted: the transfer skips counterparty-VASP routing, is created directly in UNCONFIRMED_OWNERSHIP, and (when auto_wallet_verification is enabled) a wallet-ownership widget session is auto-minted and returned in the transaction's action_required block. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentMethod() { + return Json.optional(json, "payment_method", Conv.model(TransactionsCreateParams.Counterparty.PaymentMethod::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Counterparty}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Counterparty from) { + super(from); + } + + /** + * Entity type: individual or company. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * Your internal identifier for the counterparty. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Full name of the counterparty. + * + * @param fullName the value + * @return this builder + */ + public Builder fullName(String fullName) { + return set("full_name", Conv.STRING, fullName); + } + + /** + * The first_name field. + * + * @param firstName the value + * @return this builder + */ + public Builder firstName(String firstName) { + return set("first_name", Conv.STRING, firstName); + } + + /** + * The last_name field. + * + * @param lastName the value + * @return this builder + */ + public Builder lastName(String lastName) { + return set("last_name", Conv.STRING, lastName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value + * @return this builder + */ + public Builder dateOfBirth(LocalDate dateOfBirth) { + return set("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Address object with country (ISO 3166-1 alpha-3). + * + * @param address the value + * @return this builder + */ + public Builder address(Map address) { + return setAny("address", address); + } + + /** + * The institution_details field. + * + * @param institutionDetails the value + * @return this builder + */ + public Builder institutionDetails(Map institutionDetails) { + return setAny("institution_details", institutionDetails); + } + + /** + * Device context for the counterparty. browser_family and platform must be sent as explicit top-level keys โ€” they are not derived from user_agent. + * + * @param deviceContext the value + * @return this builder + */ + public Builder deviceContext(TransactionsCreateParams.Counterparty.DeviceContext deviceContext) { + return set("device_context", Conv.model(TransactionsCreateParams.Counterparty.DeviceContext::fromJson), deviceContext); + } + + /** + * Payment method used by the counterparty. On travelRule transactions, method_type: "unhosted_wallet" declares the counterparty wallet as self-hosted: the transfer skips counterparty-VASP routing, is created directly in UNCONFIRMED_OWNERSHIP, and (when auto_wallet_verification is enabled) a wallet-ownership widget session is auto-minted and returned in the transaction's action_required block. + * + * @param paymentMethod the value + * @return this builder + */ + public Builder paymentMethod(TransactionsCreateParams.Counterparty.PaymentMethod paymentMethod) { + return set("payment_method", Conv.model(TransactionsCreateParams.Counterparty.PaymentMethod::fromJson), paymentMethod); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Counterparty} + */ + public Counterparty build() { + return new Counterparty(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Device context for the counterparty. browser_family and platform must be sent as explicit top-level keys โ€” they are not derived from user_agent. + */ + public static final class DeviceContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("fingerprint", "persistent_device_id", "user_agent", "browser_family", "browser_version", "platform", "os_family", "os_version", "accept_language", "session_id", "session_age_ms", "network_context"); + + private DeviceContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DeviceContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DeviceContext fromJson(JsonNode json) { + return new DeviceContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Unique device fingerprint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fingerprint() { + return Json.optional(json, "fingerprint", Conv.STRING); + } + + /** + * Stable cross-session device identifier (v2 fingerprint schema). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional persistentDeviceId() { + return Json.optional(json, "persistent_device_id", Conv.STRING); + } + + /** + * Browser or app user agent string. CamelCase alias: userAgent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional userAgent() { + return Json.optional(json, "user_agent", Conv.STRING); + } + + /** + * Browser family (e.g. Chrome, Firefox, Safari). Must be sent explicitly โ€” it is not derived from user_agent. CamelCase alias: browserFamily. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserFamily() { + return Json.optional(json, "browser_family", Conv.STRING); + } + + /** + * Browser version string. Must be sent explicitly. CamelCase alias: browserVersion. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional browserVersion() { + return Json.optional(json, "browser_version", Conv.STRING); + } + + /** + * Platform identifier (web, ios, android, macos, windows, linux). Must be sent explicitly โ€” it is not derived from user_agent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platform() { + return Json.optional(json, "platform", Conv.STRING); + } + + /** + * Operating system family (e.g. iOS, Android, Windows). CamelCase alias: osFamily. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osFamily() { + return Json.optional(json, "os_family", Conv.STRING); + } + + /** + * Operating system version string. CamelCase alias: osVersion. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional osVersion() { + return Json.optional(json, "os_version", Conv.STRING); + } + + /** + * Accept-Language header value. CamelCase alias: acceptLang. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional acceptLanguage() { + return Json.optional(json, "accept_language", Conv.STRING); + } + + /** + * Session identifier for the counterparty session. Stored in metadata. CamelCase alias: sessionId. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionId() { + return Json.optional(json, "session_id", Conv.STRING); + } + + /** + * Age of the user session in milliseconds at transaction time. CamelCase alias: sessionAgeMs. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionAgeMs() { + return Json.optional(json, "session_age_ms", Conv.DOUBLE); + } + + /** + * Network context with IP address and geo-location. A top-level ipInfo block is also folded into this object. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networkContext() { + return Json.optional(json, "network_context", Conv.model(TransactionsCreateParams.Counterparty.DeviceContext.NetworkContext::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DeviceContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DeviceContext from) { + super(from); + } + + /** + * Unique device fingerprint. + * + * @param fingerprint the value + * @return this builder + */ + public Builder fingerprint(String fingerprint) { + return set("fingerprint", Conv.STRING, fingerprint); + } + + /** + * Stable cross-session device identifier (v2 fingerprint schema). + * + * @param persistentDeviceId the value + * @return this builder + */ + public Builder persistentDeviceId(String persistentDeviceId) { + return set("persistent_device_id", Conv.STRING, persistentDeviceId); + } + + /** + * Browser or app user agent string. CamelCase alias: userAgent. + * + * @param userAgent the value + * @return this builder + */ + public Builder userAgent(String userAgent) { + return set("user_agent", Conv.STRING, userAgent); + } + + /** + * Browser family (e.g. Chrome, Firefox, Safari). Must be sent explicitly โ€” it is not derived from user_agent. CamelCase alias: browserFamily. + * + * @param browserFamily the value + * @return this builder + */ + public Builder browserFamily(String browserFamily) { + return set("browser_family", Conv.STRING, browserFamily); + } + + /** + * Browser version string. Must be sent explicitly. CamelCase alias: browserVersion. + * + * @param browserVersion the value + * @return this builder + */ + public Builder browserVersion(String browserVersion) { + return set("browser_version", Conv.STRING, browserVersion); + } + + /** + * Platform identifier (web, ios, android, macos, windows, linux). Must be sent explicitly โ€” it is not derived from user_agent. + * + * @param platform the value + * @return this builder + */ + public Builder platform(String platform) { + return set("platform", Conv.STRING, platform); + } + + /** + * Operating system family (e.g. iOS, Android, Windows). CamelCase alias: osFamily. + * + * @param osFamily the value + * @return this builder + */ + public Builder osFamily(String osFamily) { + return set("os_family", Conv.STRING, osFamily); + } + + /** + * Operating system version string. CamelCase alias: osVersion. + * + * @param osVersion the value + * @return this builder + */ + public Builder osVersion(String osVersion) { + return set("os_version", Conv.STRING, osVersion); + } + + /** + * Accept-Language header value. CamelCase alias: acceptLang. + * + * @param acceptLanguage the value + * @return this builder + */ + public Builder acceptLanguage(String acceptLanguage) { + return set("accept_language", Conv.STRING, acceptLanguage); + } + + /** + * Session identifier for the counterparty session. Stored in metadata. CamelCase alias: sessionId. + * + * @param sessionId the value + * @return this builder + */ + public Builder sessionId(String sessionId) { + return set("session_id", Conv.STRING, sessionId); + } + + /** + * Age of the user session in milliseconds at transaction time. CamelCase alias: sessionAgeMs. + * + * @param sessionAgeMs the value + * @return this builder + */ + public Builder sessionAgeMs(double sessionAgeMs) { + return set("session_age_ms", Conv.DOUBLE, sessionAgeMs); + } + + /** + * Network context with IP address and geo-location. A top-level ipInfo block is also folded into this object. + * + * @param networkContext the value + * @return this builder + */ + public Builder networkContext(TransactionsCreateParams.Counterparty.DeviceContext.NetworkContext networkContext) { + return set("network_context", Conv.model(TransactionsCreateParams.Counterparty.DeviceContext.NetworkContext::fromJson), networkContext); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DeviceContext} + */ + public DeviceContext build() { + return new DeviceContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Network context with IP address and geo-location. A top-level ipInfo block is also folded into this object. + */ + public static final class NetworkContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("ip_address", "ip_country_code", "latitude", "longitude"); + + private NetworkContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkContext fromJson(JsonNode json) { + return new NetworkContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Client IP address. CamelCase alias: ip. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipAddress() { + return Json.optional(json, "ip_address", Conv.STRING); + } + + /** + * Geo-resolved country of the IP (ISO 3166-1 alpha-3). CamelCase alias: countryCode3. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ipCountryCode() { + return Json.optional(json, "ip_country_code", Conv.STRING); + } + + /** + * Geographic latitude of the IP. CamelCase alias: lat. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional latitude() { + return Json.optional(json, "latitude", Conv.DOUBLE); + } + + /** + * Geographic longitude of the IP. CamelCase alias: lon. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional longitude() { + return Json.optional(json, "longitude", Conv.DOUBLE); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkContext from) { + super(from); + } + + /** + * Client IP address. CamelCase alias: ip. + * + * @param ipAddress the value + * @return this builder + */ + public Builder ipAddress(String ipAddress) { + return set("ip_address", Conv.STRING, ipAddress); + } + + /** + * Geo-resolved country of the IP (ISO 3166-1 alpha-3). CamelCase alias: countryCode3. + * + * @param ipCountryCode the value + * @return this builder + */ + public Builder ipCountryCode(String ipCountryCode) { + return set("ip_country_code", Conv.STRING, ipCountryCode); + } + + /** + * Geographic latitude of the IP. CamelCase alias: lat. + * + * @param latitude the value + * @return this builder + */ + public Builder latitude(double latitude) { + return set("latitude", Conv.DOUBLE, latitude); + } + + /** + * Geographic longitude of the IP. CamelCase alias: lon. + * + * @param longitude the value + * @return this builder + */ + public Builder longitude(double longitude) { + return set("longitude", Conv.DOUBLE, longitude); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkContext} + */ + public NetworkContext build() { + return new NetworkContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** + * Payment method used by the counterparty. On travelRule transactions, method_type: "unhosted_wallet" declares the counterparty wallet as self-hosted: the transfer skips counterparty-VASP routing, is created directly in UNCONFIRMED_OWNERSHIP, and (when auto_wallet_verification is enabled) a wallet-ownership widget session is auto-minted and returned in the transaction's action_required block. + */ + public static final class PaymentMethod extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("method_type", "account_id", "issuing_country"); + + private PaymentMethod(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code PaymentMethod} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static PaymentMethod fromJson(JsonNode json) { + return new PaymentMethod(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Type of payment method: bank_card, bank_account, crypto_wallet, ewallet, unhosted_wallet, other. Use unhosted_wallet to declare a self-hosted wallet for the Travel Rule. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional methodType() { + return Json.optional(json, "method_type", Conv.STRING); + } + + /** + * Account identifier (e.g. IBAN or wallet address). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional accountId() { + return Json.optional(json, "account_id", Conv.STRING); + } + + /** + * The issuing_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional issuingCountry() { + return Json.optional(json, "issuing_country", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link PaymentMethod}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(PaymentMethod from) { + super(from); + } + + /** + * Type of payment method: bank_card, bank_account, crypto_wallet, ewallet, unhosted_wallet, other. Use unhosted_wallet to declare a self-hosted wallet for the Travel Rule. + * + * @param methodType the value + * @return this builder + */ + public Builder methodType(String methodType) { + return set("method_type", Conv.STRING, methodType); + } + + /** + * Account identifier (e.g. IBAN or wallet address). + * + * @param accountId the value + * @return this builder + */ + public Builder accountId(String accountId) { + return set("account_id", Conv.STRING, accountId); + } + + /** + * The issuing_country field. + * + * @param issuingCountry the value + * @return this builder + */ + public Builder issuingCountry(String issuingCountry) { + return set("issuing_country", Conv.STRING, issuingCountry); + } + + /** + * Builds the value. + * + * @return a new immutable {@code PaymentMethod} + */ + public PaymentMethod build() { + return new PaymentMethod(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + + /** Travel Rule compliance metadata. */ + public static final class TravelRuleDetails extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "protocol", "required", "obligations_count", "originator_data", "beneficiary_data", "metadata"); + + private TravelRuleDetails(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleDetails} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleDetails fromJson(JsonNode json) { + return new TravelRuleDetails(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String status() { + return Json.required(json, "status", Conv.STRING); + } + + /** + * The protocol field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional protocol() { + return Json.optional(json, "protocol", Conv.STRING); + } + + /** + * The required field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional required() { + return Json.optional(json, "required", Conv.BOOLEAN); + } + + /** + * The obligations_count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional obligationsCount() { + return Json.optional(json, "obligations_count", Conv.LONG); + } + + /** + * The originator_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> originatorData() { + return Json.optional(json, "originator_data", Conv.OBJECT); + } + + /** + * The beneficiary_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficiaryData() { + return Json.optional(json, "beneficiary_data", Conv.OBJECT); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleDetails}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleDetails from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The protocol field. + * + * @param protocol the value + * @return this builder + */ + public Builder protocol(String protocol) { + return set("protocol", Conv.STRING, protocol); + } + + /** + * The required field. + * + * @param required the value + * @return this builder + */ + public Builder required(boolean required) { + return set("required", Conv.BOOLEAN, required); + } + + /** + * The obligations_count field. + * + * @param obligationsCount the value + * @return this builder + */ + public Builder obligationsCount(long obligationsCount) { + return set("obligations_count", Conv.LONG, obligationsCount); + } + + /** + * The originator_data field. + * + * @param originatorData the value + * @return this builder + */ + public Builder originatorData(Map originatorData) { + return setAny("originator_data", originatorData); + } + + /** + * The beneficiary_data field. + * + * @param beneficiaryData the value + * @return this builder + */ + public Builder beneficiaryData(Map beneficiaryData) { + return setAny("beneficiary_data", beneficiaryData); + } + + /** + * The metadata field. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleDetails} + * @throws IllegalStateException when a required field is missing + */ + public TravelRuleDetails build() { + require("status", false); + return new TravelRuleDetails(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Pre-computed network graph snapshot. */ + public static final class NetworkSnapshot extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("nodes", "edges", "metrics"); + + private NetworkSnapshot(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code NetworkSnapshot} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static NetworkSnapshot fromJson(JsonNode json) { + return new NetworkSnapshot(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The nodes field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> nodes() { + return Json.optional(json, "nodes", Conv.list(Conv.OBJECT)); + } + + /** + * The edges field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> edges() { + return Json.optional(json, "edges", Conv.list(Conv.OBJECT)); + } + + /** + * The metrics field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metrics() { + return Json.optional(json, "metrics", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link NetworkSnapshot}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(NetworkSnapshot from) { + super(from); + } + + /** + * The nodes field. + * + * @param nodes the value + * @return this builder + */ + public Builder nodes(List> nodes) { + return setAny("nodes", nodes); + } + + /** + * The edges field. + * + * @param edges the value + * @return this builder + */ + public Builder edges(List> edges) { + return setAny("edges", edges); + } + + /** + * The metrics field. + * + * @param metrics the value + * @return this builder + */ + public Builder metrics(Map metrics) { + return setAny("metrics", metrics); + } + + /** + * Builds the value. + * + * @return a new immutable {@code NetworkSnapshot} + */ + public NetworkSnapshot build() { + return new NetworkSnapshot(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsCreateSdkTokenParams.java b/src/main/java/me/didit/types/TransactionsCreateSdkTokenParams.java new file mode 100644 index 0000000..dbd7fe2 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsCreateSdkTokenParams.java @@ -0,0 +1,142 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code transactions.create_sdk_token}. */ +public final class TransactionsCreateSdkTokenParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "ttl_seconds", "max_uses"); + + private TransactionsCreateSdkTokenParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsCreateSdkTokenParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsCreateSdkTokenParams fromJson(JsonNode json) { + return new TransactionsCreateSdkTokenParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your internal identifier for the end user this token is scoped to. Enforced as the subject identity of every transaction submitted with the token. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String vendorData() { + return Json.required(json, "vendor_data", Conv.STRING); + } + + /** + * Token lifetime in seconds. Defaults to 900 (15 minutes); maximum 86400 (24 hours). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ttlSeconds() { + return Json.optional(json, "ttl_seconds", Conv.LONG); + } + + /** + * Maximum number of successful submissions allowed with this token. Omit or null for unlimited uses within the TTL. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxUses() { + return Json.optional(json, "max_uses", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsCreateSdkTokenParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsCreateSdkTokenParams from) { + super(from); + } + + /** + * Your internal identifier for the end user this token is scoped to. Enforced as the subject identity of every transaction submitted with the token. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Token lifetime in seconds. Defaults to 900 (15 minutes); maximum 86400 (24 hours). + * + * @param ttlSeconds the value + * @return this builder + */ + public Builder ttlSeconds(long ttlSeconds) { + return set("ttl_seconds", Conv.LONG, ttlSeconds); + } + + /** + * Maximum number of successful submissions allowed with this token. Omit or null for unlimited uses within the TTL. + * + * @param maxUses the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxUses(@Nullable Long maxUses) { + return setNullable("max_uses", Conv.LONG, maxUses); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsCreateSdkTokenParams} + * @throws IllegalStateException when a required field is missing + */ + public TransactionsCreateSdkTokenParams build() { + require("vendor_data", false); + return new TransactionsCreateSdkTokenParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsCreateSdkTokenResponse.java b/src/main/java/me/didit/types/TransactionsCreateSdkTokenResponse.java new file mode 100644 index 0000000..3ba6ad9 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsCreateSdkTokenResponse.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TransactionsCreateSdkTokenResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("sdk_token", "expires_at"); + + private TransactionsCreateSdkTokenResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsCreateSdkTokenResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsCreateSdkTokenResponse fromJson(JsonNode json) { + return new TransactionsCreateSdkTokenResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The scoped transaction token to pass to the SDK. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sdkToken() { + return Json.optional(json, "sdk_token", Conv.STRING); + } + + /** + * When the token stops being accepted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsCreateSdkTokenResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsCreateSdkTokenResponse from) { + super(from); + } + + /** + * The scoped transaction token to pass to the SDK. + * + * @param sdkToken the value + * @return this builder + */ + public Builder sdkToken(String sdkToken) { + return set("sdk_token", Conv.STRING, sdkToken); + } + + /** + * When the token stops being accepted. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsCreateSdkTokenResponse} + */ + public TransactionsCreateSdkTokenResponse build() { + return new TransactionsCreateSdkTokenResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsListNetworksResponse.java b/src/main/java/me/didit/types/TransactionsListNetworksResponse.java new file mode 100644 index 0000000..3dd9201 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsListNetworksResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TransactionsListNetworksResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private TransactionsListNetworksResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsListNetworksResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsListNetworksResponse fromJson(JsonNode json) { + return new TransactionsListNetworksResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(EntityNetworkMembership::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsListNetworksResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsListNetworksResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(EntityNetworkMembership::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsListNetworksResponse} + */ + public TransactionsListNetworksResponse build() { + return new TransactionsListNetworksResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsListParams.java b/src/main/java/me/didit/types/TransactionsListParams.java new file mode 100644 index 0000000..934f078 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code transactions.list}. */ +public final class TransactionsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private TransactionsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsListParams fromJson(JsonNode json) { + return new TransactionsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages small for latency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset of the first record to return. Prefer following the next URL from the previous page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsListParams from) { + super(from); + } + + /** + * Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages small for latency. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset of the first record to return. Prefer following the next URL from the previous page. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsListParams} + */ + public TransactionsListParams build() { + return new TransactionsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsListPartyNetworksResponse.java b/src/main/java/me/didit/types/TransactionsListPartyNetworksResponse.java new file mode 100644 index 0000000..b7a5a7b --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsListPartyNetworksResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TransactionsListPartyNetworksResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private TransactionsListPartyNetworksResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsListPartyNetworksResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsListPartyNetworksResponse fromJson(JsonNode json) { + return new TransactionsListPartyNetworksResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(EntityNetworkMembership::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsListPartyNetworksResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsListPartyNetworksResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(EntityNetworkMembership::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsListPartyNetworksResponse} + */ + public TransactionsListPartyNetworksResponse build() { + return new TransactionsListPartyNetworksResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsListResponse.java b/src/main/java/me/didit/types/TransactionsListResponse.java new file mode 100644 index 0000000..716e746 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsListResponse.java @@ -0,0 +1,1118 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class TransactionsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "total_transactions", "results"); + + private TransactionsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsListResponse fromJson(JsonNode json) { + return new TransactionsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Capped count of matching transactions (exact up to 100, capped thereafter). Use total_transactions for the true count when paginating. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * Exact total count of (non-deleted) transactions for the application. Present on paginated responses. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalTransactions() { + return Json.optional(json, "total_transactions", Conv.LONG); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(TransactionsListResponse.Results::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsListResponse from) { + super(from); + } + + /** + * Capped count of matching transactions (exact up to 100, capped thereafter). Use total_transactions for the true count when paginating. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * Exact total count of (non-deleted) transactions for the application. Present on paginated responses. + * + * @param totalTransactions the value + * @return this builder + */ + public Builder totalTransactions(long totalTransactions) { + return set("total_transactions", Conv.LONG, totalTransactions); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(TransactionsListResponse.Results::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsListResponse} + */ + public TransactionsListResponse build() { + return new TransactionsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "transaction_number", "txn_id", "transaction_type", "action_type", "status", "direction", "amount", "currency", "preferred_currency_amount", "preferred_currency_code", "payment_details", "score", "severity", "subject_name", "subject_vendor_data", "subject_country", "counterparty_name", "counterparty_vendor_data", "counterparty_country", "tags", "txn_date", "created_at", "decision_reason_code", "decision_reason_label", "assigned_to_name"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable Didit transaction identifier. Use as {transaction_id} in detail/notes/related calls. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Application-scoped sequential transaction number shown in Console (e.g. 4123). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionNumber() { + return Json.optional(json, "transaction_number", Conv.LONG); + } + + /** + * Customer-provided identifier from the create call (max 128 chars). Unique per application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional txnId() { + return Json.optional(json, "txn_id", Conv.STRING); + } + + /** + * Top-level category as stored: finance, kyc, travelRule, userPlatformEvent, gamblingBet, gamblingLimitChange, gamblingBonusChange, auditTrailEvent. Note multi-word values are echoed back in camelCase even when submitted in snake_case. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionType() { + return Json.optional(json, "transaction_type", Conv.STRING); + } + + /** + * Sub-type within the category (e.g. deposit, withdrawal, transfer). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actionType() { + return Json.optional(json, "action_type", Conv.STRING); + } + + /** + * Current monitoring verdict. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(TransactionsListResponse.Results.Status::of)); + } + + /** + * Direction relative to the subject. Stored uppercase regardless of the casing submitted. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional direction() { + return Json.optional(json, "direction", Conv.enumeration(TransactionsListResponse.Results.Direction::of)); + } + + /** + * Transaction amount as a decimal string with trailing zeros stripped (e.g. "1500", "0.5", "0.123456789012345678"). Up to 18 decimal places. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amount() { + return Json.optional(json, "amount", Conv.STRING); + } + + /** + * Currency code of amount. Any ISO 4217 alphabetic code is accepted (e.g. EUR, USD, NGN), as is a crypto asset symbol (e.g. BTC). Prefer a currently-circulating code. Not every accepted code has an exchange rate: when none is available for the code (for example the ISO accounting unit XSU, or a crypto symbol Didit does not price), automatic conversion fails and preferred_currency_amount is returned null unless the request supplied a pre-converted amount_in_default_currency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currency() { + return Json.optional(json, "currency", Conv.STRING); + } + + /** + * amount converted to the application's preferred currency, when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional preferredCurrencyAmount() { + return Json.optional(json, "preferred_currency_amount", Conv.STRING); + } + + /** + * Preferred currency code used for preferred_currency_amount - the application's base currency, any currently-circulating ISO 4217 code. A code with no available exchange rate leaves preferred_currency_amount null unless the request supplied a pre-converted amount_in_default_currency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional preferredCurrencyCode() { + return Json.optional(json, "preferred_currency_code", Conv.STRING); + } + + /** + * Free-text payment reference or memo from the submission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentDetails() { + return Json.optional(json, "payment_details", Conv.STRING); + } + + /** + * Risk score (typically 0โ€“100). Higher = riskier. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional score() { + return Json.optional(json, "score", Conv.LONG); + } + + /** + * Categorical risk severity set by rules/providers (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL). null until something sets it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional severity() { + return Json.optional(json, "severity", Conv.enumeration(TransactionsListResponse.Results.Severity::of)); + } + + /** + * Full name of the APPLICANT party. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subjectName() { + return Json.optional(json, "subject_name", Conv.STRING); + } + + /** + * Your internal user/business identifier for the applicant. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subjectVendorData() { + return Json.optional(json, "subject_vendor_data", Conv.STRING); + } + + /** + * Country code of the applicant, from the submitted address.country (typically ISO 3166-1 alpha-3). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subjectCountry() { + return Json.optional(json, "subject_country", Conv.STRING); + } + + /** + * Full name of the COUNTERPARTY party, if any. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional counterpartyName() { + return Json.optional(json, "counterparty_name", Conv.STRING); + } + + /** + * Your internal identifier for the counterparty. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional counterpartyVendorData() { + return Json.optional(json, "counterparty_vendor_data", Conv.STRING); + } + + /** + * Country code of the counterparty, from the submitted address.country. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional counterpartyCountry() { + return Json.optional(json, "counterparty_country", Conv.STRING); + } + + /** + * Tags attached to the transaction (manually or by rules). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(TransactionsListResponse.Results.Tags::fromJson))); + } + + /** + * When the transaction occurred (from transaction_at at create time). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional txnDate() { + return Json.optional(json, "txn_date", Conv.DATE_TIME); + } + + /** + * When Didit recorded the submission. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * Machine-readable reason for the current status (e.g. WALLET_HIGH_RISK). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional decisionReasonCode() { + return Json.optional(json, "decision_reason_code", Conv.STRING); + } + + /** + * Human-readable label for decision_reason_code. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional decisionReasonLabel() { + return Json.optional(json, "decision_reason_label", Conv.STRING); + } + + /** + * Display name of the Console reviewer assigned to this transaction. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional assignedToName() { + return Json.optional(json, "assigned_to_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Stable Didit transaction identifier. Use as {transaction_id} in detail/notes/related calls. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Application-scoped sequential transaction number shown in Console (e.g. 4123). + * + * @param transactionNumber the value + * @return this builder + */ + public Builder transactionNumber(long transactionNumber) { + return set("transaction_number", Conv.LONG, transactionNumber); + } + + /** + * Customer-provided identifier from the create call (max 128 chars). Unique per application. + * + * @param txnId the value + * @return this builder + */ + public Builder txnId(String txnId) { + return set("txn_id", Conv.STRING, txnId); + } + + /** + * Top-level category as stored: finance, kyc, travelRule, userPlatformEvent, gamblingBet, gamblingLimitChange, gamblingBonusChange, auditTrailEvent. Note multi-word values are echoed back in camelCase even when submitted in snake_case. + * + * @param transactionType the value + * @return this builder + */ + public Builder transactionType(String transactionType) { + return set("transaction_type", Conv.STRING, transactionType); + } + + /** + * Sub-type within the category (e.g. deposit, withdrawal, transfer). + * + * @param actionType the value + * @return this builder + */ + public Builder actionType(String actionType) { + return set("action_type", Conv.STRING, actionType); + } + + /** + * Current monitoring verdict. + * + * @param status the value + * @return this builder + */ + public Builder status(TransactionsListResponse.Results.Status status) { + return set("status", Conv.enumeration(TransactionsListResponse.Results.Status::of), status); + } + + /** + * Direction relative to the subject. Stored uppercase regardless of the casing submitted. + * + * @param direction the value + * @return this builder + */ + public Builder direction(TransactionsListResponse.Results.Direction direction) { + return set("direction", Conv.enumeration(TransactionsListResponse.Results.Direction::of), direction); + } + + /** + * Transaction amount as a decimal string with trailing zeros stripped (e.g. "1500", "0.5", "0.123456789012345678"). Up to 18 decimal places. + * + * @param amount the value + * @return this builder + */ + public Builder amount(String amount) { + return set("amount", Conv.STRING, amount); + } + + /** + * Currency code of amount. Any ISO 4217 alphabetic code is accepted (e.g. EUR, USD, NGN), as is a crypto asset symbol (e.g. BTC). Prefer a currently-circulating code. Not every accepted code has an exchange rate: when none is available for the code (for example the ISO accounting unit XSU, or a crypto symbol Didit does not price), automatic conversion fails and preferred_currency_amount is returned null unless the request supplied a pre-converted amount_in_default_currency. + * + * @param currency the value + * @return this builder + */ + public Builder currency(String currency) { + return set("currency", Conv.STRING, currency); + } + + /** + * amount converted to the application's preferred currency, when available. + * + * @param preferredCurrencyAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder preferredCurrencyAmount(@Nullable String preferredCurrencyAmount) { + return setNullable("preferred_currency_amount", Conv.STRING, preferredCurrencyAmount); + } + + /** + * Preferred currency code used for preferred_currency_amount - the application's base currency, any currently-circulating ISO 4217 code. A code with no available exchange rate leaves preferred_currency_amount null unless the request supplied a pre-converted amount_in_default_currency. + * + * @param preferredCurrencyCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder preferredCurrencyCode(@Nullable String preferredCurrencyCode) { + return setNullable("preferred_currency_code", Conv.STRING, preferredCurrencyCode); + } + + /** + * Free-text payment reference or memo from the submission. + * + * @param paymentDetails the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder paymentDetails(@Nullable String paymentDetails) { + return setNullable("payment_details", Conv.STRING, paymentDetails); + } + + /** + * Risk score (typically 0โ€“100). Higher = riskier. + * + * @param score the value + * @return this builder + */ + public Builder score(long score) { + return set("score", Conv.LONG, score); + } + + /** + * Categorical risk severity set by rules/providers (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL). null until something sets it. + * + * @param severity the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder severity(TransactionsListResponse.Results.@Nullable Severity severity) { + return setNullable("severity", Conv.enumeration(TransactionsListResponse.Results.Severity::of), severity); + } + + /** + * Full name of the APPLICANT party. + * + * @param subjectName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subjectName(@Nullable String subjectName) { + return setNullable("subject_name", Conv.STRING, subjectName); + } + + /** + * Your internal user/business identifier for the applicant. + * + * @param subjectVendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subjectVendorData(@Nullable String subjectVendorData) { + return setNullable("subject_vendor_data", Conv.STRING, subjectVendorData); + } + + /** + * Country code of the applicant, from the submitted address.country (typically ISO 3166-1 alpha-3). + * + * @param subjectCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder subjectCountry(@Nullable String subjectCountry) { + return setNullable("subject_country", Conv.STRING, subjectCountry); + } + + /** + * Full name of the COUNTERPARTY party, if any. + * + * @param counterpartyName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder counterpartyName(@Nullable String counterpartyName) { + return setNullable("counterparty_name", Conv.STRING, counterpartyName); + } + + /** + * Your internal identifier for the counterparty. + * + * @param counterpartyVendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder counterpartyVendorData(@Nullable String counterpartyVendorData) { + return setNullable("counterparty_vendor_data", Conv.STRING, counterpartyVendorData); + } + + /** + * Country code of the counterparty, from the submitted address.country. + * + * @param counterpartyCountry the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder counterpartyCountry(@Nullable String counterpartyCountry) { + return setNullable("counterparty_country", Conv.STRING, counterpartyCountry); + } + + /** + * Tags attached to the transaction (manually or by rules). + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(TransactionsListResponse.Results.Tags::fromJson)), tags); + } + + /** + * When the transaction occurred (from transaction_at at create time). + * + * @param txnDate the value + * @return this builder + */ + public Builder txnDate(OffsetDateTime txnDate) { + return set("txn_date", Conv.DATE_TIME, txnDate); + } + + /** + * When Didit recorded the submission. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Machine-readable reason for the current status (e.g. WALLET_HIGH_RISK). + * + * @param decisionReasonCode the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder decisionReasonCode(@Nullable String decisionReasonCode) { + return setNullable("decision_reason_code", Conv.STRING, decisionReasonCode); + } + + /** + * Human-readable label for decision_reason_code. + * + * @param decisionReasonLabel the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder decisionReasonLabel(@Nullable String decisionReasonLabel) { + return setNullable("decision_reason_label", Conv.STRING, decisionReasonLabel); + } + + /** + * Display name of the Console reviewer assigned to this transaction. + * + * @param assignedToName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder assignedToName(@Nullable String assignedToName) { + return setNullable("assigned_to_name", Conv.STRING, assignedToName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Current monitoring verdict. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "APPROVED"}. */ + public static final Status APPROVED = new Status("APPROVED"); + + /** The value {@code "IN_REVIEW"}. */ + public static final Status IN_REVIEW = new Status("IN_REVIEW"); + + /** The value {@code "DECLINED"}. */ + public static final Status DECLINED = new Status("DECLINED"); + + /** The value {@code "AWAITING_USER"}. */ + public static final Status AWAITING_USER = new Status("AWAITING_USER"); + + private static final List KNOWN_VALUES = List.of(APPROVED, IN_REVIEW, DECLINED, AWAITING_USER); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Direction relative to the subject. Stored uppercase regardless of the casing submitted. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Direction extends StringEnum { + /** The value {@code "INBOUND"}. */ + public static final Direction INBOUND = new Direction("INBOUND"); + + /** The value {@code "OUTBOUND"}. */ + public static final Direction OUTBOUND = new Direction("OUTBOUND"); + + private static final List KNOWN_VALUES = List.of(INBOUND, OUTBOUND); + + private Direction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Direction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Direction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Categorical risk severity set by rules/providers (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL). null until something sets it. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Severity extends StringEnum { + /** The value {@code "UNKNOWN"}. */ + public static final Severity UNKNOWN = new Severity("UNKNOWN"); + + /** The value {@code "LOW"}. */ + public static final Severity LOW = new Severity("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Severity MEDIUM = new Severity("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Severity HIGH = new Severity("HIGH"); + + /** The value {@code "CRITICAL"}. */ + public static final Severity CRITICAL = new Severity("CRITICAL"); + + private static final List KNOWN_VALUES = List.of(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL); + + private Severity(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Severity of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Severity::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Tags extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "color", "description", "source"); + + private Tags(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tags} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tags fromJson(JsonNode json) { + return new Tags(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The color field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional color() { + return Json.optional(json, "color", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * Whether the tag is a Didit preset or a custom tag. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(TransactionsListResponse.Results.Tags.Source::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tags}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tags from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The color field. + * + * @param color the value + * @return this builder + */ + public Builder color(String color) { + return set("color", Conv.STRING, color); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * Whether the tag is a Didit preset or a custom tag. + * + * @param source the value + * @return this builder + */ + public Builder source(TransactionsListResponse.Results.Tags.Source source) { + return set("source", Conv.enumeration(TransactionsListResponse.Results.Tags.Source::of), source); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tags} + */ + public Tags build() { + return new Tags(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the tag is a Didit preset or a custom tag. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "didit"}. */ + public static final Source DIDIT = new Source("didit"); + + /** The value {@code "custom"}. */ + public static final Source CUSTOM = new Source("custom"); + + private static final List KNOWN_VALUES = List.of(DIDIT, CUSTOM); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsRulesListLibraryParams.java b/src/main/java/me/didit/types/TransactionsRulesListLibraryParams.java new file mode 100644 index 0000000..c32370c --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsRulesListLibraryParams.java @@ -0,0 +1,179 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code transactions.rules.list_library}. */ +public final class TransactionsRulesListLibraryParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("bundle", "category", "search", "limit", "offset"); + + private TransactionsRulesListLibraryParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsRulesListLibraryParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsRulesListLibraryParams fromJson(JsonNode json) { + return new TransactionsRulesListLibraryParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Filter by bundle, e.g. finance, aml_ctf, crypto_monitoring, travel_rule + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bundle() { + return Json.optional(json, "bundle", Conv.STRING); + } + + /** + * Filter by category + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * Case-insensitive match against title and description + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional search() { + return Json.optional(json, "search", Conv.STRING); + } + + /** + * Page size + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Page offset + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsRulesListLibraryParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsRulesListLibraryParams from) { + super(from); + } + + /** + * Filter by bundle, e.g. finance, aml_ctf, crypto_monitoring, travel_rule + * + * @param bundle the value + * @return this builder + */ + public Builder bundle(String bundle) { + return set("bundle", Conv.STRING, bundle); + } + + /** + * Filter by category + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * Case-insensitive match against title and description + * + * @param search the value + * @return this builder + */ + public Builder search(String search) { + return set("search", Conv.STRING, search); + } + + /** + * Page size + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Page offset + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsRulesListLibraryParams} + */ + public TransactionsRulesListLibraryParams build() { + return new TransactionsRulesListLibraryParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsRulesListLibraryResponse.java b/src/main/java/me/didit/types/TransactionsRulesListLibraryResponse.java new file mode 100644 index 0000000..c420266 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsRulesListLibraryResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class TransactionsRulesListLibraryResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private TransactionsRulesListLibraryResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsRulesListLibraryResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsRulesListLibraryResponse fromJson(JsonNode json) { + return new TransactionsRulesListLibraryResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(TransactionRuleLibraryEntry::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsRulesListLibraryResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsRulesListLibraryResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(TransactionRuleLibraryEntry::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsRulesListLibraryResponse} + */ + public TransactionsRulesListLibraryResponse build() { + return new TransactionsRulesListLibraryResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsRulesListParams.java b/src/main/java/me/didit/types/TransactionsRulesListParams.java new file mode 100644 index 0000000..72275a8 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsRulesListParams.java @@ -0,0 +1,327 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code transactions.rules.list}. */ +public final class TransactionsRulesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("source", "category", "mode", "bundle", "search", "ordering", "limit", "offset"); + + private TransactionsRulesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsRulesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsRulesListParams fromJson(JsonNode json) { + return new TransactionsRulesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * PRESET or CUSTOM + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(TransactionsRulesListParams.Source::of)); + } + + /** + * Filter by rule category + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * ACTIVE, DISABLED or TEST + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TransactionsRulesListParams.Mode::of)); + } + + /** + * Filter presets by bundle + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional bundle() { + return Json.optional(json, "bundle", Conv.STRING); + } + + /** + * Case-insensitive match against title and description + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional search() { + return Json.optional(json, "search", Conv.STRING); + } + + /** + * Comma-separated ordering fields, default source,-run_count + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ordering() { + return Json.optional(json, "ordering", Conv.STRING); + } + + /** + * Page size + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Page offset + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsRulesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsRulesListParams from) { + super(from); + } + + /** + * PRESET or CUSTOM + * + * @param source the value + * @return this builder + */ + public Builder source(TransactionsRulesListParams.Source source) { + return set("source", Conv.enumeration(TransactionsRulesListParams.Source::of), source); + } + + /** + * Filter by rule category + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * ACTIVE, DISABLED or TEST + * + * @param mode the value + * @return this builder + */ + public Builder mode(TransactionsRulesListParams.Mode mode) { + return set("mode", Conv.enumeration(TransactionsRulesListParams.Mode::of), mode); + } + + /** + * Filter presets by bundle + * + * @param bundle the value + * @return this builder + */ + public Builder bundle(String bundle) { + return set("bundle", Conv.STRING, bundle); + } + + /** + * Case-insensitive match against title and description + * + * @param search the value + * @return this builder + */ + public Builder search(String search) { + return set("search", Conv.STRING, search); + } + + /** + * Comma-separated ordering fields, default source,-run_count + * + * @param ordering the value + * @return this builder + */ + public Builder ordering(String ordering) { + return set("ordering", Conv.STRING, ordering); + } + + /** + * Page size + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Page offset + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsRulesListParams} + */ + public TransactionsRulesListParams build() { + return new TransactionsRulesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "PRESET"}. */ + public static final Source PRESET = new Source("PRESET"); + + /** The value {@code "CUSTOM"}. */ + public static final Source CUSTOM = new Source("CUSTOM"); + + private static final List KNOWN_VALUES = List.of(PRESET, CUSTOM); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Mode ACTIVE = new Mode("ACTIVE"); + + /** The value {@code "DISABLED"}. */ + public static final Mode DISABLED = new Mode("DISABLED"); + + /** The value {@code "TEST"}. */ + public static final Mode TEST = new Mode("TEST"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, DISABLED, TEST); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TransactionsRulesListResponse.java b/src/main/java/me/didit/types/TransactionsRulesListResponse.java new file mode 100644 index 0000000..fd8bb62 --- /dev/null +++ b/src/main/java/me/didit/types/TransactionsRulesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class TransactionsRulesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private TransactionsRulesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TransactionsRulesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TransactionsRulesListResponse fromJson(JsonNode json) { + return new TransactionsRulesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(TransactionRuleDetail::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TransactionsRulesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TransactionsRulesListResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(TransactionRuleDetail::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TransactionsRulesListResponse} + */ + public TransactionsRulesListResponse build() { + return new TransactionsRulesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleInboundRequest.java b/src/main/java/me/didit/types/TravelRuleInboundRequest.java new file mode 100644 index 0000000..dd21f0f --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleInboundRequest.java @@ -0,0 +1,370 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TravelRuleInboundRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("chain", "txid", "wallet_address", "amount", "currency", "originator_data", "beneficiary_data", "originating_vasp"); + + private TravelRuleInboundRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleInboundRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleInboundRequest fromJson(JsonNode json) { + return new TravelRuleInboundRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Chain the deposit settled on, e.g. "ethereum". + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String chain() { + return Json.required(json, "chain", Conv.STRING); + } + + /** + * On-chain transaction hash. Deduped together with wallet_address. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String txid() { + return Json.required(json, "txid", Conv.STRING); + } + + /** + * The destination wallet you received the deposit on. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String walletAddress() { + return Json.required(json, "wallet_address", Conv.STRING); + } + + /** + * Deposit amount as a decimal string. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String amount() { + return Json.required(json, "amount", Conv.STRING); + } + + /** + * Deposit asset, e.g. "USDC". + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String currency() { + return Json.required(json, "currency", Conv.STRING); + } + + /** + * IVMS-101 originator payload from the sending VASP, if known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> originatorData() { + return Json.optional(json, "originator_data", Conv.OBJECT); + } + + /** + * IVMS-101 beneficiary payload (your customer). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficiaryData() { + return Json.optional(json, "beneficiary_data", Conv.OBJECT); + } + + /** + * Optional description of the sending VASP. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional originatingVasp() { + return Json.optional(json, "originating_vasp", Conv.model(TravelRuleInboundRequest.OriginatingVasp::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleInboundRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleInboundRequest from) { + super(from); + } + + /** + * Chain the deposit settled on, e.g. "ethereum". + * + * @param chain the value + * @return this builder + */ + public Builder chain(String chain) { + return set("chain", Conv.STRING, chain); + } + + /** + * On-chain transaction hash. Deduped together with wallet_address. + * + * @param txid the value + * @return this builder + */ + public Builder txid(String txid) { + return set("txid", Conv.STRING, txid); + } + + /** + * The destination wallet you received the deposit on. + * + * @param walletAddress the value + * @return this builder + */ + public Builder walletAddress(String walletAddress) { + return set("wallet_address", Conv.STRING, walletAddress); + } + + /** + * Deposit amount as a decimal string. + * + * @param amount the value + * @return this builder + */ + public Builder amount(String amount) { + return set("amount", Conv.STRING, amount); + } + + /** + * Deposit asset, e.g. "USDC". + * + * @param currency the value + * @return this builder + */ + public Builder currency(String currency) { + return set("currency", Conv.STRING, currency); + } + + /** + * IVMS-101 originator payload from the sending VASP, if known. + * + * @param originatorData the value + * @return this builder + */ + public Builder originatorData(Map originatorData) { + return setAny("originator_data", originatorData); + } + + /** + * IVMS-101 beneficiary payload (your customer). + * + * @param beneficiaryData the value + * @return this builder + */ + public Builder beneficiaryData(Map beneficiaryData) { + return setAny("beneficiary_data", beneficiaryData); + } + + /** + * Optional description of the sending VASP. + * + * @param originatingVasp the value + * @return this builder + */ + public Builder originatingVasp(TravelRuleInboundRequest.OriginatingVasp originatingVasp) { + return set("originating_vasp", Conv.model(TravelRuleInboundRequest.OriginatingVasp::fromJson), originatingVasp); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleInboundRequest} + * @throws IllegalStateException when a required field is missing + */ + public TravelRuleInboundRequest build() { + require("chain", false); + require("txid", false); + require("wallet_address", false); + require("amount", false); + require("currency", false); + return new TravelRuleInboundRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** Optional description of the sending VASP. */ + public static final class OriginatingVasp extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "lei", "travel_address"); + + private OriginatingVasp(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code OriginatingVasp} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static OriginatingVasp fromJson(JsonNode json) { + return new OriginatingVasp(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The lei field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lei() { + return Json.optional(json, "lei", Conv.STRING); + } + + /** + * Travel address that lets Didit reach the sender on the TRP rail. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelAddress() { + return Json.optional(json, "travel_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link OriginatingVasp}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(OriginatingVasp from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The lei field. + * + * @param lei the value + * @return this builder + */ + public Builder lei(String lei) { + return set("lei", Conv.STRING, lei); + } + + /** + * Travel address that lets Didit reach the sender on the TRP rail. + * + * @param travelAddress the value + * @return this builder + */ + public Builder travelAddress(String travelAddress) { + return set("travel_address", Conv.STRING, travelAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code OriginatingVasp} + */ + public OriginatingVasp build() { + return new OriginatingVasp(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleInboundResponse.java b/src/main/java/me/didit/types/TravelRuleInboundResponse.java new file mode 100644 index 0000000..238e4b9 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleInboundResponse.java @@ -0,0 +1,158 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TravelRuleInboundResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("transaction_id", "txn_id", "created", "travel_rule"); + + private TravelRuleInboundResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleInboundResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleInboundResponse fromJson(JsonNode json) { + return new TravelRuleInboundResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit transaction UUID for the inbound deposit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionId() { + return Json.optional(json, "transaction_id", Conv.STRING); + } + + /** + * Didit-generated txn_id for the sunrise transaction. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional txnId() { + return Json.optional(json, "txn_id", Conv.STRING); + } + + /** + * true when a new transaction was minted (HTTP 201); false when an existing unclaimed deposit was reused (HTTP 200). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional created() { + return Json.optional(json, "created", Conv.BOOLEAN); + } + + /** + * Full transfer object returned by the ownership-confirmation and finish/cancel endpoints. originator_data/beneficiary_data are omitted while PII is masked (see description). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelRule() { + return Json.optional(json, "travel_rule", Conv.model(TravelRuleTransferDetail::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleInboundResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleInboundResponse from) { + super(from); + } + + /** + * Didit transaction UUID for the inbound deposit. + * + * @param transactionId the value + * @return this builder + */ + public Builder transactionId(String transactionId) { + return set("transaction_id", Conv.STRING, transactionId); + } + + /** + * Didit-generated txn_id for the sunrise transaction. + * + * @param txnId the value + * @return this builder + */ + public Builder txnId(String txnId) { + return set("txn_id", Conv.STRING, txnId); + } + + /** + * true when a new transaction was minted (HTTP 201); false when an existing unclaimed deposit was reused (HTTP 200). + * + * @param created the value + * @return this builder + */ + public Builder created(boolean created) { + return set("created", Conv.BOOLEAN, created); + } + + /** + * Full transfer object returned by the ownership-confirmation and finish/cancel endpoints. originator_data/beneficiary_data are omitted while PII is masked (see description). + * + * @param travelRule the value + * @return this builder + */ + public Builder travelRule(TravelRuleTransferDetail travelRule) { + return set("travel_rule", Conv.model(TravelRuleTransferDetail::fromJson), travelRule); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleInboundResponse} + */ + public TravelRuleInboundResponse build() { + return new TravelRuleInboundResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleListVaspsParams.java b/src/main/java/me/didit/types/TravelRuleListVaspsParams.java new file mode 100644 index 0000000..c00874c --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleListVaspsParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code travel_rule.list_vasps}. */ +public final class TravelRuleListVaspsParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("search", "limit", "offset"); + + private TravelRuleListVaspsParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleListVaspsParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleListVaspsParams fromJson(JsonNode json) { + return new TravelRuleListVaspsParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Case-insensitive substring match on VASP name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional search() { + return Json.optional(json, "search", Conv.STRING); + } + + /** + * The limit field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleListVaspsParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleListVaspsParams from) { + super(from); + } + + /** + * Case-insensitive substring match on VASP name. + * + * @param search the value + * @return this builder + */ + public Builder search(String search) { + return set("search", Conv.STRING, search); + } + + /** + * The limit field. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleListVaspsParams} + */ + public TravelRuleListVaspsParams build() { + return new TravelRuleListVaspsParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleListVaspsResponse.java b/src/main/java/me/didit/types/TravelRuleListVaspsResponse.java new file mode 100644 index 0000000..2c1b6c4 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleListVaspsResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class TravelRuleListVaspsResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private TravelRuleListVaspsResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleListVaspsResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleListVaspsResponse fromJson(JsonNode json) { + return new TravelRuleListVaspsResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(VaspDirectoryEntry::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleListVaspsResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleListVaspsResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(VaspDirectoryEntry::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleListVaspsResponse} + */ + public TravelRuleListVaspsResponse build() { + return new TravelRuleListVaspsResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleOwnershipConfirmRequest.java b/src/main/java/me/didit/types/TravelRuleOwnershipConfirmRequest.java new file mode 100644 index 0000000..3f193f1 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleOwnershipConfirmRequest.java @@ -0,0 +1,99 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TravelRuleOwnershipConfirmRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("confirmed"); + + private TravelRuleOwnershipConfirmRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleOwnershipConfirmRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleOwnershipConfirmRequest fromJson(JsonNode json) { + return new TravelRuleOwnershipConfirmRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The confirmed field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean confirmed() { + return Json.required(json, "confirmed", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleOwnershipConfirmRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleOwnershipConfirmRequest from) { + super(from); + } + + /** + * The confirmed field. + * + * @param confirmed the value + * @return this builder + */ + public Builder confirmed(boolean confirmed) { + return set("confirmed", Conv.BOOLEAN, confirmed); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleOwnershipConfirmRequest} + * @throws IllegalStateException when a required field is missing + */ + public TravelRuleOwnershipConfirmRequest build() { + require("confirmed", false); + return new TravelRuleOwnershipConfirmRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRulePickupInfo.java b/src/main/java/me/didit/types/TravelRulePickupInfo.java new file mode 100644 index 0000000..c874db6 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRulePickupInfo.java @@ -0,0 +1,178 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TravelRulePickupInfo extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("originator_vasp_name", "amount", "currency", "beneficiary_wallet", "status"); + + private TravelRulePickupInfo(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRulePickupInfo} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRulePickupInfo fromJson(JsonNode json) { + return new TravelRulePickupInfo(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The originator_vasp_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional originatorVaspName() { + return Json.optional(json, "originator_vasp_name", Conv.STRING); + } + + /** + * The amount field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amount() { + return Json.optional(json, "amount", Conv.STRING); + } + + /** + * The currency field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional currency() { + return Json.optional(json, "currency", Conv.STRING); + } + + /** + * The beneficiary_wallet field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional beneficiaryWallet() { + return Json.optional(json, "beneficiary_wallet", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRulePickupInfo}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRulePickupInfo from) { + super(from); + } + + /** + * The originator_vasp_name field. + * + * @param originatorVaspName the value + * @return this builder + */ + public Builder originatorVaspName(String originatorVaspName) { + return set("originator_vasp_name", Conv.STRING, originatorVaspName); + } + + /** + * The amount field. + * + * @param amount the value + * @return this builder + */ + public Builder amount(String amount) { + return set("amount", Conv.STRING, amount); + } + + /** + * The currency field. + * + * @param currency the value + * @return this builder + */ + public Builder currency(String currency) { + return set("currency", Conv.STRING, currency); + } + + /** + * The beneficiary_wallet field. + * + * @param beneficiaryWallet the value + * @return this builder + */ + public Builder beneficiaryWallet(String beneficiaryWallet) { + return set("beneficiary_wallet", Conv.STRING, beneficiaryWallet); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRulePickupInfo} + */ + public TravelRulePickupInfo build() { + return new TravelRulePickupInfo(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRulePickupRespondRequest.java b/src/main/java/me/didit/types/TravelRulePickupRespondRequest.java new file mode 100644 index 0000000..af65649 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRulePickupRespondRequest.java @@ -0,0 +1,163 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class TravelRulePickupRespondRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("decision", "beneficiary_name"); + + private TravelRulePickupRespondRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRulePickupRespondRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRulePickupRespondRequest fromJson(JsonNode json) { + return new TravelRulePickupRespondRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The decision field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public TravelRulePickupRespondRequest.Decision decision() { + return Json.required(json, "decision", Conv.enumeration(TravelRulePickupRespondRequest.Decision::of)); + } + + /** + * Required in practice for decision=accept; run through the originator's name_matching_strictness policy. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional beneficiaryName() { + return Json.optional(json, "beneficiary_name", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRulePickupRespondRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRulePickupRespondRequest from) { + super(from); + } + + /** + * The decision field. + * + * @param decision the value + * @return this builder + */ + public Builder decision(TravelRulePickupRespondRequest.Decision decision) { + return set("decision", Conv.enumeration(TravelRulePickupRespondRequest.Decision::of), decision); + } + + /** + * Required in practice for decision=accept; run through the originator's name_matching_strictness policy. + * + * @param beneficiaryName the value + * @return this builder + */ + public Builder beneficiaryName(String beneficiaryName) { + return set("beneficiary_name", Conv.STRING, beneficiaryName); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRulePickupRespondRequest} + * @throws IllegalStateException when a required field is missing + */ + public TravelRulePickupRespondRequest build() { + require("decision", false); + return new TravelRulePickupRespondRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Decision extends StringEnum { + /** The value {@code "accept"}. */ + public static final Decision ACCEPT = new Decision("accept"); + + /** The value {@code "decline"}. */ + public static final Decision DECLINE = new Decision("decline"); + + private static final List KNOWN_VALUES = List.of(ACCEPT, DECLINE); + + private Decision(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Decision of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Decision::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleSettingsDetail.java b/src/main/java/me/didit/types/TravelRuleSettingsDetail.java new file mode 100644 index 0000000..7f19f30 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleSettingsDetail.java @@ -0,0 +1,1662 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +public final class TravelRuleSettingsDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "jurisdiction", "name_matching_strictness", "confirmation_timeout_hours", "timeout_outcome", "threshold_amount", "legal_name", "lei", "compliance_email", "is_discoverable", "inbound_auto_accept", "allow_self_declaration", "allow_screenshot_proof", "auto_wallet_verification", "vasp_attribution_enabled", "travel_address", "disabled_networks", "networks"); + + private TravelRuleSettingsDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleSettingsDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleSettingsDetail fromJson(JsonNode json) { + return new TravelRuleSettingsDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Whether the managed Travel Rule negotiation flow is active for outbound travelRule transactions on this application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * Your VASP's operating jurisdiction code. Default "EU". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * How strictly beneficiary names must match before a transfer can reach COMPLETED. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameMatchingStrictness() { + return Json.optional(json, "name_matching_strictness", Conv.enumeration(TravelRuleSettingsDetail.NameMatchingStrictness::of)); + } + + /** + * Hours an AWAITING_COUNTERPARTY transfer may remain unconfirmed before the periodic sweeper expires it. Default 48. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmationTimeoutHours() { + return Json.optional(json, "confirmation_timeout_hours", Conv.LONG); + } + + /** + * What happens to the underlying transaction when a transfer expires. Default HOLD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeoutOutcome() { + return Json.optional(json, "timeout_outcome", Conv.enumeration(TravelRuleSettingsDetail.TimeoutOutcome::of)); + } + + /** + * Decimal string. Minimum transfer amount that triggers a managed exchange; transfers below it resolve straight to NOT_APPLICABLE. Defaults to "0.00" (EU TFR applies no minimum amount). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional thresholdAmount() { + return Json.optional(json, "threshold_amount", Conv.STRING); + } + + /** + * Your VASP's legal name. Required (non-blank) to set is_enabled to true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalName() { + return Json.optional(json, "legal_name", Conv.STRING); + } + + /** + * Your Legal Entity Identifier, surfaced in the VASP directory. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lei() { + return Json.optional(json, "lei", Conv.STRING); + } + + /** + * Compliance contact email for your VASP profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional complianceEmail() { + return Json.optional(json, "compliance_email", Conv.STRING); + } + + /** + * Whether your VASP profile appears in GET /v3/travel-rule/vasps/ search results and can be reached on the INTERNAL rail. Default true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDiscoverable() { + return Json.optional(json, "is_discoverable", Conv.BOOLEAN); + } + + /** + * When true, inbound transfers whose beneficiary wallet is a verified address-book entry with a matching name are accepted automatically, without a manual review step. Default false. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inboundAutoAccept() { + return Json.optional(json, "inbound_auto_accept", Conv.BOOLEAN); + } + + /** + * When true, the wallet-ownership widget offers self-declaration as a fallback proof method. Default false. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional allowSelfDeclaration() { + return Json.optional(json, "allow_self_declaration", Conv.BOOLEAN); + } + + /** + * When true, the wallet-ownership widget offers screenshot upload as an ownership evidence method. Default true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional allowScreenshotProof() { + return Json.optional(json, "allow_screenshot_proof", Conv.BOOLEAN); + } + + /** + * When true, submitting an outbound Travel Rule transfer that needs end-user proof of wallet control auto-mints a wallet-ownership widget session bound to the transaction and exposes it in the transaction's action_required block. Default true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional autoWalletVerification() { + return Json.optional(json, "auto_wallet_verification", Conv.BOOLEAN); + } + + /** + * When true, an outbound Travel Rule transfer that no rail can route is attributed through blockchain analytics: the destination wallet is resolved to its owning VASP, the entity is recorded on the transfer and in the VASP directory, and the rails are re-run once with the attributed name. Default true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vaspAttributionEnabled() { + return Json.optional(json, "vasp_attribution_enabled", Conv.BOOLEAN); + } + + /** + * Read-only. Your VASP's own travel address - the encoded inbound TRP inquiry endpoint other VASPs use to reach you. Populated once your VASP profile is complete. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelAddress() { + return Json.optional(json, "travel_address", Conv.STRING); + } + + /** + * Networks opted out of platform membership. Does not disable your connected own memberships or provision unavailable networks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> disabledNetworks() { + return Json.optional(json, "disabled_networks", Conv.list(Conv.enumeration(TravelRuleSettingsDetail.DisabledNetworks::of))); + } + + /** + * Effective membership configuration for each network. No network, including GTR, is included by default. This is not a live health or delivery check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional networks() { + return Json.optional(json, "networks", Conv.model(TravelRuleSettingsDetail.Networks::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleSettingsDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleSettingsDetail from) { + super(from); + } + + /** + * Whether the managed Travel Rule negotiation flow is active for outbound travelRule transactions on this application. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * Your VASP's operating jurisdiction code. Default "EU". + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * How strictly beneficiary names must match before a transfer can reach COMPLETED. + * + * @param nameMatchingStrictness the value + * @return this builder + */ + public Builder nameMatchingStrictness(TravelRuleSettingsDetail.NameMatchingStrictness nameMatchingStrictness) { + return set("name_matching_strictness", Conv.enumeration(TravelRuleSettingsDetail.NameMatchingStrictness::of), nameMatchingStrictness); + } + + /** + * Hours an AWAITING_COUNTERPARTY transfer may remain unconfirmed before the periodic sweeper expires it. Default 48. + * + * @param confirmationTimeoutHours the value + * @return this builder + */ + public Builder confirmationTimeoutHours(long confirmationTimeoutHours) { + return set("confirmation_timeout_hours", Conv.LONG, confirmationTimeoutHours); + } + + /** + * What happens to the underlying transaction when a transfer expires. Default HOLD. + * + * @param timeoutOutcome the value + * @return this builder + */ + public Builder timeoutOutcome(TravelRuleSettingsDetail.TimeoutOutcome timeoutOutcome) { + return set("timeout_outcome", Conv.enumeration(TravelRuleSettingsDetail.TimeoutOutcome::of), timeoutOutcome); + } + + /** + * Decimal string. Minimum transfer amount that triggers a managed exchange; transfers below it resolve straight to NOT_APPLICABLE. Defaults to "0.00" (EU TFR applies no minimum amount). + * + * @param thresholdAmount the value + * @return this builder + */ + public Builder thresholdAmount(String thresholdAmount) { + return set("threshold_amount", Conv.STRING, thresholdAmount); + } + + /** + * Your VASP's legal name. Required (non-blank) to set is_enabled to true. + * + * @param legalName the value + * @return this builder + */ + public Builder legalName(String legalName) { + return set("legal_name", Conv.STRING, legalName); + } + + /** + * Your Legal Entity Identifier, surfaced in the VASP directory. + * + * @param lei the value + * @return this builder + */ + public Builder lei(String lei) { + return set("lei", Conv.STRING, lei); + } + + /** + * Compliance contact email for your VASP profile. + * + * @param complianceEmail the value + * @return this builder + */ + public Builder complianceEmail(String complianceEmail) { + return set("compliance_email", Conv.STRING, complianceEmail); + } + + /** + * Whether your VASP profile appears in GET /v3/travel-rule/vasps/ search results and can be reached on the INTERNAL rail. Default true. + * + * @param isDiscoverable the value + * @return this builder + */ + public Builder isDiscoverable(boolean isDiscoverable) { + return set("is_discoverable", Conv.BOOLEAN, isDiscoverable); + } + + /** + * When true, inbound transfers whose beneficiary wallet is a verified address-book entry with a matching name are accepted automatically, without a manual review step. Default false. + * + * @param inboundAutoAccept the value + * @return this builder + */ + public Builder inboundAutoAccept(boolean inboundAutoAccept) { + return set("inbound_auto_accept", Conv.BOOLEAN, inboundAutoAccept); + } + + /** + * When true, the wallet-ownership widget offers self-declaration as a fallback proof method. Default false. + * + * @param allowSelfDeclaration the value + * @return this builder + */ + public Builder allowSelfDeclaration(boolean allowSelfDeclaration) { + return set("allow_self_declaration", Conv.BOOLEAN, allowSelfDeclaration); + } + + /** + * When true, the wallet-ownership widget offers screenshot upload as an ownership evidence method. Default true. + * + * @param allowScreenshotProof the value + * @return this builder + */ + public Builder allowScreenshotProof(boolean allowScreenshotProof) { + return set("allow_screenshot_proof", Conv.BOOLEAN, allowScreenshotProof); + } + + /** + * When true, submitting an outbound Travel Rule transfer that needs end-user proof of wallet control auto-mints a wallet-ownership widget session bound to the transaction and exposes it in the transaction's action_required block. Default true. + * + * @param autoWalletVerification the value + * @return this builder + */ + public Builder autoWalletVerification(boolean autoWalletVerification) { + return set("auto_wallet_verification", Conv.BOOLEAN, autoWalletVerification); + } + + /** + * When true, an outbound Travel Rule transfer that no rail can route is attributed through blockchain analytics: the destination wallet is resolved to its owning VASP, the entity is recorded on the transfer and in the VASP directory, and the rails are re-run once with the attributed name. Default true. + * + * @param vaspAttributionEnabled the value + * @return this builder + */ + public Builder vaspAttributionEnabled(boolean vaspAttributionEnabled) { + return set("vasp_attribution_enabled", Conv.BOOLEAN, vaspAttributionEnabled); + } + + /** + * Read-only. Your VASP's own travel address - the encoded inbound TRP inquiry endpoint other VASPs use to reach you. Populated once your VASP profile is complete. + * + * @param travelAddress the value + * @return this builder + */ + public Builder travelAddress(String travelAddress) { + return set("travel_address", Conv.STRING, travelAddress); + } + + /** + * Networks opted out of platform membership. Does not disable your connected own memberships or provision unavailable networks. + * + * @param disabledNetworks the value + * @return this builder + */ + public Builder disabledNetworks(List disabledNetworks) { + return set("disabled_networks", Conv.list(Conv.enumeration(TravelRuleSettingsDetail.DisabledNetworks::of)), disabledNetworks); + } + + /** + * Effective membership configuration for each network. No network, including GTR, is included by default. This is not a live health or delivery check. + * + * @param networks the value + * @return this builder + */ + public Builder networks(TravelRuleSettingsDetail.Networks networks) { + return set("networks", Conv.model(TravelRuleSettingsDetail.Networks::fromJson), networks); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleSettingsDetail} + */ + public TravelRuleSettingsDetail build() { + return new TravelRuleSettingsDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * How strictly beneficiary names must match before a transfer can reach COMPLETED. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NameMatchingStrictness extends StringEnum { + /** The value {@code "NONE"}. */ + public static final NameMatchingStrictness NONE = new NameMatchingStrictness("NONE"); + + /** The value {@code "STRICT"}. */ + public static final NameMatchingStrictness STRICT = new NameMatchingStrictness("STRICT"); + + /** The value {@code "DEFAULT"}. */ + public static final NameMatchingStrictness DEFAULT = new NameMatchingStrictness("DEFAULT"); + + /** The value {@code "FUZZY"}. */ + public static final NameMatchingStrictness FUZZY = new NameMatchingStrictness("FUZZY"); + + private static final List KNOWN_VALUES = List.of(NONE, STRICT, DEFAULT, FUZZY); + + private NameMatchingStrictness(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NameMatchingStrictness of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NameMatchingStrictness::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * What happens to the underlying transaction when a transfer expires. Default HOLD. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TimeoutOutcome extends StringEnum { + /** The value {@code "HOLD"}. */ + public static final TimeoutOutcome HOLD = new TimeoutOutcome("HOLD"); + + /** The value {@code "REJECT"}. */ + public static final TimeoutOutcome REJECT = new TimeoutOutcome("REJECT"); + + /** The value {@code "PROCEED"}. */ + public static final TimeoutOutcome PROCEED = new TimeoutOutcome("PROCEED"); + + private static final List KNOWN_VALUES = List.of(HOLD, REJECT, PROCEED); + + private TimeoutOutcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TimeoutOutcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TimeoutOutcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DisabledNetworks extends StringEnum { + /** The value {@code "GTR"}. */ + public static final DisabledNetworks GTR = new DisabledNetworks("GTR"); + + /** The value {@code "TRUST"}. */ + public static final DisabledNetworks TRUST = new DisabledNetworks("TRUST"); + + /** The value {@code "VERIFYVASP"}. */ + public static final DisabledNetworks VERIFYVASP = new DisabledNetworks("VERIFYVASP"); + + /** The value {@code "SYGNA"}. */ + public static final DisabledNetworks SYGNA = new DisabledNetworks("SYGNA"); + + private static final List KNOWN_VALUES = List.of(GTR, TRUST, VERIFYVASP, SYGNA); + + private DisabledNetworks(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DisabledNetworks of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DisabledNetworks::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Effective membership configuration for each network. No network, including GTR, is included by default. This is not a live health or delivery check. + */ + public static final class Networks extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("gtr", "trust", "verifyvasp", "sygna"); + + private Networks(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Networks} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Networks fromJson(JsonNode json) { + return new Networks(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The gtr field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional gtr() { + return Json.optional(json, "gtr", Conv.model(TravelRuleSettingsDetail.Networks.Gtr::fromJson)); + } + + /** + * The trust field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional trust() { + return Json.optional(json, "trust", Conv.model(TravelRuleSettingsDetail.Networks.Trust::fromJson)); + } + + /** + * The verifyvasp field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional verifyvasp() { + return Json.optional(json, "verifyvasp", Conv.model(TravelRuleSettingsDetail.Networks.Verifyvasp::fromJson)); + } + + /** + * The sygna field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sygna() { + return Json.optional(json, "sygna", Conv.model(TravelRuleSettingsDetail.Networks.Sygna::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Networks}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Networks from) { + super(from); + } + + /** + * The gtr field. + * + * @param gtr the value + * @return this builder + */ + public Builder gtr(TravelRuleSettingsDetail.Networks.Gtr gtr) { + return set("gtr", Conv.model(TravelRuleSettingsDetail.Networks.Gtr::fromJson), gtr); + } + + /** + * The trust field. + * + * @param trust the value + * @return this builder + */ + public Builder trust(TravelRuleSettingsDetail.Networks.Trust trust) { + return set("trust", Conv.model(TravelRuleSettingsDetail.Networks.Trust::fromJson), trust); + } + + /** + * The verifyvasp field. + * + * @param verifyvasp the value + * @return this builder + */ + public Builder verifyvasp(TravelRuleSettingsDetail.Networks.Verifyvasp verifyvasp) { + return set("verifyvasp", Conv.model(TravelRuleSettingsDetail.Networks.Verifyvasp::fromJson), verifyvasp); + } + + /** + * The sygna field. + * + * @param sygna the value + * @return this builder + */ + public Builder sygna(TravelRuleSettingsDetail.Networks.Sygna sygna) { + return set("sygna", Conv.model(TravelRuleSettingsDetail.Networks.Sygna::fromJson), sygna); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Networks} + */ + public Networks build() { + return new Networks(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Gtr extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("rail", "mode", "platform_available", "connected"); + + private Gtr(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Gtr} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Gtr fromJson(JsonNode json) { + return new Gtr(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The rail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rail() { + return Json.optional(json, "rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Gtr.Rail::of)); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Gtr.Mode::of)); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platformAvailable() { + return Json.optional(json, "platform_available", Conv.BOOLEAN); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional connected() { + return Json.optional(json, "connected", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Gtr}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Gtr from) { + super(from); + } + + /** + * The rail field. + * + * @param rail the value + * @return this builder + */ + public Builder rail(TravelRuleSettingsDetail.Networks.Gtr.Rail rail) { + return set("rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Gtr.Rail::of), rail); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TravelRuleSettingsDetail.Networks.Gtr.Mode mode) { + return set("mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Gtr.Mode::of), mode); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @param platformAvailable the value + * @return this builder + */ + public Builder platformAvailable(boolean platformAvailable) { + return set("platform_available", Conv.BOOLEAN, platformAvailable); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @param connected the value + * @return this builder + */ + public Builder connected(boolean connected) { + return set("connected", Conv.BOOLEAN, connected); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Gtr} + */ + public Gtr build() { + return new Gtr(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Rail extends StringEnum { + /** The value {@code "GTR"}. */ + public static final Rail GTR = new Rail("GTR"); + + private static final List KNOWN_VALUES = List.of(GTR); + + private Rail(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Rail of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Rail::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "own"}. */ + public static final Mode OWN = new Mode("own"); + + /** The value {@code "didit"}. */ + public static final Mode DIDIT = new Mode("didit"); + + /** The value {@code "off"}. */ + public static final Mode OFF = new Mode("off"); + + /** The value {@code "unavailable"}. */ + public static final Mode UNAVAILABLE = new Mode("unavailable"); + + private static final List KNOWN_VALUES = List.of(OWN, DIDIT, OFF, UNAVAILABLE); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Trust extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("rail", "mode", "platform_available", "connected"); + + private Trust(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Trust} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Trust fromJson(JsonNode json) { + return new Trust(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The rail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rail() { + return Json.optional(json, "rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Trust.Rail::of)); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Trust.Mode::of)); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platformAvailable() { + return Json.optional(json, "platform_available", Conv.BOOLEAN); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional connected() { + return Json.optional(json, "connected", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Trust}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Trust from) { + super(from); + } + + /** + * The rail field. + * + * @param rail the value + * @return this builder + */ + public Builder rail(TravelRuleSettingsDetail.Networks.Trust.Rail rail) { + return set("rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Trust.Rail::of), rail); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TravelRuleSettingsDetail.Networks.Trust.Mode mode) { + return set("mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Trust.Mode::of), mode); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @param platformAvailable the value + * @return this builder + */ + public Builder platformAvailable(boolean platformAvailable) { + return set("platform_available", Conv.BOOLEAN, platformAvailable); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @param connected the value + * @return this builder + */ + public Builder connected(boolean connected) { + return set("connected", Conv.BOOLEAN, connected); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Trust} + */ + public Trust build() { + return new Trust(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Rail extends StringEnum { + /** The value {@code "TRUST"}. */ + public static final Rail TRUST = new Rail("TRUST"); + + private static final List KNOWN_VALUES = List.of(TRUST); + + private Rail(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Rail of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Rail::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "own"}. */ + public static final Mode OWN = new Mode("own"); + + /** The value {@code "didit"}. */ + public static final Mode DIDIT = new Mode("didit"); + + /** The value {@code "off"}. */ + public static final Mode OFF = new Mode("off"); + + /** The value {@code "unavailable"}. */ + public static final Mode UNAVAILABLE = new Mode("unavailable"); + + private static final List KNOWN_VALUES = List.of(OWN, DIDIT, OFF, UNAVAILABLE); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Verifyvasp extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("rail", "mode", "platform_available", "connected"); + + private Verifyvasp(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Verifyvasp} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Verifyvasp fromJson(JsonNode json) { + return new Verifyvasp(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The rail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rail() { + return Json.optional(json, "rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Verifyvasp.Rail::of)); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Verifyvasp.Mode::of)); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platformAvailable() { + return Json.optional(json, "platform_available", Conv.BOOLEAN); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional connected() { + return Json.optional(json, "connected", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Verifyvasp}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Verifyvasp from) { + super(from); + } + + /** + * The rail field. + * + * @param rail the value + * @return this builder + */ + public Builder rail(TravelRuleSettingsDetail.Networks.Verifyvasp.Rail rail) { + return set("rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Verifyvasp.Rail::of), rail); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TravelRuleSettingsDetail.Networks.Verifyvasp.Mode mode) { + return set("mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Verifyvasp.Mode::of), mode); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @param platformAvailable the value + * @return this builder + */ + public Builder platformAvailable(boolean platformAvailable) { + return set("platform_available", Conv.BOOLEAN, platformAvailable); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @param connected the value + * @return this builder + */ + public Builder connected(boolean connected) { + return set("connected", Conv.BOOLEAN, connected); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Verifyvasp} + */ + public Verifyvasp build() { + return new Verifyvasp(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Rail extends StringEnum { + /** The value {@code "VERIFYVASP"}. */ + public static final Rail VERIFYVASP = new Rail("VERIFYVASP"); + + private static final List KNOWN_VALUES = List.of(VERIFYVASP); + + private Rail(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Rail of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Rail::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "own"}. */ + public static final Mode OWN = new Mode("own"); + + /** The value {@code "didit"}. */ + public static final Mode DIDIT = new Mode("didit"); + + /** The value {@code "off"}. */ + public static final Mode OFF = new Mode("off"); + + /** The value {@code "unavailable"}. */ + public static final Mode UNAVAILABLE = new Mode("unavailable"); + + private static final List KNOWN_VALUES = List.of(OWN, DIDIT, OFF, UNAVAILABLE); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class Sygna extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("rail", "mode", "platform_available", "connected"); + + private Sygna(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Sygna} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Sygna fromJson(JsonNode json) { + return new Sygna(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The rail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rail() { + return Json.optional(json, "rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Sygna.Rail::of)); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional mode() { + return Json.optional(json, "mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Sygna.Mode::of)); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional platformAvailable() { + return Json.optional(json, "platform_available", Conv.BOOLEAN); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional connected() { + return Json.optional(json, "connected", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Sygna}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Sygna from) { + super(from); + } + + /** + * The rail field. + * + * @param rail the value + * @return this builder + */ + public Builder rail(TravelRuleSettingsDetail.Networks.Sygna.Rail rail) { + return set("rail", Conv.enumeration(TravelRuleSettingsDetail.Networks.Sygna.Rail::of), rail); + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + * @param mode the value + * @return this builder + */ + public Builder mode(TravelRuleSettingsDetail.Networks.Sygna.Mode mode) { + return set("mode", Conv.enumeration(TravelRuleSettingsDetail.Networks.Sygna.Mode::of), mode); + } + + /** + * Whether platform membership is configured; not a live health check. + * + * @param platformAvailable the value + * @return this builder + */ + public Builder platformAvailable(boolean platformAvailable) { + return set("platform_available", Conv.BOOLEAN, platformAvailable); + } + + /** + * Whether a connected customer membership exists. Credentials are validated locally; network validation occurs on a live exchange. + * + * @param connected the value + * @return this builder + */ + public Builder connected(boolean connected) { + return set("connected", Conv.BOOLEAN, connected); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Sygna} + */ + public Sygna build() { + return new Sygna(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Rail extends StringEnum { + /** The value {@code "SYGNA"}. */ + public static final Rail SYGNA = new Rail("SYGNA"); + + private static final List KNOWN_VALUES = List.of(SYGNA); + + private Rail(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Rail of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Rail::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * own: connected customer membership takes precedence; didit: configured platform membership allowed; off: platform routing disabled with no own membership; unavailable: neither membership available. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Mode extends StringEnum { + /** The value {@code "own"}. */ + public static final Mode OWN = new Mode("own"); + + /** The value {@code "didit"}. */ + public static final Mode DIDIT = new Mode("didit"); + + /** The value {@code "off"}. */ + public static final Mode OFF = new Mode("off"); + + /** The value {@code "unavailable"}. */ + public static final Mode UNAVAILABLE = new Mode("unavailable"); + + private static final List KNOWN_VALUES = List.of(OWN, DIDIT, OFF, UNAVAILABLE); + + private Mode(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Mode of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Mode::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleSettingsUpdate.java b/src/main/java/me/didit/types/TravelRuleSettingsUpdate.java new file mode 100644 index 0000000..cdf708d --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleSettingsUpdate.java @@ -0,0 +1,541 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** All fields optional; PUT applies a partial update. */ +public final class TravelRuleSettingsUpdate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "legal_name", "lei", "jurisdiction", "name_matching_strictness", "confirmation_timeout_hours", "timeout_outcome", "compliance_email", "is_discoverable", "threshold_amount", "inbound_auto_accept", "allow_self_declaration", "allow_screenshot_proof", "auto_wallet_verification", "vasp_attribution_enabled", "disabled_networks"); + + private TravelRuleSettingsUpdate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleSettingsUpdate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleSettingsUpdate fromJson(JsonNode json) { + return new TravelRuleSettingsUpdate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The legal_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional legalName() { + return Json.optional(json, "legal_name", Conv.STRING); + } + + /** + * The lei field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lei() { + return Json.optional(json, "lei", Conv.STRING); + } + + /** + * The jurisdiction field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * The name_matching_strictness field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional nameMatchingStrictness() { + return Json.optional(json, "name_matching_strictness", Conv.enumeration(TravelRuleSettingsUpdate.NameMatchingStrictness::of)); + } + + /** + * The confirmation_timeout_hours field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional confirmationTimeoutHours() { + return Json.optional(json, "confirmation_timeout_hours", Conv.LONG); + } + + /** + * The timeout_outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional timeoutOutcome() { + return Json.optional(json, "timeout_outcome", Conv.enumeration(TravelRuleSettingsUpdate.TimeoutOutcome::of)); + } + + /** + * The compliance_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional complianceEmail() { + return Json.optional(json, "compliance_email", Conv.STRING); + } + + /** + * The is_discoverable field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDiscoverable() { + return Json.optional(json, "is_discoverable", Conv.BOOLEAN); + } + + /** + * Decimal string. Minimum transfer amount that triggers a managed exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional thresholdAmount() { + return Json.optional(json, "threshold_amount", Conv.STRING); + } + + /** + * The inbound_auto_accept field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inboundAutoAccept() { + return Json.optional(json, "inbound_auto_accept", Conv.BOOLEAN); + } + + /** + * The allow_self_declaration field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional allowSelfDeclaration() { + return Json.optional(json, "allow_self_declaration", Conv.BOOLEAN); + } + + /** + * When true, the wallet-ownership widget offers screenshot upload as an ownership evidence method. Default true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional allowScreenshotProof() { + return Json.optional(json, "allow_screenshot_proof", Conv.BOOLEAN); + } + + /** + * The auto_wallet_verification field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional autoWalletVerification() { + return Json.optional(json, "auto_wallet_verification", Conv.BOOLEAN); + } + + /** + * The vasp_attribution_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vaspAttributionEnabled() { + return Json.optional(json, "vasp_attribution_enabled", Conv.BOOLEAN); + } + + /** + * Networks opted out of platform membership. Does not disable your connected own memberships or provision unavailable networks. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> disabledNetworks() { + return Json.optional(json, "disabled_networks", Conv.list(Conv.enumeration(TravelRuleSettingsUpdate.DisabledNetworks::of))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleSettingsUpdate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleSettingsUpdate from) { + super(from); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The legal_name field. + * + * @param legalName the value + * @return this builder + */ + public Builder legalName(String legalName) { + return set("legal_name", Conv.STRING, legalName); + } + + /** + * The lei field. + * + * @param lei the value + * @return this builder + */ + public Builder lei(String lei) { + return set("lei", Conv.STRING, lei); + } + + /** + * The jurisdiction field. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * The name_matching_strictness field. + * + * @param nameMatchingStrictness the value + * @return this builder + */ + public Builder nameMatchingStrictness(TravelRuleSettingsUpdate.NameMatchingStrictness nameMatchingStrictness) { + return set("name_matching_strictness", Conv.enumeration(TravelRuleSettingsUpdate.NameMatchingStrictness::of), nameMatchingStrictness); + } + + /** + * The confirmation_timeout_hours field. + * + * @param confirmationTimeoutHours the value + * @return this builder + */ + public Builder confirmationTimeoutHours(long confirmationTimeoutHours) { + return set("confirmation_timeout_hours", Conv.LONG, confirmationTimeoutHours); + } + + /** + * The timeout_outcome field. + * + * @param timeoutOutcome the value + * @return this builder + */ + public Builder timeoutOutcome(TravelRuleSettingsUpdate.TimeoutOutcome timeoutOutcome) { + return set("timeout_outcome", Conv.enumeration(TravelRuleSettingsUpdate.TimeoutOutcome::of), timeoutOutcome); + } + + /** + * The compliance_email field. + * + * @param complianceEmail the value + * @return this builder + */ + public Builder complianceEmail(String complianceEmail) { + return set("compliance_email", Conv.STRING, complianceEmail); + } + + /** + * The is_discoverable field. + * + * @param isDiscoverable the value + * @return this builder + */ + public Builder isDiscoverable(boolean isDiscoverable) { + return set("is_discoverable", Conv.BOOLEAN, isDiscoverable); + } + + /** + * Decimal string. Minimum transfer amount that triggers a managed exchange. + * + * @param thresholdAmount the value + * @return this builder + */ + public Builder thresholdAmount(String thresholdAmount) { + return set("threshold_amount", Conv.STRING, thresholdAmount); + } + + /** + * The inbound_auto_accept field. + * + * @param inboundAutoAccept the value + * @return this builder + */ + public Builder inboundAutoAccept(boolean inboundAutoAccept) { + return set("inbound_auto_accept", Conv.BOOLEAN, inboundAutoAccept); + } + + /** + * The allow_self_declaration field. + * + * @param allowSelfDeclaration the value + * @return this builder + */ + public Builder allowSelfDeclaration(boolean allowSelfDeclaration) { + return set("allow_self_declaration", Conv.BOOLEAN, allowSelfDeclaration); + } + + /** + * When true, the wallet-ownership widget offers screenshot upload as an ownership evidence method. Default true. + * + * @param allowScreenshotProof the value + * @return this builder + */ + public Builder allowScreenshotProof(boolean allowScreenshotProof) { + return set("allow_screenshot_proof", Conv.BOOLEAN, allowScreenshotProof); + } + + /** + * The auto_wallet_verification field. + * + * @param autoWalletVerification the value + * @return this builder + */ + public Builder autoWalletVerification(boolean autoWalletVerification) { + return set("auto_wallet_verification", Conv.BOOLEAN, autoWalletVerification); + } + + /** + * The vasp_attribution_enabled field. + * + * @param vaspAttributionEnabled the value + * @return this builder + */ + public Builder vaspAttributionEnabled(boolean vaspAttributionEnabled) { + return set("vasp_attribution_enabled", Conv.BOOLEAN, vaspAttributionEnabled); + } + + /** + * Networks opted out of platform membership. Does not disable your connected own memberships or provision unavailable networks. + * + * @param disabledNetworks the value + * @return this builder + */ + public Builder disabledNetworks(List disabledNetworks) { + return set("disabled_networks", Conv.list(Conv.enumeration(TravelRuleSettingsUpdate.DisabledNetworks::of)), disabledNetworks); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleSettingsUpdate} + */ + public TravelRuleSettingsUpdate build() { + return new TravelRuleSettingsUpdate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NameMatchingStrictness extends StringEnum { + /** The value {@code "NONE"}. */ + public static final NameMatchingStrictness NONE = new NameMatchingStrictness("NONE"); + + /** The value {@code "STRICT"}. */ + public static final NameMatchingStrictness STRICT = new NameMatchingStrictness("STRICT"); + + /** The value {@code "DEFAULT"}. */ + public static final NameMatchingStrictness DEFAULT = new NameMatchingStrictness("DEFAULT"); + + /** The value {@code "FUZZY"}. */ + public static final NameMatchingStrictness FUZZY = new NameMatchingStrictness("FUZZY"); + + private static final List KNOWN_VALUES = List.of(NONE, STRICT, DEFAULT, FUZZY); + + private NameMatchingStrictness(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NameMatchingStrictness of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NameMatchingStrictness::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TimeoutOutcome extends StringEnum { + /** The value {@code "HOLD"}. */ + public static final TimeoutOutcome HOLD = new TimeoutOutcome("HOLD"); + + /** The value {@code "REJECT"}. */ + public static final TimeoutOutcome REJECT = new TimeoutOutcome("REJECT"); + + /** The value {@code "PROCEED"}. */ + public static final TimeoutOutcome PROCEED = new TimeoutOutcome("PROCEED"); + + private static final List KNOWN_VALUES = List.of(HOLD, REJECT, PROCEED); + + private TimeoutOutcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TimeoutOutcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TimeoutOutcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DisabledNetworks extends StringEnum { + /** The value {@code "GTR"}. */ + public static final DisabledNetworks GTR = new DisabledNetworks("GTR"); + + /** The value {@code "TRUST"}. */ + public static final DisabledNetworks TRUST = new DisabledNetworks("TRUST"); + + /** The value {@code "VERIFYVASP"}. */ + public static final DisabledNetworks VERIFYVASP = new DisabledNetworks("VERIFYVASP"); + + /** The value {@code "SYGNA"}. */ + public static final DisabledNetworks SYGNA = new DisabledNetworks("SYGNA"); + + private static final List KNOWN_VALUES = List.of(GTR, TRUST, VERIFYVASP, SYGNA); + + private DisabledNetworks(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DisabledNetworks of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DisabledNetworks::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleTransferDetail.java b/src/main/java/me/didit/types/TravelRuleTransferDetail.java new file mode 100644 index 0000000..1235e6b --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleTransferDetail.java @@ -0,0 +1,779 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Full transfer object returned by the ownership-confirmation and finish/cancel endpoints. originator_data/beneficiary_data are omitted while PII is masked (see description). + */ +public final class TravelRuleTransferDetail extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "status", "direction", "rail", "protocol", "ivms_version", "required", "ownership_confirmed", "deadline_at", "timeline", "counterparty_vasp", "originator_data", "beneficiary_data", "created_at"); + + private TravelRuleTransferDetail(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleTransferDetail} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleTransferDetail fromJson(JsonNode json) { + return new TravelRuleTransferDetail(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(TravelRuleTransferDetail.Status::of)); + } + + /** + * The direction field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional direction() { + return Json.optional(json, "direction", Conv.enumeration(TravelRuleTransferDetail.Direction::of)); + } + + /** + * The rail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rail() { + return Json.optional(json, "rail", Conv.enumeration(TravelRuleTransferDetail.Rail::of)); + } + + /** + * The protocol field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional protocol() { + return Json.optional(json, "protocol", Conv.STRING); + } + + /** + * The ivms_version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ivmsVersion() { + return Json.optional(json, "ivms_version", Conv.STRING); + } + + /** + * The required field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional required() { + return Json.optional(json, "required", Conv.BOOLEAN); + } + + /** + * The ownership_confirmed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ownershipConfirmed() { + return Json.optional(json, "ownership_confirmed", Conv.BOOLEAN); + } + + /** + * The deadline_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deadlineAt() { + return Json.optional(json, "deadline_at", Conv.DATE_TIME); + } + + /** + * The timeline field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> timeline() { + return Json.optional(json, "timeline", Conv.list(Conv.model(TravelRuleTransferDetail.Timeline::fromJson))); + } + + /** + * The counterparty_vasp field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional counterpartyVasp() { + return Json.optional(json, "counterparty_vasp", Conv.model(TravelRuleTransferDetail.CounterpartyVasp::fromJson)); + } + + /** + * The originator_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> originatorData() { + return Json.optional(json, "originator_data", Conv.OBJECT); + } + + /** + * The beneficiary_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> beneficiaryData() { + return Json.optional(json, "beneficiary_data", Conv.OBJECT); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleTransferDetail}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleTransferDetail from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(TravelRuleTransferDetail.Status status) { + return set("status", Conv.enumeration(TravelRuleTransferDetail.Status::of), status); + } + + /** + * The direction field. + * + * @param direction the value + * @return this builder + */ + public Builder direction(TravelRuleTransferDetail.Direction direction) { + return set("direction", Conv.enumeration(TravelRuleTransferDetail.Direction::of), direction); + } + + /** + * The rail field. + * + * @param rail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rail(TravelRuleTransferDetail.@Nullable Rail rail) { + return setNullable("rail", Conv.enumeration(TravelRuleTransferDetail.Rail::of), rail); + } + + /** + * The protocol field. + * + * @param protocol the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder protocol(@Nullable String protocol) { + return setNullable("protocol", Conv.STRING, protocol); + } + + /** + * The ivms_version field. + * + * @param ivmsVersion the value + * @return this builder + */ + public Builder ivmsVersion(String ivmsVersion) { + return set("ivms_version", Conv.STRING, ivmsVersion); + } + + /** + * The required field. + * + * @param required the value + * @return this builder + */ + public Builder required(boolean required) { + return set("required", Conv.BOOLEAN, required); + } + + /** + * The ownership_confirmed field. + * + * @param ownershipConfirmed the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ownershipConfirmed(@Nullable Boolean ownershipConfirmed) { + return setNullable("ownership_confirmed", Conv.BOOLEAN, ownershipConfirmed); + } + + /** + * The deadline_at field. + * + * @param deadlineAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder deadlineAt(@Nullable OffsetDateTime deadlineAt) { + return setNullable("deadline_at", Conv.DATE_TIME, deadlineAt); + } + + /** + * The timeline field. + * + * @param timeline the value + * @return this builder + */ + public Builder timeline(List timeline) { + return set("timeline", Conv.list(Conv.model(TravelRuleTransferDetail.Timeline::fromJson)), timeline); + } + + /** + * The counterparty_vasp field. + * + * @param counterpartyVasp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder counterpartyVasp(TravelRuleTransferDetail.@Nullable CounterpartyVasp counterpartyVasp) { + return setNullable("counterparty_vasp", Conv.model(TravelRuleTransferDetail.CounterpartyVasp::fromJson), counterpartyVasp); + } + + /** + * The originator_data field. + * + * @param originatorData the value + * @return this builder + */ + public Builder originatorData(Map originatorData) { + return setAny("originator_data", originatorData); + } + + /** + * The beneficiary_data field. + * + * @param beneficiaryData the value + * @return this builder + */ + public Builder beneficiaryData(Map beneficiaryData) { + return setAny("beneficiary_data", beneficiaryData); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleTransferDetail} + */ + public TravelRuleTransferDetail build() { + return new TravelRuleTransferDetail(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "AWAITING_COUNTERPARTY"}. */ + public static final Status AWAITING_COUNTERPARTY = new Status("AWAITING_COUNTERPARTY"); + + /** The value {@code "ON_HOLD"}. */ + public static final Status ON_HOLD = new Status("ON_HOLD"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FINISHED"}. */ + public static final Status FINISHED = new Status("FINISHED"); + + /** The value {@code "CANCELLED"}. */ + public static final Status CANCELLED = new Status("CANCELLED"); + + /** The value {@code "EXPIRED"}. */ + public static final Status EXPIRED = new Status("EXPIRED"); + + /** The value {@code "COUNTERPARTY_MISMATCHED_DATA"}. */ + public static final Status COUNTERPARTY_MISMATCHED_DATA = new Status("COUNTERPARTY_MISMATCHED_DATA"); + + /** The value {@code "COUNTERPARTY_VASP_NOT_FOUND"}. */ + public static final Status COUNTERPARTY_VASP_NOT_FOUND = new Status("COUNTERPARTY_VASP_NOT_FOUND"); + + /** The value {@code "COUNTERPARTY_VASP_NOT_REACHABLE"}. */ + public static final Status COUNTERPARTY_VASP_NOT_REACHABLE = new Status("COUNTERPARTY_VASP_NOT_REACHABLE"); + + /** The value {@code "UNCONFIRMED_OWNERSHIP"}. */ + public static final Status UNCONFIRMED_OWNERSHIP = new Status("UNCONFIRMED_OWNERSHIP"); + + /** The value {@code "COUNTERPARTY_VASP_GENERAL_DECLINE"}. */ + public static final Status COUNTERPARTY_VASP_GENERAL_DECLINE = new Status("COUNTERPARTY_VASP_GENERAL_DECLINE"); + + /** The value {@code "NOT_ENOUGH_COUNTERPARTY_DATA"}. */ + public static final Status NOT_ENOUGH_COUNTERPARTY_DATA = new Status("NOT_ENOUGH_COUNTERPARTY_DATA"); + + /** The value {@code "NOT_APPLICABLE"}. */ + public static final Status NOT_APPLICABLE = new Status("NOT_APPLICABLE"); + + private static final List KNOWN_VALUES = List.of(AWAITING_COUNTERPARTY, ON_HOLD, COMPLETED, FINISHED, CANCELLED, EXPIRED, COUNTERPARTY_MISMATCHED_DATA, COUNTERPARTY_VASP_NOT_FOUND, COUNTERPARTY_VASP_NOT_REACHABLE, UNCONFIRMED_OWNERSHIP, COUNTERPARTY_VASP_GENERAL_DECLINE, NOT_ENOUGH_COUNTERPARTY_DATA, NOT_APPLICABLE); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Direction extends StringEnum { + /** The value {@code "INBOUND"}. */ + public static final Direction INBOUND = new Direction("INBOUND"); + + /** The value {@code "OUTBOUND"}. */ + public static final Direction OUTBOUND = new Direction("OUTBOUND"); + + private static final List KNOWN_VALUES = List.of(INBOUND, OUTBOUND); + + private Direction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Direction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Direction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Rail extends StringEnum { + /** The value {@code "INTERNAL"}. */ + public static final Rail INTERNAL = new Rail("INTERNAL"); + + /** The value {@code "TRP"}. */ + public static final Rail TRP = new Rail("TRP"); + + /** The value {@code "GTR"}. */ + public static final Rail GTR = new Rail("GTR"); + + /** The value {@code "EMAIL"}. */ + public static final Rail EMAIL = new Rail("EMAIL"); + + private static final List KNOWN_VALUES = List.of(INTERNAL, TRP, GTR, EMAIL); + + private Rail(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Rail of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Rail::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Timeline extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status", "at", "detail"); + + private Timeline(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Timeline} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Timeline fromJson(JsonNode json) { + return new Timeline(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + /** + * The at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional at() { + return Json.optional(json, "at", Conv.DATE_TIME); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Timeline}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Timeline from) { + super(from); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * The at field. + * + * @param at the value + * @return this builder + */ + public Builder at(OffsetDateTime at) { + return set("at", Conv.DATE_TIME, at); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Timeline} + */ + public Timeline build() { + return new Timeline(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class CounterpartyVasp extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "lei", "dd_score"); + + private CounterpartyVasp(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CounterpartyVasp} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CounterpartyVasp fromJson(JsonNode json) { + return new CounterpartyVasp(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The lei field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lei() { + return Json.optional(json, "lei", Conv.STRING); + } + + /** + * The dd_score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ddScore() { + return Json.optional(json, "dd_score", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CounterpartyVasp}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CounterpartyVasp from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The lei field. + * + * @param lei the value + * @return this builder + */ + public Builder lei(String lei) { + return set("lei", Conv.STRING, lei); + } + + /** + * The dd_score field. + * + * @param ddScore the value + * @return this builder + */ + public Builder ddScore(long ddScore) { + return set("dd_score", Conv.LONG, ddScore); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CounterpartyVasp} + */ + public CounterpartyVasp build() { + return new CounterpartyVasp(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleTransferPatchRequest.java b/src/main/java/me/didit/types/TravelRuleTransferPatchRequest.java new file mode 100644 index 0000000..3817bc2 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleTransferPatchRequest.java @@ -0,0 +1,163 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Provide exactly one of: payment_txn_id (finish), action=cancel, or action=resend. */ +public final class TravelRuleTransferPatchRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("payment_txn_id", "action"); + + private TravelRuleTransferPatchRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleTransferPatchRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleTransferPatchRequest fromJson(JsonNode json) { + return new TravelRuleTransferPatchRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The on-chain transaction hash. Requires the transfer to be an outbound transfer in COMPLETED status. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional paymentTxnId() { + return Json.optional(json, "payment_txn_id", Conv.STRING); + } + + /** + * "cancel" cancels a non-terminal transfer. "resend" re-runs routing for an outbound transfer stuck in COUNTERPARTY_VASP_NOT_FOUND, COUNTERPARTY_VASP_NOT_REACHABLE, or NOT_ENOUGH_COUNTERPARTY_DATA. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional action() { + return Json.optional(json, "action", Conv.enumeration(TravelRuleTransferPatchRequest.Action::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleTransferPatchRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleTransferPatchRequest from) { + super(from); + } + + /** + * The on-chain transaction hash. Requires the transfer to be an outbound transfer in COMPLETED status. + * + * @param paymentTxnId the value + * @return this builder + */ + public Builder paymentTxnId(String paymentTxnId) { + return set("payment_txn_id", Conv.STRING, paymentTxnId); + } + + /** + * "cancel" cancels a non-terminal transfer. "resend" re-runs routing for an outbound transfer stuck in COUNTERPARTY_VASP_NOT_FOUND, COUNTERPARTY_VASP_NOT_REACHABLE, or NOT_ENOUGH_COUNTERPARTY_DATA. + * + * @param action the value + * @return this builder + */ + public Builder action(TravelRuleTransferPatchRequest.Action action) { + return set("action", Conv.enumeration(TravelRuleTransferPatchRequest.Action::of), action); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleTransferPatchRequest} + */ + public TravelRuleTransferPatchRequest build() { + return new TravelRuleTransferPatchRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * "cancel" cancels a non-terminal transfer. "resend" re-runs routing for an outbound transfer stuck in COUNTERPARTY_VASP_NOT_FOUND, COUNTERPARTY_VASP_NOT_REACHABLE, or NOT_ENOUGH_COUNTERPARTY_DATA. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Action extends StringEnum { + /** The value {@code "cancel"}. */ + public static final Action CANCEL = new Action("cancel"); + + /** The value {@code "resend"}. */ + public static final Action RESEND = new Action("resend"); + + private static final List KNOWN_VALUES = List.of(CANCEL, RESEND); + + private Action(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Action of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Action::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleWalletAddressesListParams.java b/src/main/java/me/didit/types/TravelRuleWalletAddressesListParams.java new file mode 100644 index 0000000..52e9eae --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleWalletAddressesListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code travel_rule.wallet_addresses.list}. */ +public final class TravelRuleWalletAddressesListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private TravelRuleWalletAddressesListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleWalletAddressesListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleWalletAddressesListParams fromJson(JsonNode json) { + return new TravelRuleWalletAddressesListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The limit field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * The offset field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleWalletAddressesListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleWalletAddressesListParams from) { + super(from); + } + + /** + * The limit field. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * The offset field. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleWalletAddressesListParams} + */ + public TravelRuleWalletAddressesListParams build() { + return new TravelRuleWalletAddressesListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleWalletAddressesListResponse.java b/src/main/java/me/didit/types/TravelRuleWalletAddressesListResponse.java new file mode 100644 index 0000000..3aac09e --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleWalletAddressesListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class TravelRuleWalletAddressesListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private TravelRuleWalletAddressesListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleWalletAddressesListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleWalletAddressesListResponse fromJson(JsonNode json) { + return new TravelRuleWalletAddressesListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The count field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * The next field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * The previous field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(WalletAddressEntry::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleWalletAddressesListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleWalletAddressesListResponse from) { + super(from); + } + + /** + * The count field. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * The next field. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * The previous field. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(WalletAddressEntry::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleWalletAddressesListResponse} + */ + public TravelRuleWalletAddressesListResponse build() { + return new TravelRuleWalletAddressesListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleWidgetContext.java b/src/main/java/me/didit/types/TravelRuleWidgetContext.java new file mode 100644 index 0000000..2958c1f --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleWidgetContext.java @@ -0,0 +1,349 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class TravelRuleWidgetContext extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vasp_name", "wallet_address", "chain", "holder_name", "allowed_methods", "transfer_status", "callback_url", "expires_at", "completed_at", "proofs", "customization"); + + private TravelRuleWidgetContext(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleWidgetContext} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleWidgetContext fromJson(JsonNode json) { + return new TravelRuleWidgetContext(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Legal name from your VASP profile, shown to the customer in the widget. Empty when no profile exists. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vaspName() { + return Json.optional(json, "vasp_name", Conv.STRING); + } + + /** + * The wallet_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional walletAddress() { + return Json.optional(json, "wallet_address", Conv.STRING); + } + + /** + * The chain field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional chain() { + return Json.optional(json, "chain", Conv.STRING); + } + + /** + * The holder_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderName() { + return Json.optional(json, "holder_name", Conv.STRING); + } + + /** + * Proof methods available for this session. MESSAGE_SIGNING requires a supported chain family, SATOSHI_TEST requires a satoshi_deposit_address on the session, SCREENSHOT requires the allow_screenshot_proof setting, and SELF_DECLARATION requires the allow_self_declaration setting. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> allowedMethods() { + return Json.optional(json, "allowed_methods", Conv.list(Conv.enumeration(TravelRuleWidgetContext.AllowedMethods::of))); + } + + /** + * Status of the linked Travel Rule transfer. Null when the session was minted without a transaction_id. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transferStatus() { + return Json.optional(json, "transfer_status", Conv.STRING); + } + + /** + * Where the widget returns the customer after completion. Empty when not set. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callbackUrl() { + return Json.optional(json, "callback_url", Conv.STRING); + } + + /** + * The expires_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + /** + * Non-null once a proof has been verified. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * The proofs field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> proofs() { + return Json.optional(json, "proofs", Conv.list(Conv.model(TravelRuleWidgetProofSummary::fromJson))); + } + + /** + * The application's whitelabel customization (colors, logo, font family) when white label is enabled - the widget renders with the same branding as the verification flow. Null otherwise. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> customization() { + return Json.optional(json, "customization", Conv.OBJECT); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleWidgetContext}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleWidgetContext from) { + super(from); + } + + /** + * Legal name from your VASP profile, shown to the customer in the widget. Empty when no profile exists. + * + * @param vaspName the value + * @return this builder + */ + public Builder vaspName(String vaspName) { + return set("vasp_name", Conv.STRING, vaspName); + } + + /** + * The wallet_address field. + * + * @param walletAddress the value + * @return this builder + */ + public Builder walletAddress(String walletAddress) { + return set("wallet_address", Conv.STRING, walletAddress); + } + + /** + * The chain field. + * + * @param chain the value + * @return this builder + */ + public Builder chain(String chain) { + return set("chain", Conv.STRING, chain); + } + + /** + * The holder_name field. + * + * @param holderName the value + * @return this builder + */ + public Builder holderName(String holderName) { + return set("holder_name", Conv.STRING, holderName); + } + + /** + * Proof methods available for this session. MESSAGE_SIGNING requires a supported chain family, SATOSHI_TEST requires a satoshi_deposit_address on the session, SCREENSHOT requires the allow_screenshot_proof setting, and SELF_DECLARATION requires the allow_self_declaration setting. + * + * @param allowedMethods the value + * @return this builder + */ + public Builder allowedMethods(List allowedMethods) { + return set("allowed_methods", Conv.list(Conv.enumeration(TravelRuleWidgetContext.AllowedMethods::of)), allowedMethods); + } + + /** + * Status of the linked Travel Rule transfer. Null when the session was minted without a transaction_id. + * + * @param transferStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder transferStatus(@Nullable String transferStatus) { + return setNullable("transfer_status", Conv.STRING, transferStatus); + } + + /** + * Where the widget returns the customer after completion. Empty when not set. + * + * @param callbackUrl the value + * @return this builder + */ + public Builder callbackUrl(String callbackUrl) { + return set("callback_url", Conv.STRING, callbackUrl); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Non-null once a proof has been verified. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * The proofs field. + * + * @param proofs the value + * @return this builder + */ + public Builder proofs(List proofs) { + return set("proofs", Conv.list(Conv.model(TravelRuleWidgetProofSummary::fromJson)), proofs); + } + + /** + * The application's whitelabel customization (colors, logo, font family) when white label is enabled - the widget renders with the same branding as the verification flow. Null otherwise. + * + * @param customization the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder customization(@Nullable Map customization) { + return setAny("customization", customization); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleWidgetContext} + */ + public TravelRuleWidgetContext build() { + return new TravelRuleWidgetContext(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class AllowedMethods extends StringEnum { + /** The value {@code "MESSAGE_SIGNING"}. */ + public static final AllowedMethods MESSAGE_SIGNING = new AllowedMethods("MESSAGE_SIGNING"); + + /** The value {@code "SCREENSHOT"}. */ + public static final AllowedMethods SCREENSHOT = new AllowedMethods("SCREENSHOT"); + + /** The value {@code "SATOSHI_TEST"}. */ + public static final AllowedMethods SATOSHI_TEST = new AllowedMethods("SATOSHI_TEST"); + + /** The value {@code "SELF_DECLARATION"}. */ + public static final AllowedMethods SELF_DECLARATION = new AllowedMethods("SELF_DECLARATION"); + + private static final List KNOWN_VALUES = List.of(MESSAGE_SIGNING, SCREENSHOT, SATOSHI_TEST, SELF_DECLARATION); + + private AllowedMethods(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static AllowedMethods of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, AllowedMethods::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleWidgetProofSummary.java b/src/main/java/me/didit/types/TravelRuleWidgetProofSummary.java new file mode 100644 index 0000000..b9cbbf4 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleWidgetProofSummary.java @@ -0,0 +1,378 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class TravelRuleWidgetProofSummary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("proof_id", "method", "status", "wallet_address", "chain", "deposit_address", "expected_amount", "expires_at", "challenge", "created_at"); + + private TravelRuleWidgetProofSummary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleWidgetProofSummary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleWidgetProofSummary fromJson(JsonNode json) { + return new TravelRuleWidgetProofSummary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The proof_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional proofId() { + return Json.optional(json, "proof_id", Conv.STRING); + } + + /** + * The method field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional method() { + return Json.optional(json, "method", Conv.enumeration(TravelRuleWidgetProofSummary.Method::of)); + } + + /** + * PENDING on a SATOSHI_TEST proof means the deposit has been seen on-chain but has not yet reached enough confirmations; a background job automatically rechecks it and moves it to VERIFIED once it confirms, with no resubmission needed. REJECTED means a genuinely wrong deposit was submitted (absent, wrong sender, or wrong amount). EXPIRED means the proof's own test window closed before a valid deposit was seen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(TravelRuleWidgetProofSummary.Status::of)); + } + + /** + * The wallet_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional walletAddress() { + return Json.optional(json, "wallet_address", Conv.STRING); + } + + /** + * The chain field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional chain() { + return Json.optional(json, "chain", Conv.STRING); + } + + /** + * Deposit address the customer must send the Satoshi test amount to. Present only on a SATOSHI_TEST proof. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional depositAddress() { + return Json.optional(json, "deposit_address", Conv.STRING); + } + + /** + * Exact on-chain amount, in the deposit's native currency, the Satoshi test deposit must match. Present only on a SATOSHI_TEST proof. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expectedAmount() { + return Json.optional(json, "expected_amount", Conv.STRING); + } + + /** + * Deadline for this proof's own Satoshi test window. Present only on a SATOSHI_TEST proof; the widget session's own expires_at is extended to cover it when SATOSHI_TEST is offered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + /** + * Didit-issued message the customer signs with their wallet. Present only on a MESSAGE_SIGNING proof. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional challenge() { + return Json.optional(json, "challenge", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleWidgetProofSummary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleWidgetProofSummary from) { + super(from); + } + + /** + * The proof_id field. + * + * @param proofId the value + * @return this builder + */ + public Builder proofId(String proofId) { + return set("proof_id", Conv.STRING, proofId); + } + + /** + * The method field. + * + * @param method the value + * @return this builder + */ + public Builder method(TravelRuleWidgetProofSummary.Method method) { + return set("method", Conv.enumeration(TravelRuleWidgetProofSummary.Method::of), method); + } + + /** + * PENDING on a SATOSHI_TEST proof means the deposit has been seen on-chain but has not yet reached enough confirmations; a background job automatically rechecks it and moves it to VERIFIED once it confirms, with no resubmission needed. REJECTED means a genuinely wrong deposit was submitted (absent, wrong sender, or wrong amount). EXPIRED means the proof's own test window closed before a valid deposit was seen. + * + * @param status the value + * @return this builder + */ + public Builder status(TravelRuleWidgetProofSummary.Status status) { + return set("status", Conv.enumeration(TravelRuleWidgetProofSummary.Status::of), status); + } + + /** + * The wallet_address field. + * + * @param walletAddress the value + * @return this builder + */ + public Builder walletAddress(String walletAddress) { + return set("wallet_address", Conv.STRING, walletAddress); + } + + /** + * The chain field. + * + * @param chain the value + * @return this builder + */ + public Builder chain(String chain) { + return set("chain", Conv.STRING, chain); + } + + /** + * Deposit address the customer must send the Satoshi test amount to. Present only on a SATOSHI_TEST proof. + * + * @param depositAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder depositAddress(@Nullable String depositAddress) { + return setNullable("deposit_address", Conv.STRING, depositAddress); + } + + /** + * Exact on-chain amount, in the deposit's native currency, the Satoshi test deposit must match. Present only on a SATOSHI_TEST proof. + * + * @param expectedAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expectedAmount(@Nullable String expectedAmount) { + return setNullable("expected_amount", Conv.STRING, expectedAmount); + } + + /** + * Deadline for this proof's own Satoshi test window. Present only on a SATOSHI_TEST proof; the widget session's own expires_at is extended to cover it when SATOSHI_TEST is offered. + * + * @param expiresAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder expiresAt(@Nullable OffsetDateTime expiresAt) { + return setNullable("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Didit-issued message the customer signs with their wallet. Present only on a MESSAGE_SIGNING proof. + * + * @param challenge the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder challenge(@Nullable String challenge) { + return setNullable("challenge", Conv.STRING, challenge); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleWidgetProofSummary} + */ + public TravelRuleWidgetProofSummary build() { + return new TravelRuleWidgetProofSummary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Method extends StringEnum { + /** The value {@code "MESSAGE_SIGNING"}. */ + public static final Method MESSAGE_SIGNING = new Method("MESSAGE_SIGNING"); + + /** The value {@code "SATOSHI_TEST"}. */ + public static final Method SATOSHI_TEST = new Method("SATOSHI_TEST"); + + /** The value {@code "SCREENSHOT"}. */ + public static final Method SCREENSHOT = new Method("SCREENSHOT"); + + /** The value {@code "SELF_DECLARATION"}. */ + public static final Method SELF_DECLARATION = new Method("SELF_DECLARATION"); + + private static final List KNOWN_VALUES = List.of(MESSAGE_SIGNING, SATOSHI_TEST, SCREENSHOT, SELF_DECLARATION); + + private Method(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Method of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Method::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * PENDING on a SATOSHI_TEST proof means the deposit has been seen on-chain but has not yet reached enough confirmations; a background job automatically rechecks it and moves it to VERIFIED once it confirms, with no resubmission needed. REJECTED means a genuinely wrong deposit was submitted (absent, wrong sender, or wrong amount). EXPIRED means the proof's own test window closed before a valid deposit was seen. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "VERIFIED"}. */ + public static final Status VERIFIED = new Status("VERIFIED"); + + /** The value {@code "REJECTED"}. */ + public static final Status REJECTED = new Status("REJECTED"); + + /** The value {@code "EXPIRED"}. */ + public static final Status EXPIRED = new Status("EXPIRED"); + + private static final List KNOWN_VALUES = List.of(PENDING, VERIFIED, REJECTED, EXPIRED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleWidgetSessionCreate.java b/src/main/java/me/didit/types/TravelRuleWidgetSessionCreate.java new file mode 100644 index 0000000..c23c5d5 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleWidgetSessionCreate.java @@ -0,0 +1,241 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TravelRuleWidgetSessionCreate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("wallet_address", "chain", "holder_name", "vendor_data", "transaction_id", "satoshi_deposit_address", "callback_url", "expires_in_minutes"); + + private TravelRuleWidgetSessionCreate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleWidgetSessionCreate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleWidgetSessionCreate fromJson(JsonNode json) { + return new TravelRuleWidgetSessionCreate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The wallet address to verify. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String walletAddress() { + return Json.required(json, "wallet_address", Conv.STRING); + } + + /** + * Chain identifier for the address, e.g. "ethereum", "bitcoin", "solana". + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String chain() { + return Json.required(json, "chain", Conv.STRING); + } + + /** + * Name of the wallet holder, used for the beneficiary name match. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderName() { + return Json.optional(json, "holder_name", Conv.STRING); + } + + /** + * Your internal identifier for the holder, carried onto the created address-book entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Optional. Didit transaction UUID of a Travel Rule transfer to advance when the proof verifies. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionId() { + return Json.optional(json, "transaction_id", Conv.STRING); + } + + /** + * Optional. A deposit address you control; supplying it enables the SATOSHI_TEST proof method. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional satoshiDepositAddress() { + return Json.optional(json, "satoshi_deposit_address", Conv.STRING); + } + + /** + * Optional. Where the widget returns the customer after completion. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional callbackUrl() { + return Json.optional(json, "callback_url", Conv.STRING); + } + + /** + * Optional. Lifetime of the minted link, in minutes. Automatically extended to cover the Satoshi test window when SATOSHI_TEST is offered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresInMinutes() { + return Json.optional(json, "expires_in_minutes", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleWidgetSessionCreate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleWidgetSessionCreate from) { + super(from); + } + + /** + * The wallet address to verify. + * + * @param walletAddress the value + * @return this builder + */ + public Builder walletAddress(String walletAddress) { + return set("wallet_address", Conv.STRING, walletAddress); + } + + /** + * Chain identifier for the address, e.g. "ethereum", "bitcoin", "solana". + * + * @param chain the value + * @return this builder + */ + public Builder chain(String chain) { + return set("chain", Conv.STRING, chain); + } + + /** + * Name of the wallet holder, used for the beneficiary name match. + * + * @param holderName the value + * @return this builder + */ + public Builder holderName(String holderName) { + return set("holder_name", Conv.STRING, holderName); + } + + /** + * Your internal identifier for the holder, carried onto the created address-book entry. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Optional. Didit transaction UUID of a Travel Rule transfer to advance when the proof verifies. + * + * @param transactionId the value + * @return this builder + */ + public Builder transactionId(String transactionId) { + return set("transaction_id", Conv.STRING, transactionId); + } + + /** + * Optional. A deposit address you control; supplying it enables the SATOSHI_TEST proof method. + * + * @param satoshiDepositAddress the value + * @return this builder + */ + public Builder satoshiDepositAddress(String satoshiDepositAddress) { + return set("satoshi_deposit_address", Conv.STRING, satoshiDepositAddress); + } + + /** + * Optional. Where the widget returns the customer after completion. + * + * @param callbackUrl the value + * @return this builder + */ + public Builder callbackUrl(String callbackUrl) { + return set("callback_url", Conv.STRING, callbackUrl); + } + + /** + * Optional. Lifetime of the minted link, in minutes. Automatically extended to cover the Satoshi test window when SATOSHI_TEST is offered. + * + * @param expiresInMinutes the value + * @return this builder + */ + public Builder expiresInMinutes(long expiresInMinutes) { + return set("expires_in_minutes", Conv.LONG, expiresInMinutes); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleWidgetSessionCreate} + * @throws IllegalStateException when a required field is missing + */ + public TravelRuleWidgetSessionCreate build() { + require("wallet_address", false); + require("chain", false); + return new TravelRuleWidgetSessionCreate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/TravelRuleWidgetSessionResponse.java b/src/main/java/me/didit/types/TravelRuleWidgetSessionResponse.java new file mode 100644 index 0000000..76805d9 --- /dev/null +++ b/src/main/java/me/didit/types/TravelRuleWidgetSessionResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class TravelRuleWidgetSessionResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("widget_session_id", "token", "url", "expires_at"); + + private TravelRuleWidgetSessionResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code TravelRuleWidgetSessionResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static TravelRuleWidgetSessionResponse fromJson(JsonNode json) { + return new TravelRuleWidgetSessionResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The widget_session_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional widgetSessionId() { + return Json.optional(json, "widget_session_id", Conv.STRING); + } + + /** + * Opaque session token embedded in the widget URL. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional token() { + return Json.optional(json, "token", Conv.STRING); + } + + /** + * The hosted wallet-ownership widget URL. Open it verbatim in the system browser (never inside a mobile SDK webview). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The expires_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresAt() { + return Json.optional(json, "expires_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link TravelRuleWidgetSessionResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(TravelRuleWidgetSessionResponse from) { + super(from); + } + + /** + * The widget_session_id field. + * + * @param widgetSessionId the value + * @return this builder + */ + public Builder widgetSessionId(String widgetSessionId) { + return set("widget_session_id", Conv.STRING, widgetSessionId); + } + + /** + * Opaque session token embedded in the widget URL. + * + * @param token the value + * @return this builder + */ + public Builder token(String token) { + return set("token", Conv.STRING, token); + } + + /** + * The hosted wallet-ownership widget URL. Open it verbatim in the system browser (never inside a mobile SDK webview). + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The expires_at field. + * + * @param expiresAt the value + * @return this builder + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + return set("expires_at", Conv.DATE_TIME, expiresAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code TravelRuleWidgetSessionResponse} + */ + public TravelRuleWidgetSessionResponse build() { + return new TravelRuleWidgetSessionResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UserDetailItem.java b/src/main/java/me/didit/types/UserDetailItem.java new file mode 100644 index 0000000..29818e1 --- /dev/null +++ b/src/main/java/me/didit/types/UserDetailItem.java @@ -0,0 +1,1464 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Full user detail. Extends UserListItem with metadata, comments, and updated_at. */ +public final class UserDetailItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "display_name", "full_name", "date_of_birth", "effective_name", "status", "portrait_image_url", "session_count", "approved_count", "declined_count", "in_review_count", "issuing_states", "approved_emails", "approved_phones", "features", "features_list", "last_session_at", "first_session_at", "last_activity_at", "created_at", "metadata", "tags", "comments", "updated_at"); + + private UserDetailItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserDetailItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserDetailItem fromJson(JsonNode json) { + return new UserDetailItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's stable internal UUID for this user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your unique identifier for this user (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Custom display name set by you + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Full name extracted from verified documents + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Best available name: display_name if set, otherwise full_name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveName() { + return Json.optional(json, "effective_name", Conv.STRING); + } + + /** + * Lifecycle status of the user record (NOT a session status). ACTIVE is the default, FLAGGED marks the user for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UserListItem.Status::of)); + } + + /** + * Presigned URL of the user's portrait photo (expires after a few hours) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImageUrl() { + return Json.optional(json, "portrait_image_url", Conv.STRING); + } + + /** + * Total number of verification sessions for this user + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionCount() { + return Json.optional(json, "session_count", Conv.LONG); + } + + /** + * Number of approved sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approvedCount() { + return Json.optional(json, "approved_count", Conv.LONG); + } + + /** + * Number of declined sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declinedCount() { + return Json.optional(json, "declined_count", Conv.LONG); + } + + /** + * Number of sessions in review + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inReviewCount() { + return Json.optional(json, "in_review_count", Conv.LONG); + } + + /** + * ISO 3166-1 alpha-3 codes of issuing countries seen on this user's approved ID documents, e.g. ["USA", "ESP"]. Empty array when none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> issuingStates() { + return Json.optional(json, "issuing_states", Conv.list(Conv.STRING)); + } + + /** + * Verified email addresses collected from this user's approved sessions, e.g. ["john@example.com"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedEmails() { + return Json.optional(json, "approved_emails", Conv.list(Conv.STRING)); + } + + /** + * Verified phone numbers collected from this user's approved sessions, e.g. ["+14155551234"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedPhones() { + return Json.optional(json, "approved_phones", Conv.list(Conv.STRING)); + } + + /** + * Aggregated per-feature status across all of this user's sessions. Possible keys: ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, QUESTIONNAIRE, EMAIL_VERIFICATION, PHONE, AML, IP_ANALYSIS, AGE_ESTIMATION, DATABASE_VALIDATION. Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.OBJECT); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> featuresList() { + return Json.optional(json, "features_list", Conv.list(Conv.model(UserListItem.FeaturesList::fromJson))); + } + + /** + * Timestamp of the most recent session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSessionAt() { + return Json.optional(json, "last_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the first session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSessionAt() { + return Json.optional(json, "first_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the most recent activity on this user (session, transaction, status change, data edit, etc.). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastActivityAt() { + return Json.optional(json, "last_activity_at", Conv.DATE_TIME); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * Custom metadata JSON you attached to this user. Defaults to {}. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Tag assignments. NOTE: on detail responses each entry is a tag *link* object ({uuid, tag: {...}, added_by_email, added_by_name, created_at}), unlike the flat {uuid, name, color} shape used on list responses. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(UserDetailItem.Tags::fromJson))); + } + + /** + * Activity log and comments for this user (status changes, profile edits, manual notes). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> comments() { + return Json.optional(json, "comments", Conv.list(Conv.model(UserDetailItem.Comments::fromJson))); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserDetailItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserDetailItem from) { + super(from); + } + + /** + * Didit's stable internal UUID for this user. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your unique identifier for this user (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Custom display name set by you + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Full name extracted from verified documents + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Best available name: display_name if set, otherwise full_name + * + * @param effectiveName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveName(@Nullable String effectiveName) { + return setNullable("effective_name", Conv.STRING, effectiveName); + } + + /** + * Lifecycle status of the user record (NOT a session status). ACTIVE is the default, FLAGGED marks the user for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @param status the value + * @return this builder + */ + public Builder status(UserListItem.Status status) { + return set("status", Conv.enumeration(UserListItem.Status::of), status); + } + + /** + * Presigned URL of the user's portrait photo (expires after a few hours) + * + * @param portraitImageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder portraitImageUrl(@Nullable String portraitImageUrl) { + return setNullable("portrait_image_url", Conv.STRING, portraitImageUrl); + } + + /** + * Total number of verification sessions for this user + * + * @param sessionCount the value + * @return this builder + */ + public Builder sessionCount(long sessionCount) { + return set("session_count", Conv.LONG, sessionCount); + } + + /** + * Number of approved sessions + * + * @param approvedCount the value + * @return this builder + */ + public Builder approvedCount(long approvedCount) { + return set("approved_count", Conv.LONG, approvedCount); + } + + /** + * Number of declined sessions + * + * @param declinedCount the value + * @return this builder + */ + public Builder declinedCount(long declinedCount) { + return set("declined_count", Conv.LONG, declinedCount); + } + + /** + * Number of sessions in review + * + * @param inReviewCount the value + * @return this builder + */ + public Builder inReviewCount(long inReviewCount) { + return set("in_review_count", Conv.LONG, inReviewCount); + } + + /** + * ISO 3166-1 alpha-3 codes of issuing countries seen on this user's approved ID documents, e.g. ["USA", "ESP"]. Empty array when none. + * + * @param issuingStates the value + * @return this builder + */ + public Builder issuingStates(List issuingStates) { + return set("issuing_states", Conv.list(Conv.STRING), issuingStates); + } + + /** + * Verified email addresses collected from this user's approved sessions, e.g. ["john@example.com"]. + * + * @param approvedEmails the value + * @return this builder + */ + public Builder approvedEmails(List approvedEmails) { + return set("approved_emails", Conv.list(Conv.STRING), approvedEmails); + } + + /** + * Verified phone numbers collected from this user's approved sessions, e.g. ["+14155551234"]. + * + * @param approvedPhones the value + * @return this builder + */ + public Builder approvedPhones(List approvedPhones) { + return set("approved_phones", Conv.list(Conv.STRING), approvedPhones); + } + + /** + * Aggregated per-feature status across all of this user's sessions. Possible keys: ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, QUESTIONNAIRE, EMAIL_VERIFICATION, PHONE, AML, IP_ANALYSIS, AGE_ESTIMATION, DATABASE_VALIDATION. Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @param features the value + * @return this builder + */ + public Builder features(Map features) { + return setAny("features", features); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @param featuresList the value + * @return this builder + */ + public Builder featuresList(List featuresList) { + return set("features_list", Conv.list(Conv.model(UserListItem.FeaturesList::fromJson)), featuresList); + } + + /** + * Timestamp of the most recent session + * + * @param lastSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSessionAt(@Nullable OffsetDateTime lastSessionAt) { + return setNullable("last_session_at", Conv.DATE_TIME, lastSessionAt); + } + + /** + * Timestamp of the first session + * + * @param firstSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSessionAt(@Nullable OffsetDateTime firstSessionAt) { + return setNullable("first_session_at", Conv.DATE_TIME, firstSessionAt); + } + + /** + * Timestamp of the most recent activity on this user (session, transaction, status change, data edit, etc.). + * + * @param lastActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastActivityAt(@Nullable OffsetDateTime lastActivityAt) { + return setNullable("last_activity_at", Conv.DATE_TIME, lastActivityAt); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Custom metadata JSON you attached to this user. Defaults to {}. + * + * @param metadata the value + * @return this builder + */ + public Builder metadata(Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Tag assignments. NOTE: on detail responses each entry is a tag *link* object ({uuid, tag: {...}, added_by_email, added_by_name, created_at}), unlike the flat {uuid, name, color} shape used on list responses. + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(UserDetailItem.Tags::fromJson)), tags); + } + + /** + * Activity log and comments for this user (status changes, profile edits, manual notes). + * + * @param comments the value + * @return this builder + */ + public Builder comments(List comments) { + return set("comments", Conv.list(Conv.model(UserDetailItem.Comments::fromJson)), comments); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserDetailItem} + */ + public UserDetailItem build() { + return new UserDetailItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Tags extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "tag", "added_by_email", "added_by_name", "created_at"); + + private Tags(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tags} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tags fromJson(JsonNode json) { + return new Tags(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * UUID of the tag assignment (not the tag itself). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The tag field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional tag() { + return Json.optional(json, "tag", Conv.model(UserDetailItem.Tags.Tag::fromJson)); + } + + /** + * The added_by_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addedByEmail() { + return Json.optional(json, "added_by_email", Conv.STRING); + } + + /** + * The added_by_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional addedByName() { + return Json.optional(json, "added_by_name", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tags}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tags from) { + super(from); + } + + /** + * UUID of the tag assignment (not the tag itself). + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The tag field. + * + * @param tag the value + * @return this builder + */ + public Builder tag(UserDetailItem.Tags.Tag tag) { + return set("tag", Conv.model(UserDetailItem.Tags.Tag::fromJson), tag); + } + + /** + * The added_by_email field. + * + * @param addedByEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addedByEmail(@Nullable String addedByEmail) { + return setNullable("added_by_email", Conv.STRING, addedByEmail); + } + + /** + * The added_by_name field. + * + * @param addedByName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder addedByName(@Nullable String addedByName) { + return setNullable("added_by_name", Conv.STRING, addedByName); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tags} + */ + public Tags build() { + return new Tags(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + public static final class Tag extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "color", "description", "source", "created_at", "updated_at"); + + private Tag(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tag} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tag fromJson(JsonNode json) { + return new Tag(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The color field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional color() { + return Json.optional(json, "color", Conv.STRING); + } + + /** + * The description field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * The source field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(UserDetailItem.Tags.Tag.Source::of)); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tag}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tag from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The color field. + * + * @param color the value + * @return this builder + */ + public Builder color(String color) { + return set("color", Conv.STRING, color); + } + + /** + * The description field. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * The source field. + * + * @param source the value + * @return this builder + */ + public Builder source(UserDetailItem.Tags.Tag.Source source) { + return set("source", Conv.enumeration(UserDetailItem.Tags.Tag.Source::of), source); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tag} + */ + public Tag build() { + return new Tag(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "didit"}. */ + public static final Source DIDIT = new Source("didit"); + + /** The value {@code "custom"}. */ + public static final Source CUSTOM = new Source("custom"); + + private static final List KNOWN_VALUES = List.of(DIDIT, CUSTOM); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + } + + public static final class Comments extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "comment_type", "comment", "actor_email", "actor_name", "previous_status", "new_status", "previous_value", "new_value", "changed_fields", "metadata", "mentioned_emails", "created_at"); + + private Comments(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Comments} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Comments fromJson(JsonNode json) { + return new Comments(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The comment_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional commentType() { + return Json.optional(json, "comment_type", Conv.enumeration(UserDetailItem.Comments.CommentType::of)); + } + + /** + * The comment field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * The actor_email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorEmail() { + return Json.optional(json, "actor_email", Conv.STRING); + } + + /** + * The actor_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional actorName() { + return Json.optional(json, "actor_name", Conv.STRING); + } + + /** + * The previous_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previousStatus() { + return Json.optional(json, "previous_status", Conv.enumeration(UserDetailItem.Comments.PreviousStatus::of)); + } + + /** + * The new_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional newStatus() { + return Json.optional(json, "new_status", Conv.enumeration(UserDetailItem.Comments.NewStatus::of)); + } + + /** + * Previous field values for PROFILE_UPDATED entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> previousValue() { + return Json.optional(json, "previous_value", Conv.OBJECT); + } + + /** + * New field values for PROFILE_UPDATED entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> newValue() { + return Json.optional(json, "new_value", Conv.OBJECT); + } + + /** + * Names of the fields changed by a PROFILE_UPDATED entry. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> changedFields() { + return Json.optional(json, "changed_fields", Conv.list(Conv.STRING)); + } + + /** + * The metadata field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * The mentioned_emails field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> mentionedEmails() { + return Json.optional(json, "mentioned_emails", Conv.list(Conv.STRING)); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Comments}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Comments from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The comment_type field. + * + * @param commentType the value + * @return this builder + */ + public Builder commentType(UserDetailItem.Comments.CommentType commentType) { + return set("comment_type", Conv.enumeration(UserDetailItem.Comments.CommentType::of), commentType); + } + + /** + * The comment field. + * + * @param comment the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder comment(@Nullable String comment) { + return setNullable("comment", Conv.STRING, comment); + } + + /** + * The actor_email field. + * + * @param actorEmail the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorEmail(@Nullable String actorEmail) { + return setNullable("actor_email", Conv.STRING, actorEmail); + } + + /** + * The actor_name field. + * + * @param actorName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder actorName(@Nullable String actorName) { + return setNullable("actor_name", Conv.STRING, actorName); + } + + /** + * The previous_status field. + * + * @param previousStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previousStatus(UserDetailItem.Comments.@Nullable PreviousStatus previousStatus) { + return setNullable("previous_status", Conv.enumeration(UserDetailItem.Comments.PreviousStatus::of), previousStatus); + } + + /** + * The new_status field. + * + * @param newStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newStatus(UserDetailItem.Comments.@Nullable NewStatus newStatus) { + return setNullable("new_status", Conv.enumeration(UserDetailItem.Comments.NewStatus::of), newStatus); + } + + /** + * Previous field values for PROFILE_UPDATED entries. + * + * @param previousValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previousValue(@Nullable Map previousValue) { + return setAny("previous_value", previousValue); + } + + /** + * New field values for PROFILE_UPDATED entries. + * + * @param newValue the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder newValue(@Nullable Map newValue) { + return setAny("new_value", newValue); + } + + /** + * Names of the fields changed by a PROFILE_UPDATED entry. + * + * @param changedFields the value + * @return this builder + */ + public Builder changedFields(List changedFields) { + return set("changed_fields", Conv.list(Conv.STRING), changedFields); + } + + /** + * The metadata field. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * The mentioned_emails field. + * + * @param mentionedEmails the value + * @return this builder + */ + public Builder mentionedEmails(List mentionedEmails) { + return set("mentioned_emails", Conv.list(Conv.STRING), mentionedEmails); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Comments} + */ + public Comments build() { + return new Comments(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class CommentType extends StringEnum { + /** The value {@code "COMMENT"}. */ + public static final CommentType COMMENT = new CommentType("COMMENT"); + + /** The value {@code "STATUS_CHANGED"}. */ + public static final CommentType STATUS_CHANGED = new CommentType("STATUS_CHANGED"); + + /** The value {@code "METADATA_UPDATED"}. */ + public static final CommentType METADATA_UPDATED = new CommentType("METADATA_UPDATED"); + + /** The value {@code "TAG_ADDED"}. */ + public static final CommentType TAG_ADDED = new CommentType("TAG_ADDED"); + + /** The value {@code "TAG_REMOVED"}. */ + public static final CommentType TAG_REMOVED = new CommentType("TAG_REMOVED"); + + /** The value {@code "PROFILE_UPDATED"}. */ + public static final CommentType PROFILE_UPDATED = new CommentType("PROFILE_UPDATED"); + + private static final List KNOWN_VALUES = List.of(COMMENT, STATUS_CHANGED, METADATA_UPDATED, TAG_ADDED, TAG_REMOVED, PROFILE_UPDATED); + + private CommentType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static CommentType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, CommentType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class PreviousStatus extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final PreviousStatus ACTIVE = new PreviousStatus("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final PreviousStatus FLAGGED = new PreviousStatus("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final PreviousStatus BLOCKED = new PreviousStatus("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private PreviousStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static PreviousStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, PreviousStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class NewStatus extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final NewStatus ACTIVE = new NewStatus("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final NewStatus FLAGGED = new NewStatus("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final NewStatus BLOCKED = new NewStatus("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private NewStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static NewStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, NewStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/UserListItem.java b/src/main/java/me/didit/types/UserListItem.java new file mode 100644 index 0000000..061dc8a --- /dev/null +++ b/src/main/java/me/didit/types/UserListItem.java @@ -0,0 +1,799 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** A verified user. */ +public final class UserListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "display_name", "full_name", "date_of_birth", "effective_name", "status", "portrait_image_url", "session_count", "approved_count", "declined_count", "in_review_count", "issuing_states", "approved_emails", "approved_phones", "features", "features_list", "last_session_at", "first_session_at", "last_activity_at", "tags", "created_at"); + + private UserListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UserListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UserListItem fromJson(JsonNode json) { + return new UserListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit's stable internal UUID for this user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your unique identifier for this user (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * Custom display name set by you + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Full name extracted from verified documents + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * The date_of_birth field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Best available name: display_name if set, otherwise full_name + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional effectiveName() { + return Json.optional(json, "effective_name", Conv.STRING); + } + + /** + * Lifecycle status of the user record (NOT a session status). ACTIVE is the default, FLAGGED marks the user for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UserListItem.Status::of)); + } + + /** + * Presigned URL of the user's portrait photo (expires after a few hours) + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional portraitImageUrl() { + return Json.optional(json, "portrait_image_url", Conv.STRING); + } + + /** + * Total number of verification sessions for this user + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionCount() { + return Json.optional(json, "session_count", Conv.LONG); + } + + /** + * Number of approved sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional approvedCount() { + return Json.optional(json, "approved_count", Conv.LONG); + } + + /** + * Number of declined sessions + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional declinedCount() { + return Json.optional(json, "declined_count", Conv.LONG); + } + + /** + * Number of sessions in review + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional inReviewCount() { + return Json.optional(json, "in_review_count", Conv.LONG); + } + + /** + * ISO 3166-1 alpha-3 codes of issuing countries seen on this user's approved ID documents, e.g. ["USA", "ESP"]. Empty array when none. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> issuingStates() { + return Json.optional(json, "issuing_states", Conv.list(Conv.STRING)); + } + + /** + * Verified email addresses collected from this user's approved sessions, e.g. ["john@example.com"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedEmails() { + return Json.optional(json, "approved_emails", Conv.list(Conv.STRING)); + } + + /** + * Verified phone numbers collected from this user's approved sessions, e.g. ["+14155551234"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedPhones() { + return Json.optional(json, "approved_phones", Conv.list(Conv.STRING)); + } + + /** + * Aggregated per-feature status across all of this user's sessions. Possible keys: ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, QUESTIONNAIRE, EMAIL_VERIFICATION, PHONE, AML, IP_ANALYSIS, AGE_ESTIMATION, DATABASE_VALIDATION. Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> features() { + return Json.optional(json, "features", Conv.OBJECT); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> featuresList() { + return Json.optional(json, "features_list", Conv.list(Conv.model(UserListItem.FeaturesList::fromJson))); + } + + /** + * Timestamp of the most recent session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastSessionAt() { + return Json.optional(json, "last_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the first session + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional firstSessionAt() { + return Json.optional(json, "first_session_at", Conv.DATE_TIME); + } + + /** + * Timestamp of the most recent activity on this user (session, transaction, status change, data edit, etc.). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastActivityAt() { + return Json.optional(json, "last_activity_at", Conv.DATE_TIME); + } + + /** + * Tags assigned to this user + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.model(UserListItem.Tags::fromJson))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UserListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UserListItem from) { + super(from); + } + + /** + * Didit's stable internal UUID for this user. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your unique identifier for this user (passed when creating sessions). This can be null when no vendor identifier was supplied. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * Custom display name set by you + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Full name extracted from verified documents + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * The date_of_birth field. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Best available name: display_name if set, otherwise full_name + * + * @param effectiveName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder effectiveName(@Nullable String effectiveName) { + return setNullable("effective_name", Conv.STRING, effectiveName); + } + + /** + * Lifecycle status of the user record (NOT a session status). ACTIVE is the default, FLAGGED marks the user for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + * @param status the value + * @return this builder + */ + public Builder status(UserListItem.Status status) { + return set("status", Conv.enumeration(UserListItem.Status::of), status); + } + + /** + * Presigned URL of the user's portrait photo (expires after a few hours) + * + * @param portraitImageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder portraitImageUrl(@Nullable String portraitImageUrl) { + return setNullable("portrait_image_url", Conv.STRING, portraitImageUrl); + } + + /** + * Total number of verification sessions for this user + * + * @param sessionCount the value + * @return this builder + */ + public Builder sessionCount(long sessionCount) { + return set("session_count", Conv.LONG, sessionCount); + } + + /** + * Number of approved sessions + * + * @param approvedCount the value + * @return this builder + */ + public Builder approvedCount(long approvedCount) { + return set("approved_count", Conv.LONG, approvedCount); + } + + /** + * Number of declined sessions + * + * @param declinedCount the value + * @return this builder + */ + public Builder declinedCount(long declinedCount) { + return set("declined_count", Conv.LONG, declinedCount); + } + + /** + * Number of sessions in review + * + * @param inReviewCount the value + * @return this builder + */ + public Builder inReviewCount(long inReviewCount) { + return set("in_review_count", Conv.LONG, inReviewCount); + } + + /** + * ISO 3166-1 alpha-3 codes of issuing countries seen on this user's approved ID documents, e.g. ["USA", "ESP"]. Empty array when none. + * + * @param issuingStates the value + * @return this builder + */ + public Builder issuingStates(List issuingStates) { + return set("issuing_states", Conv.list(Conv.STRING), issuingStates); + } + + /** + * Verified email addresses collected from this user's approved sessions, e.g. ["john@example.com"]. + * + * @param approvedEmails the value + * @return this builder + */ + public Builder approvedEmails(List approvedEmails) { + return set("approved_emails", Conv.list(Conv.STRING), approvedEmails); + } + + /** + * Verified phone numbers collected from this user's approved sessions, e.g. ["+14155551234"]. + * + * @param approvedPhones the value + * @return this builder + */ + public Builder approvedPhones(List approvedPhones) { + return set("approved_phones", Conv.list(Conv.STRING), approvedPhones); + } + + /** + * Aggregated per-feature status across all of this user's sessions. Possible keys: ID_VERIFICATION, NFC, LIVENESS, FACE_MATCH, POA, QUESTIONNAIRE, EMAIL_VERIFICATION, PHONE, AML, IP_ANALYSIS, AGE_ESTIMATION, DATABASE_VALIDATION. Possible values: Approved, Declined, In Review, Not Finished, Resub Requested. + * + * @param features the value + * @return this builder + */ + public Builder features(Map features) { + return setAny("features", features); + } + + /** + * Same data as features, as an ordered array of {feature, status} objects. + * + * @param featuresList the value + * @return this builder + */ + public Builder featuresList(List featuresList) { + return set("features_list", Conv.list(Conv.model(UserListItem.FeaturesList::fromJson)), featuresList); + } + + /** + * Timestamp of the most recent session + * + * @param lastSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastSessionAt(@Nullable OffsetDateTime lastSessionAt) { + return setNullable("last_session_at", Conv.DATE_TIME, lastSessionAt); + } + + /** + * Timestamp of the first session + * + * @param firstSessionAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder firstSessionAt(@Nullable OffsetDateTime firstSessionAt) { + return setNullable("first_session_at", Conv.DATE_TIME, firstSessionAt); + } + + /** + * Timestamp of the most recent activity on this user (session, transaction, status change, data edit, etc.). + * + * @param lastActivityAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastActivityAt(@Nullable OffsetDateTime lastActivityAt) { + return setNullable("last_activity_at", Conv.DATE_TIME, lastActivityAt); + } + + /** + * Tags assigned to this user + * + * @param tags the value + * @return this builder + */ + public Builder tags(List tags) { + return set("tags", Conv.list(Conv.model(UserListItem.Tags::fromJson)), tags); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UserListItem} + */ + public UserListItem build() { + return new UserListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Lifecycle status of the user record (NOT a session status). ACTIVE is the default, FLAGGED marks the user for manual attention, BLOCKED prevents new sessions for this vendor_data. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class FeaturesList extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("feature", "status"); + + private FeaturesList(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code FeaturesList} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static FeaturesList fromJson(JsonNode json) { + return new FeaturesList(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The feature field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feature() { + return Json.optional(json, "feature", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link FeaturesList}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(FeaturesList from) { + super(from); + } + + /** + * The feature field. + * + * @param feature the value + * @return this builder + */ + public Builder feature(String feature) { + return set("feature", Conv.STRING, feature); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(String status) { + return set("status", Conv.STRING, status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code FeaturesList} + */ + public FeaturesList build() { + return new FeaturesList(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Tags extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "name", "color"); + + private Tags(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Tags} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Tags fromJson(JsonNode json) { + return new Tags(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The color field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional color() { + return Json.optional(json, "color", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Tags}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Tags from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The color field. + * + * @param color the value + * @return this builder + */ + public Builder color(String color) { + return set("color", Conv.STRING, color); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Tags} + */ + public Tags build() { + return new Tags(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/UsersBatchDeleteParams.java b/src/main/java/me/didit/types/UsersBatchDeleteParams.java new file mode 100644 index 0000000..f015acf --- /dev/null +++ b/src/main/java/me/didit/types/UsersBatchDeleteParams.java @@ -0,0 +1,139 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code users.batch_delete}. */ +public final class UsersBatchDeleteParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data_list", "didit_internal_id_list", "delete_all"); + + private UsersBatchDeleteParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersBatchDeleteParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersBatchDeleteParams fromJson(JsonNode json) { + return new UsersBatchDeleteParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your own identifiers to delete, matched exactly as sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> vendorDataList() { + return Json.optional(json, "vendor_data_list", Conv.list(Conv.STRING)); + } + + /** + * Didit internal user IDs to delete - the didit_internal_id returned by the create and get endpoints. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> diditInternalIdList() { + return Json.optional(json, "didit_internal_id_list", Conv.list(Conv.STRING)); + } + + /** + * If true, deletes every user in the application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleteAll() { + return Json.optional(json, "delete_all", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersBatchDeleteParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersBatchDeleteParams from) { + super(from); + } + + /** + * Your own identifiers to delete, matched exactly as sent. + * + * @param vendorDataList the value + * @return this builder + */ + public Builder vendorDataList(List vendorDataList) { + return set("vendor_data_list", Conv.list(Conv.STRING), vendorDataList); + } + + /** + * Didit internal user IDs to delete - the didit_internal_id returned by the create and get endpoints. + * + * @param diditInternalIdList the value + * @return this builder + */ + public Builder diditInternalIdList(List diditInternalIdList) { + return set("didit_internal_id_list", Conv.list(Conv.STRING), diditInternalIdList); + } + + /** + * If true, deletes every user in the application. + * + * @param deleteAll the value + * @return this builder + */ + public Builder deleteAll(boolean deleteAll) { + return set("delete_all", Conv.BOOLEAN, deleteAll); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersBatchDeleteParams} + */ + public UsersBatchDeleteParams build() { + return new UsersBatchDeleteParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersBatchDeleteResponse.java b/src/main/java/me/didit/types/UsersBatchDeleteResponse.java new file mode 100644 index 0000000..b312573 --- /dev/null +++ b/src/main/java/me/didit/types/UsersBatchDeleteResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class UsersBatchDeleteResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("deleted"); + + private UsersBatchDeleteResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersBatchDeleteResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersBatchDeleteResponse fromJson(JsonNode json) { + return new UsersBatchDeleteResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of users deleted (excludes vendor_data values that didn't match anything). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deleted() { + return Json.optional(json, "deleted", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersBatchDeleteResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersBatchDeleteResponse from) { + super(from); + } + + /** + * Number of users deleted (excludes vendor_data values that didn't match anything). + * + * @param deleted the value + * @return this builder + */ + public Builder deleted(long deleted) { + return set("deleted", Conv.LONG, deleted); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersBatchDeleteResponse} + */ + public UsersBatchDeleteResponse build() { + return new UsersBatchDeleteResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersCreateParams.java b/src/main/java/me/didit/types/UsersCreateParams.java new file mode 100644 index 0000000..9522b75 --- /dev/null +++ b/src/main/java/me/didit/types/UsersCreateParams.java @@ -0,0 +1,310 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code users.create}. */ +public final class UsersCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("vendor_data", "full_name", "display_name", "date_of_birth", "status", "metadata", "approved_emails", "approved_phones", "issuing_states"); + + private UsersCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersCreateParams fromJson(JsonNode json) { + return new UsersCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Your unique identifier for this user (free-form string, NOT a UUID). Must be unique among non-deleted users for the application; matched exactly as sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String vendorData() { + return Json.required(json, "vendor_data", Conv.STRING); + } + + /** + * Full legal name of the user. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * Friendly display name shown in the console (takes precedence over full_name for UI display). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Date of birth in YYYY-MM-DD format. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * Initial lifecycle status. Defaults to ACTIVE. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UsersCreateParams.Status::of)); + } + + /** + * Arbitrary JSON object you attach to the user. Defaults to {}. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Pre-trusted email addresses for this user, e.g. ["john@example.com"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedEmails() { + return Json.optional(json, "approved_emails", Conv.list(Conv.STRING)); + } + + /** + * Pre-trusted phone numbers for this user, e.g. ["+14155551234"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedPhones() { + return Json.optional(json, "approved_phones", Conv.list(Conv.STRING)); + } + + /** + * Pre-recorded issuing countries (ISO 3166-1 alpha-3), e.g. ["USA"]. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> issuingStates() { + return Json.optional(json, "issuing_states", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersCreateParams from) { + super(from); + } + + /** + * Your unique identifier for this user (free-form string, NOT a UUID). Must be unique among non-deleted users for the application; matched exactly as sent. + * + * @param vendorData the value + * @return this builder + */ + public Builder vendorData(String vendorData) { + return set("vendor_data", Conv.STRING, vendorData); + } + + /** + * Full legal name of the user. + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * Friendly display name shown in the console (takes precedence over full_name for UI display). + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Date of birth in YYYY-MM-DD format. + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * Initial lifecycle status. Defaults to ACTIVE. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersCreateParams.Status status) { + return set("status", Conv.enumeration(UsersCreateParams.Status::of), status); + } + + /** + * Arbitrary JSON object you attach to the user. Defaults to {}. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Pre-trusted email addresses for this user, e.g. ["john@example.com"]. + * + * @param approvedEmails the value + * @return this builder + */ + public Builder approvedEmails(List approvedEmails) { + return set("approved_emails", Conv.list(Conv.STRING), approvedEmails); + } + + /** + * Pre-trusted phone numbers for this user, e.g. ["+14155551234"]. + * + * @param approvedPhones the value + * @return this builder + */ + public Builder approvedPhones(List approvedPhones) { + return set("approved_phones", Conv.list(Conv.STRING), approvedPhones); + } + + /** + * Pre-recorded issuing countries (ISO 3166-1 alpha-3), e.g. ["USA"]. + * + * @param issuingStates the value + * @return this builder + */ + public Builder issuingStates(List issuingStates) { + return set("issuing_states", Conv.list(Conv.STRING), issuingStates); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public UsersCreateParams build() { + require("vendor_data", false); + return new UsersCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Initial lifecycle status. Defaults to ACTIVE. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/UsersListNetworksResponse.java b/src/main/java/me/didit/types/UsersListNetworksResponse.java new file mode 100644 index 0000000..75f5c5a --- /dev/null +++ b/src/main/java/me/didit/types/UsersListNetworksResponse.java @@ -0,0 +1,98 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class UsersListNetworksResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("results"); + + private UsersListNetworksResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersListNetworksResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersListNetworksResponse fromJson(JsonNode json) { + return new UsersListNetworksResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(EntityNetworkMembership::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersListNetworksResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersListNetworksResponse from) { + super(from); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(EntityNetworkMembership::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersListNetworksResponse} + */ + public UsersListNetworksResponse build() { + return new UsersListNetworksResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersListParams.java b/src/main/java/me/didit/types/UsersListParams.java new file mode 100644 index 0000000..d8aa1bd --- /dev/null +++ b/src/main/java/me/didit/types/UsersListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code users.list}. */ +public final class UsersListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private UsersListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersListParams fromJson(JsonNode json) { + return new UsersListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages small for latency. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Zero-based offset of the first record to return. Prefer following the next URL from the previous page over computing this by hand. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersListParams from) { + super(from); + } + + /** + * Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages small for latency. + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Zero-based offset of the first record to return. Prefer following the next URL from the previous page over computing this by hand. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersListParams} + */ + public UsersListParams build() { + return new UsersListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersListResponse.java b/src/main/java/me/didit/types/UsersListResponse.java new file mode 100644 index 0000000..c4ee303 --- /dev/null +++ b/src/main/java/me/didit/types/UsersListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class UsersListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private UsersListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersListResponse fromJson(JsonNode json) { + return new UsersListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Number of matching rows โ€” exact up to 100, capped at 100 beyond that for performance. Do not use it to detect the last page; rely on next being null instead. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(UserListItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersListResponse from) { + super(from); + } + + /** + * Number of matching rows โ€” exact up to 100, capped at 100 beyond that for performance. Do not use it to detect the last page; rely on next being null instead. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * Absolute URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * Absolute URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(UserListItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersListResponse} + */ + public UsersListResponse build() { + return new UsersListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersRetrieveOngoingMonitoringJobResponse.java b/src/main/java/me/didit/types/UsersRetrieveOngoingMonitoringJobResponse.java new file mode 100644 index 0000000..13ef4db --- /dev/null +++ b/src/main/java/me/didit/types/UsersRetrieveOngoingMonitoringJobResponse.java @@ -0,0 +1,782 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class UsersRetrieveOngoingMonitoringJobResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private UsersRetrieveOngoingMonitoringJobResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersRetrieveOngoingMonitoringJobResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersRetrieveOngoingMonitoringJobResponse fromJson(JsonNode json) { + return new UsersRetrieveOngoingMonitoringJobResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UsersRetrieveOngoingMonitoringJobResponse.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(UsersRetrieveOngoingMonitoringJobResponse.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(UsersRetrieveOngoingMonitoringJobResponse.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersRetrieveOngoingMonitoringJobResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersRetrieveOngoingMonitoringJobResponse from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersRetrieveOngoingMonitoringJobResponse.Status status) { + return set("status", Conv.enumeration(UsersRetrieveOngoingMonitoringJobResponse.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(UsersRetrieveOngoingMonitoringJobResponse.Outcomes outcomes) { + return set("outcomes", Conv.model(UsersRetrieveOngoingMonitoringJobResponse.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(UsersRetrieveOngoingMonitoringJobResponse.Estimate estimate) { + return set("estimate", Conv.model(UsersRetrieveOngoingMonitoringJobResponse.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersRetrieveOngoingMonitoringJobResponse} + */ + public UsersRetrieveOngoingMonitoringJobResponse build() { + return new UsersRetrieveOngoingMonitoringJobResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/UsersSetAmlMonitoringParams.java b/src/main/java/me/didit/types/UsersSetAmlMonitoringParams.java new file mode 100644 index 0000000..05fe496 --- /dev/null +++ b/src/main/java/me/didit/types/UsersSetAmlMonitoringParams.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code users.set_aml_monitoring}. */ +public final class UsersSetAmlMonitoringParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "estimate_only", "vendor_data_list", "didit_internal_id_list"); + + private UsersSetAmlMonitoringParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersSetAmlMonitoringParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersSetAmlMonitoringParams fromJson(JsonNode json) { + return new UsersSetAmlMonitoringParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * true to enable monitoring, false to disable it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * When true, returns the cost estimate and performs no writes - no screening, no billing, no job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimateOnly() { + return Json.optional(json, "estimate_only", Conv.BOOLEAN); + } + + /** + * Your own identifiers of the users to toggle, matched exactly as sent. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> vendorDataList() { + return Json.optional(json, "vendor_data_list", Conv.list(Conv.STRING)); + } + + /** + * Didit internal ids of the users to toggle - the didit_internal_id returned by the create, get and list endpoints. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> diditInternalIdList() { + return Json.optional(json, "didit_internal_id_list", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersSetAmlMonitoringParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersSetAmlMonitoringParams from) { + super(from); + } + + /** + * true to enable monitoring, false to disable it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * When true, returns the cost estimate and performs no writes - no screening, no billing, no job. + * + * @param estimateOnly the value + * @return this builder + */ + public Builder estimateOnly(boolean estimateOnly) { + return set("estimate_only", Conv.BOOLEAN, estimateOnly); + } + + /** + * Your own identifiers of the users to toggle, matched exactly as sent. + * + * @param vendorDataList the value + * @return this builder + */ + public Builder vendorDataList(List vendorDataList) { + return set("vendor_data_list", Conv.list(Conv.STRING), vendorDataList); + } + + /** + * Didit internal ids of the users to toggle - the didit_internal_id returned by the create, get and list endpoints. + * + * @param diditInternalIdList the value + * @return this builder + */ + public Builder diditInternalIdList(List diditInternalIdList) { + return set("didit_internal_id_list", Conv.list(Conv.STRING), diditInternalIdList); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersSetAmlMonitoringParams} + * @throws IllegalStateException when a required field is missing + */ + public UsersSetAmlMonitoringParams build() { + require("is_enabled", false); + return new UsersSetAmlMonitoringParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersSetAmlMonitoringResponse.java b/src/main/java/me/didit/types/UsersSetAmlMonitoringResponse.java new file mode 100644 index 0000000..ea9587f --- /dev/null +++ b/src/main/java/me/didit/types/UsersSetAmlMonitoringResponse.java @@ -0,0 +1,2648 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Response of {@code users.set_aml_monitoring}; the shape depends on the HTTP status. */ +public final class UsersSetAmlMonitoringResponse extends MultiStatusResponse { + private UsersSetAmlMonitoringResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static UsersSetAmlMonitoringResponse fromResponse(int statusCode, JsonNode json) { + return new UsersSetAmlMonitoringResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.union(UsersSetAmlMonitoringResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 202. + * + * @return true for status 202 + */ + public boolean isAccepted() { + return statusCode() == 202; + } + + /** + * The body of a 202 response. + * + * @return the body, or empty for another status + */ + public Optional asAccepted() { + return isAccepted() ? Optional.of(Conv.model(UsersSetAmlMonitoringResponse.Accepted::fromJson).read(json)) : Optional.empty(); + } + + /** + * + *

One of: {@code CostPreview}, {@code Variant2}. Check with the {@code is...} + * methods and read with the {@code as...} methods; the fields every variant has are readable directly. + */ + public static final class Ok extends JsonUnion { + private Ok(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Ok} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Ok fromJson(JsonNode json) { + return new Ok(json.deepCopy()); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unmatched() { + return Json.required(json, "unmatched", Conv.list(Conv.STRING)); + } + + /** + * Wraps a {@code CostPreview} value. + * + * @param value the value + * @return the union + */ + public static Ok ofCostPreview(UsersSetAmlMonitoringResponse.Ok.CostPreview value) { + return new Ok(Conv.model(UsersSetAmlMonitoringResponse.Ok.CostPreview::fromJson).write(value)); + } + + /** + * Whether this value is a {@code CostPreview}. + * + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @return true when it matches + */ + public boolean isCostPreview() { + return Json.hasFields(json, "users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient", "unmatched"); + } + + /** + * Reads this value as a {@code CostPreview}. + * + * @return the value, or empty when {@link #isCostPreview()} is false + */ + public Optional asCostPreview() { + return isCostPreview() ? Optional.of(Conv.model(UsersSetAmlMonitoringResponse.Ok.CostPreview::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static Ok ofVariant2(UsersSetAmlMonitoringResponse.Ok.Variant2 value) { + return new Ok(Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * @return true when it matches + */ + public boolean isVariant2() { + return Json.hasFields(json, "job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at", "estimate", "unmatched"); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional asVariant2() { + return isVariant2() ? Optional.of(Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2::fromJson).read(json)) : Optional.empty(); + } + + /** Cost preview. Returned directly when estimate_only is true (nothing is written). */ + public static final class CostPreview extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient", "unmatched"); + + private CostPreview(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CostPreview} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CostPreview fromJson(JsonNode json) { + return new CostPreview(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profiles matched by the selection. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long usersTotal() { + return Json.required(json, "users_total", Conv.LONG); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long alreadyEnabled() { + return Json.required(json, "already_enabled", Conv.LONG); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long withExistingAml() { + return Json.required(json, "with_existing_aml", Conv.LONG); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long needingScreening() { + return Json.required(json, "needing_screening", Conv.LONG); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long skippedNoIdentityData() { + return Json.required(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long skippedBlocked() { + return Json.required(json, "skipped_blocked", Conv.LONG); + } + + /** + * One-time cost of the new screenings. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double estimatedScreeningCostUsd() { + return Json.required(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public double estimatedAnnualMonitoringCostUsd() { + return Json.required(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean balanceSufficient() { + return Json.required(json, "balance_sufficient", Conv.BOOLEAN); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unmatched() { + return Json.required(json, "unmatched", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CostPreview}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CostPreview from) { + super(from); + } + + /** + * Profiles matched by the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * One-time cost of the new screenings. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. + * + * @param unmatched the value + * @return this builder + */ + public Builder unmatched(List unmatched) { + return set("unmatched", Conv.list(Conv.STRING), unmatched); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CostPreview} + * @throws IllegalStateException when a required field is missing + */ + public CostPreview build() { + require("users_total", false); + require("already_enabled", false); + require("with_existing_aml", false); + require("needing_screening", false); + require("skipped_no_identity_data", false); + require("skipped_blocked", false); + require("estimated_screening_cost_usd", false); + require("estimated_annual_monitoring_cost_usd", false); + require("balance_sufficient", false); + require("unmatched", false); + return new CostPreview(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Variant2 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at", "estimate", "unmatched"); + + private Variant2(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant2} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant2 fromJson(JsonNode json) { + return new Variant2(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String jobId() { + return Json.required(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public UsersSetAmlMonitoringResponse.Ok.Variant2.Status status() { + return Json.required(json, "status", Conv.enumeration(UsersSetAmlMonitoringResponse.Ok.Variant2.Status::of)); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * Which profile family the job toggles. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public UsersSetAmlMonitoringResponse.Ok.Variant2.TargetType targetType() { + return Json.required(json, "target_type", Conv.enumeration(UsersSetAmlMonitoringResponse.Ok.Variant2.TargetType::of)); + } + + /** + * Profiles the job processes. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long total() { + return Json.required(json, "total", Conv.LONG); + } + + /** + * Profiles processed so far. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long processed() { + return Json.required(json, "processed", Conv.LONG); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public UsersSetAmlMonitoringResponse.Ok.Variant2.Outcomes outcomes() { + return Json.required(json, "outcomes", Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2.Outcomes::fromJson)); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List results() { + return Json.required(json, "results", Conv.list(Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2.Results::fromJson))); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public UsersSetAmlMonitoringResponse.Ok.Variant2.Estimate estimate() { + return Json.required(json, "estimate", Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2.Estimate::fromJson)); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List unmatched() { + return Json.required(json, "unmatched", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant2}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant2 from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersSetAmlMonitoringResponse.Ok.Variant2.Status status) { + return set("status", Conv.enumeration(UsersSetAmlMonitoringResponse.Ok.Variant2.Status::of), status); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * Which profile family the job toggles. + * + * @param targetType the value + * @return this builder + */ + public Builder targetType(UsersSetAmlMonitoringResponse.Ok.Variant2.TargetType targetType) { + return set("target_type", Conv.enumeration(UsersSetAmlMonitoringResponse.Ok.Variant2.TargetType::of), targetType); + } + + /** + * Profiles the job processes. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Profiles processed so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(UsersSetAmlMonitoringResponse.Ok.Variant2.Outcomes outcomes) { + return set("outcomes", Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2.Outcomes::fromJson), outcomes); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2.Results::fromJson)), results); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(UsersSetAmlMonitoringResponse.Ok.Variant2.Estimate estimate) { + return set("estimate", Conv.model(UsersSetAmlMonitoringResponse.Ok.Variant2.Estimate::fromJson), estimate); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @param unmatched the value + * @return this builder + */ + public Builder unmatched(List unmatched) { + return set("unmatched", Conv.list(Conv.STRING), unmatched); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant2} + * @throws IllegalStateException when a required field is missing + */ + public Variant2 build() { + require("job_id", false); + require("status", false); + require("is_enabled", false); + require("target_type", false); + require("total", false); + require("processed", false); + require("outcomes", false); + require("results", false); + require("error", true); + require("created_at", false); + require("completed_at", true); + require("estimate", false); + require("unmatched", false); + return new Variant2(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Which profile family the job toggles. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TargetType extends StringEnum { + /** The value {@code "user"}. */ + public static final TargetType USER = new TargetType("user"); + + /** The value {@code "business"}. */ + public static final TargetType BUSINESS = new TargetType("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private TargetType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TargetType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TargetType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening could not be completed; retry later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out while the job was running. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening could not be completed; retry later. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out while the job was running. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "outcome"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit internal id of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your own identifier for the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(UsersSetAmlMonitoringResponse.Ok.Variant2.Results.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Didit internal id of the profile. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your own identifier for the profile. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(UsersSetAmlMonitoringResponse.Ok.Variant2.Results.Outcome outcome) { + return set("outcome", Conv.enumeration(UsersSetAmlMonitoringResponse.Ok.Variant2.Results.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "enabled"}. */ + public static final Outcome ENABLED = new Outcome("enabled"); + + /** The value {@code "screened_and_enabled"}. */ + public static final Outcome SCREENED_AND_ENABLED = new Outcome("screened_and_enabled"); + + /** The value {@code "already_enabled"}. */ + public static final Outcome ALREADY_ENABLED = new Outcome("already_enabled"); + + /** The value {@code "disabled"}. */ + public static final Outcome DISABLED = new Outcome("disabled"); + + /** The value {@code "skipped_no_identity_data"}. */ + public static final Outcome SKIPPED_NO_IDENTITY_DATA = new Outcome("skipped_no_identity_data"); + + /** The value {@code "skipped_blocked"}. */ + public static final Outcome SKIPPED_BLOCKED = new Outcome("skipped_blocked"); + + /** The value {@code "skipped_sandbox"}. */ + public static final Outcome SKIPPED_SANDBOX = new Outcome("skipped_sandbox"); + + /** The value {@code "failed_provider"}. */ + public static final Outcome FAILED_PROVIDER = new Outcome("failed_provider"); + + /** The value {@code "failed_insufficient_balance"}. */ + public static final Outcome FAILED_INSUFFICIENT_BALANCE = new Outcome("failed_insufficient_balance"); + + private static final List KNOWN_VALUES = List.of(ENABLED, SCREENED_AND_ENABLED, ALREADY_ENABLED, DISABLED, SKIPPED_NO_IDENTITY_DATA, SKIPPED_BLOCKED, SKIPPED_SANDBOX, FAILED_PROVIDER, FAILED_INSUFFICIENT_BALANCE); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (nothing is written). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profiles matched by the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * One-time cost of the new screenings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Profiles matched by the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * One-time cost of the new screenings. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class Accepted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "target_type", "total", "processed", "outcomes", "results", "error", "created_at", "completed_at", "estimate", "unmatched"); + + private Accepted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Accepted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Accepted fromJson(JsonNode json) { + return new Accepted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UsersSetAmlMonitoringResponse.Accepted.Status::of)); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * Which profile family the job toggles. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional targetType() { + return Json.optional(json, "target_type", Conv.enumeration(UsersSetAmlMonitoringResponse.Accepted.TargetType::of)); + } + + /** + * Profiles the job processes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * Profiles processed so far. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(UsersSetAmlMonitoringResponse.Accepted.Outcomes::fromJson)); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(UsersSetAmlMonitoringResponse.Accepted.Results::fromJson))); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The completed_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional completedAt() { + return Json.optional(json, "completed_at", Conv.DATE_TIME); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(UsersSetAmlMonitoringResponse.Accepted.Estimate::fromJson)); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> unmatched() { + return Json.optional(json, "unmatched", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Accepted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Accepted from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersSetAmlMonitoringResponse.Accepted.Status status) { + return set("status", Conv.enumeration(UsersSetAmlMonitoringResponse.Accepted.Status::of), status); + } + + /** + * true when the job enables monitoring, false when it disables it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * Which profile family the job toggles. + * + * @param targetType the value + * @return this builder + */ + public Builder targetType(UsersSetAmlMonitoringResponse.Accepted.TargetType targetType) { + return set("target_type", Conv.enumeration(UsersSetAmlMonitoringResponse.Accepted.TargetType::of), targetType); + } + + /** + * Profiles the job processes. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * Profiles processed so far. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(UsersSetAmlMonitoringResponse.Accepted.Outcomes outcomes) { + return set("outcomes", Conv.model(UsersSetAmlMonitoringResponse.Accepted.Outcomes::fromJson), outcomes); + } + + /** + * One entry per processed profile, in processing order. Grows while the job runs; complete once status is COMPLETED. Recorded for jobs started through the API. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(UsersSetAmlMonitoringResponse.Accepted.Results::fromJson)), results); + } + + /** + * Generic failure message when status is FAILED; the detailed cause is kept on the platform side. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The completed_at field. + * + * @param completedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder completedAt(@Nullable OffsetDateTime completedAt) { + return setNullable("completed_at", Conv.DATE_TIME, completedAt); + } + + /** + * Cost preview. Returned directly when estimate_only is true (nothing is written). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(UsersSetAmlMonitoringResponse.Accepted.Estimate estimate) { + return set("estimate", Conv.model(UsersSetAmlMonitoringResponse.Accepted.Estimate::fromJson), estimate); + } + + /** + * Identifiers of the request that matched no profile in this application, exactly as sent. They are not part of the job. + * + * @param unmatched the value + * @return this builder + */ + public Builder unmatched(List unmatched) { + return set("unmatched", Conv.list(Conv.STRING), unmatched); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Accepted} + */ + public Accepted build() { + return new Accepted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Which profile family the job toggles. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class TargetType extends StringEnum { + /** The value {@code "user"}. */ + public static final TargetType USER = new TargetType("user"); + + /** The value {@code "business"}. */ + public static final TargetType BUSINESS = new TargetType("business"); + + private static final List KNOWN_VALUES = List.of(USER, BUSINESS); + + private TargetType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static TargetType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, TargetType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-record outcome counters. Every selected profile resolves to exactly one counter; nothing is silently skipped. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening could not be completed; retry later. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out while the job was running. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled on it. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active; nothing changed and nothing was billed. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring turned off across every AML screening of the profile. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: the profile lacks the full name, date of birth and country (users) or a name (businesses) needed to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application, no screening is created. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening could not be completed; retry later. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out while the job was running. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Results extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("didit_internal_id", "vendor_data", "outcome"); + + private Results(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Results} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Results fromJson(JsonNode json) { + return new Results(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Didit internal id of the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional diditInternalId() { + return Json.optional(json, "didit_internal_id", Conv.STRING); + } + + /** + * Your own identifier for the profile. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional vendorData() { + return Json.optional(json, "vendor_data", Conv.STRING); + } + + /** + * The outcome field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcome() { + return Json.optional(json, "outcome", Conv.enumeration(UsersSetAmlMonitoringResponse.Accepted.Results.Outcome::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Results}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Results from) { + super(from); + } + + /** + * Didit internal id of the profile. + * + * @param diditInternalId the value + * @return this builder + */ + public Builder diditInternalId(String diditInternalId) { + return set("didit_internal_id", Conv.STRING, diditInternalId); + } + + /** + * Your own identifier for the profile. + * + * @param vendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder vendorData(@Nullable String vendorData) { + return setNullable("vendor_data", Conv.STRING, vendorData); + } + + /** + * The outcome field. + * + * @param outcome the value + * @return this builder + */ + public Builder outcome(UsersSetAmlMonitoringResponse.Accepted.Results.Outcome outcome) { + return set("outcome", Conv.enumeration(UsersSetAmlMonitoringResponse.Accepted.Results.Outcome::of), outcome); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Results} + */ + public Results build() { + return new Results(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Outcome extends StringEnum { + /** The value {@code "enabled"}. */ + public static final Outcome ENABLED = new Outcome("enabled"); + + /** The value {@code "screened_and_enabled"}. */ + public static final Outcome SCREENED_AND_ENABLED = new Outcome("screened_and_enabled"); + + /** The value {@code "already_enabled"}. */ + public static final Outcome ALREADY_ENABLED = new Outcome("already_enabled"); + + /** The value {@code "disabled"}. */ + public static final Outcome DISABLED = new Outcome("disabled"); + + /** The value {@code "skipped_no_identity_data"}. */ + public static final Outcome SKIPPED_NO_IDENTITY_DATA = new Outcome("skipped_no_identity_data"); + + /** The value {@code "skipped_blocked"}. */ + public static final Outcome SKIPPED_BLOCKED = new Outcome("skipped_blocked"); + + /** The value {@code "skipped_sandbox"}. */ + public static final Outcome SKIPPED_SANDBOX = new Outcome("skipped_sandbox"); + + /** The value {@code "failed_provider"}. */ + public static final Outcome FAILED_PROVIDER = new Outcome("failed_provider"); + + /** The value {@code "failed_insufficient_balance"}. */ + public static final Outcome FAILED_INSUFFICIENT_BALANCE = new Outcome("failed_insufficient_balance"); + + private static final List KNOWN_VALUES = List.of(ENABLED, SCREENED_AND_ENABLED, ALREADY_ENABLED, DISABLED, SKIPPED_NO_IDENTITY_DATA, SKIPPED_BLOCKED, SKIPPED_SANDBOX, FAILED_PROVIDER, FAILED_INSUFFICIENT_BALANCE); + + private Outcome(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Outcome of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Outcome::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (nothing is written). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Profiles matched by the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * One-time cost of the new screenings. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Profiles matched by the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * Profiles already monitored (nothing to do when enabling; these are what disabling turns off). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Profiles whose existing AML screening will be switched to monitored (no new screening). + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Profiles without any AML screening that will be screened first (billed as a regular AML screening). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * Profiles that cannot be screened because identity data is missing. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Blocked users that will be skipped (always 0 for businesses). + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * One-time cost of the new screenings. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * Yearly monitoring cost of the profiles that will become monitored. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * Whether the organization balance covers the screening plus the first year of monitoring. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/UsersSetOngoingMonitoringParams.java b/src/main/java/me/didit/types/UsersSetOngoingMonitoringParams.java new file mode 100644 index 0000000..8f088f6 --- /dev/null +++ b/src/main/java/me/didit/types/UsersSetOngoingMonitoringParams.java @@ -0,0 +1,262 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code users.set_ongoing_monitoring}. */ +public final class UsersSetOngoingMonitoringParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("is_enabled", "estimate_only", "update_all", "filter_search", "filter_status", "filter_country", "filter_date_from", "filter_date_to", "didit_internal_id_list"); + + private UsersSetOngoingMonitoringParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersSetOngoingMonitoringParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersSetOngoingMonitoringParams fromJson(JsonNode json) { + return new UsersSetOngoingMonitoringParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * true to enable monitoring, false to disable it. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean isEnabled() { + return Json.required(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * When true, returns the cost estimate and performs no writes. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimateOnly() { + return Json.optional(json, "estimate_only", Conv.BOOLEAN); + } + + /** + * Apply to every entity of the application (scoped by the filter_* params when present). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updateAll() { + return Json.optional(json, "update_all", Conv.BOOLEAN); + } + + /** + * The filter_search field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterSearch() { + return Json.optional(json, "filter_search", Conv.STRING); + } + + /** + * The filter_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> filterStatus() { + return Json.optional(json, "filter_status", Conv.list(Conv.STRING)); + } + + /** + * The filter_country field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterCountry() { + return Json.optional(json, "filter_country", Conv.STRING); + } + + /** + * The filter_date_from field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterDateFrom() { + return Json.optional(json, "filter_date_from", Conv.DATE); + } + + /** + * The filter_date_to field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional filterDateTo() { + return Json.optional(json, "filter_date_to", Conv.DATE); + } + + /** + * Entities to toggle. Required unless update_all is true. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> diditInternalIdList() { + return Json.optional(json, "didit_internal_id_list", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersSetOngoingMonitoringParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersSetOngoingMonitoringParams from) { + super(from); + } + + /** + * true to enable monitoring, false to disable it. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * When true, returns the cost estimate and performs no writes. + * + * @param estimateOnly the value + * @return this builder + */ + public Builder estimateOnly(boolean estimateOnly) { + return set("estimate_only", Conv.BOOLEAN, estimateOnly); + } + + /** + * Apply to every entity of the application (scoped by the filter_* params when present). + * + * @param updateAll the value + * @return this builder + */ + public Builder updateAll(boolean updateAll) { + return set("update_all", Conv.BOOLEAN, updateAll); + } + + /** + * The filter_search field. + * + * @param filterSearch the value + * @return this builder + */ + public Builder filterSearch(String filterSearch) { + return set("filter_search", Conv.STRING, filterSearch); + } + + /** + * The filter_status field. + * + * @param filterStatus the value + * @return this builder + */ + public Builder filterStatus(List filterStatus) { + return set("filter_status", Conv.list(Conv.STRING), filterStatus); + } + + /** + * The filter_country field. + * + * @param filterCountry the value + * @return this builder + */ + public Builder filterCountry(String filterCountry) { + return set("filter_country", Conv.STRING, filterCountry); + } + + /** + * The filter_date_from field. + * + * @param filterDateFrom the value + * @return this builder + */ + public Builder filterDateFrom(LocalDate filterDateFrom) { + return set("filter_date_from", Conv.DATE, filterDateFrom); + } + + /** + * The filter_date_to field. + * + * @param filterDateTo the value + * @return this builder + */ + public Builder filterDateTo(LocalDate filterDateTo) { + return set("filter_date_to", Conv.DATE, filterDateTo); + } + + /** + * Entities to toggle. Required unless update_all is true. + * + * @param diditInternalIdList the value + * @return this builder + */ + public Builder diditInternalIdList(List diditInternalIdList) { + return set("didit_internal_id_list", Conv.list(Conv.STRING), diditInternalIdList); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersSetOngoingMonitoringParams} + * @throws IllegalStateException when a required field is missing + */ + public UsersSetOngoingMonitoringParams build() { + require("is_enabled", false); + return new UsersSetOngoingMonitoringParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersSetOngoingMonitoringResponse.java b/src/main/java/me/didit/types/UsersSetOngoingMonitoringResponse.java new file mode 100644 index 0000000..8786b3a --- /dev/null +++ b/src/main/java/me/didit/types/UsersSetOngoingMonitoringResponse.java @@ -0,0 +1,1932 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** + * Response of {@code users.set_ongoing_monitoring}; the shape depends on the HTTP status. + */ +public final class UsersSetOngoingMonitoringResponse extends MultiStatusResponse { + private UsersSetOngoingMonitoringResponse(int statusCode, JsonNode json) { + super(statusCode, json); + } + + /** + * Reads the response body received with {@code statusCode}. + * + * @param statusCode the HTTP status + * @param json the response body + * @return the response + */ + public static UsersSetOngoingMonitoringResponse fromResponse(int statusCode, JsonNode json) { + return new UsersSetOngoingMonitoringResponse(statusCode, json.deepCopy()); + } + + /** + * Whether the API answered 200. + * + * @return true for status 200 + */ + public boolean isOk() { + return statusCode() == 200; + } + + /** + * The body of a 200 response. + * + * @return the body, or empty for another status + */ + public Optional asOk() { + return isOk() ? Optional.of(Conv.union(UsersSetOngoingMonitoringResponse.Ok::fromJson).read(json)) : Optional.empty(); + } + + /** + * Whether the API answered 202. + * + * @return true for status 202 + */ + public boolean isAccepted() { + return statusCode() == 202; + } + + /** + * The body of a 202 response. + * + * @return the body, or empty for another status + */ + public Optional asAccepted() { + return isAccepted() ? Optional.of(Conv.model(UsersSetOngoingMonitoringResponse.Accepted::fromJson).read(json)) : Optional.empty(); + } + + /** + * + *

One of: {@code CostPreview}, {@code Variant2}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ + public static final class Ok extends JsonUnion { + private Ok(JsonNode json) { + super(json); + } + + /** + * Reads a {@code Ok} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static Ok fromJson(JsonNode json) { + return new Ok(json.deepCopy()); + } + + /** + * Wraps a {@code CostPreview} value. + * + * @param value the value + * @return the union + */ + public static Ok ofCostPreview(UsersSetOngoingMonitoringResponse.Ok.CostPreview value) { + return new Ok(Conv.model(UsersSetOngoingMonitoringResponse.Ok.CostPreview::fromJson).write(value)); + } + + /** + * Whether this value is a {@code CostPreview}. + * + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return true when it matches + */ + public boolean isCostPreview() { + return Json.hasAnyField(json, "users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + } + + /** + * Reads this value as a {@code CostPreview}. + * + * @return the value, or empty when {@link #isCostPreview()} is false + */ + public Optional asCostPreview() { + return isCostPreview() ? Optional.of(Conv.model(UsersSetOngoingMonitoringResponse.Ok.CostPreview::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static Ok ofVariant2(UsersSetOngoingMonitoringResponse.Ok.Variant2 value) { + return new Ok(Conv.model(UsersSetOngoingMonitoringResponse.Ok.Variant2::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * @return true when it matches + */ + public boolean isVariant2() { + return Json.hasAnyField(json, "job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional asVariant2() { + return isVariant2() ? Optional.of(Conv.model(UsersSetOngoingMonitoringResponse.Ok.Variant2::fromJson).read(json)) : Optional.empty(); + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class CostPreview extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private CostPreview(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CostPreview} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CostPreview fromJson(JsonNode json) { + return new CostPreview(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CostPreview}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CostPreview from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CostPreview} + */ + public CostPreview build() { + return new CostPreview(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class Variant2 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private Variant2(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant2} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant2 fromJson(JsonNode json) { + return new Variant2(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UsersSetOngoingMonitoringResponse.Ok.Variant2.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(UsersSetOngoingMonitoringResponse.Ok.Variant2.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(UsersSetOngoingMonitoringResponse.Ok.Variant2.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant2}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant2 from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersSetOngoingMonitoringResponse.Ok.Variant2.Status status) { + return set("status", Conv.enumeration(UsersSetOngoingMonitoringResponse.Ok.Variant2.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(UsersSetOngoingMonitoringResponse.Ok.Variant2.Outcomes outcomes) { + return set("outcomes", Conv.model(UsersSetOngoingMonitoringResponse.Ok.Variant2.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(UsersSetOngoingMonitoringResponse.Ok.Variant2.Estimate estimate) { + return set("estimate", Conv.model(UsersSetOngoingMonitoringResponse.Ok.Variant2.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant2} + */ + public Variant2 build() { + return new Variant2(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } + } + + public static final class Accepted extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("job_id", "status", "is_enabled", "total", "processed", "outcomes", "error", "estimate"); + + private Accepted(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Accepted} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Accepted fromJson(JsonNode json) { + return new Accepted(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The job_id field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jobId() { + return Json.optional(json, "job_id", Conv.STRING); + } + + /** + * The status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UsersSetOngoingMonitoringResponse.Accepted.Status::of)); + } + + /** + * The is_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEnabled() { + return Json.optional(json, "is_enabled", Conv.BOOLEAN); + } + + /** + * The total field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional total() { + return Json.optional(json, "total", Conv.LONG); + } + + /** + * The processed field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional processed() { + return Json.optional(json, "processed", Conv.LONG); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional outcomes() { + return Json.optional(json, "outcomes", Conv.model(UsersSetOngoingMonitoringResponse.Accepted.Outcomes::fromJson)); + } + + /** + * The error field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional error() { + return Json.optional(json, "error", Conv.STRING); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimate() { + return Json.optional(json, "estimate", Conv.model(UsersSetOngoingMonitoringResponse.Accepted.Estimate::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Accepted}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Accepted from) { + super(from); + } + + /** + * The job_id field. + * + * @param jobId the value + * @return this builder + */ + public Builder jobId(String jobId) { + return set("job_id", Conv.STRING, jobId); + } + + /** + * The status field. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersSetOngoingMonitoringResponse.Accepted.Status status) { + return set("status", Conv.enumeration(UsersSetOngoingMonitoringResponse.Accepted.Status::of), status); + } + + /** + * The is_enabled field. + * + * @param isEnabled the value + * @return this builder + */ + public Builder isEnabled(boolean isEnabled) { + return set("is_enabled", Conv.BOOLEAN, isEnabled); + } + + /** + * The total field. + * + * @param total the value + * @return this builder + */ + public Builder total(long total) { + return set("total", Conv.LONG, total); + } + + /** + * The processed field. + * + * @param processed the value + * @return this builder + */ + public Builder processed(long processed) { + return set("processed", Conv.LONG, processed); + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + * + * @param outcomes the value + * @return this builder + */ + public Builder outcomes(UsersSetOngoingMonitoringResponse.Accepted.Outcomes outcomes) { + return set("outcomes", Conv.model(UsersSetOngoingMonitoringResponse.Accepted.Outcomes::fromJson), outcomes); + } + + /** + * The error field. + * + * @param error the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder error(@Nullable String error) { + return setNullable("error", Conv.STRING, error); + } + + /** + * Cost preview. Returned directly when estimate_only is true (no writes are performed). + * + * @param estimate the value + * @return this builder + */ + public Builder estimate(UsersSetOngoingMonitoringResponse.Accepted.Estimate estimate) { + return set("estimate", Conv.model(UsersSetOngoingMonitoringResponse.Accepted.Estimate::fromJson), estimate); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Accepted} + */ + public Accepted build() { + return new Accepted(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "PROCESSING"}. */ + public static final Status PROCESSING = new Status("PROCESSING"); + + /** The value {@code "COMPLETED"}. */ + public static final Status COMPLETED = new Status("COMPLETED"); + + /** The value {@code "FAILED"}. */ + public static final Status FAILED = new Status("FAILED"); + + private static final List KNOWN_VALUES = List.of(PENDING, PROCESSING, COMPLETED, FAILED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Per-entity outcome counters. Nothing is silently skipped: every requested entity resolves to exactly one counter. + */ + public static final class Outcomes extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("enabled", "screened_and_enabled", "already_enabled", "disabled", "skipped_no_identity_data", "skipped_blocked", "skipped_sandbox", "failed_provider", "failed_insufficient_balance"); + + private Outcomes(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Outcomes} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Outcomes fromJson(JsonNode json) { + return new Outcomes(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.LONG); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional screenedAndEnabled() { + return Json.optional(json, "screened_and_enabled", Conv.LONG); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional disabled() { + return Json.optional(json, "disabled", Conv.LONG); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * Skipped: the user is blocked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * Skipped: sandbox application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedSandbox() { + return Json.optional(json, "skipped_sandbox", Conv.LONG); + } + + /** + * The screening provider call failed. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedProvider() { + return Json.optional(json, "failed_provider", Conv.LONG); + } + + /** + * Balance ran out mid-job. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedInsufficientBalance() { + return Json.optional(json, "failed_insufficient_balance", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Outcomes}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Outcomes from) { + super(from); + } + + /** + * Monitoring enabled on an existing AML screening. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(long enabled) { + return set("enabled", Conv.LONG, enabled); + } + + /** + * A new AML screening was created (billed) and monitoring enabled. + * + * @param screenedAndEnabled the value + * @return this builder + */ + public Builder screenedAndEnabled(long screenedAndEnabled) { + return set("screened_and_enabled", Conv.LONG, screenedAndEnabled); + } + + /** + * Monitoring was already active (legacy duplicate rows are consolidated). + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Monitoring disabled on every AML row of the entity. + * + * @param disabled the value + * @return this builder + */ + public Builder disabled(long disabled) { + return set("disabled", Conv.LONG, disabled); + } + + /** + * Skipped: no full name + date of birth + country available to screen. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * Skipped: the user is blocked. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * Skipped: sandbox application. + * + * @param skippedSandbox the value + * @return this builder + */ + public Builder skippedSandbox(long skippedSandbox) { + return set("skipped_sandbox", Conv.LONG, skippedSandbox); + } + + /** + * The screening provider call failed. + * + * @param failedProvider the value + * @return this builder + */ + public Builder failedProvider(long failedProvider) { + return set("failed_provider", Conv.LONG, failedProvider); + } + + /** + * Balance ran out mid-job. + * + * @param failedInsufficientBalance the value + * @return this builder + */ + public Builder failedInsufficientBalance(long failedInsufficientBalance) { + return set("failed_insufficient_balance", Conv.LONG, failedInsufficientBalance); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Outcomes} + */ + public Outcomes build() { + return new Outcomes(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + /** Cost preview. Returned directly when estimate_only is true (no writes are performed). */ + public static final class Estimate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("users_total", "already_enabled", "with_existing_aml", "needing_screening", "skipped_no_identity_data", "skipped_blocked", "estimated_screening_cost_usd", "estimated_annual_monitoring_cost_usd", "balance_sufficient"); + + private Estimate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Estimate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Estimate fromJson(JsonNode json) { + return new Estimate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Entities in the selection. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional usersTotal() { + return Json.optional(json, "users_total", Conv.LONG); + } + + /** + * The already_enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional alreadyEnabled() { + return Json.optional(json, "already_enabled", Conv.LONG); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional withExistingAml() { + return Json.optional(json, "with_existing_aml", Conv.LONG); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional needingScreening() { + return Json.optional(json, "needing_screening", Conv.LONG); + } + + /** + * The skipped_no_identity_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedNoIdentityData() { + return Json.optional(json, "skipped_no_identity_data", Conv.LONG); + } + + /** + * The skipped_blocked field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional skippedBlocked() { + return Json.optional(json, "skipped_blocked", Conv.LONG); + } + + /** + * The estimated_screening_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedScreeningCostUsd() { + return Json.optional(json, "estimated_screening_cost_usd", Conv.DOUBLE); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional estimatedAnnualMonitoringCostUsd() { + return Json.optional(json, "estimated_annual_monitoring_cost_usd", Conv.DOUBLE); + } + + /** + * The balance_sufficient field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional balanceSufficient() { + return Json.optional(json, "balance_sufficient", Conv.BOOLEAN); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Estimate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Estimate from) { + super(from); + } + + /** + * Entities in the selection. + * + * @param usersTotal the value + * @return this builder + */ + public Builder usersTotal(long usersTotal) { + return set("users_total", Conv.LONG, usersTotal); + } + + /** + * The already_enabled field. + * + * @param alreadyEnabled the value + * @return this builder + */ + public Builder alreadyEnabled(long alreadyEnabled) { + return set("already_enabled", Conv.LONG, alreadyEnabled); + } + + /** + * Entities whose existing AML screening will be switched to monitored. + * + * @param withExistingAml the value + * @return this builder + */ + public Builder withExistingAml(long withExistingAml) { + return set("with_existing_aml", Conv.LONG, withExistingAml); + } + + /** + * Entities without any AML screening that will be screened first (billed). + * + * @param needingScreening the value + * @return this builder + */ + public Builder needingScreening(long needingScreening) { + return set("needing_screening", Conv.LONG, needingScreening); + } + + /** + * The skipped_no_identity_data field. + * + * @param skippedNoIdentityData the value + * @return this builder + */ + public Builder skippedNoIdentityData(long skippedNoIdentityData) { + return set("skipped_no_identity_data", Conv.LONG, skippedNoIdentityData); + } + + /** + * The skipped_blocked field. + * + * @param skippedBlocked the value + * @return this builder + */ + public Builder skippedBlocked(long skippedBlocked) { + return set("skipped_blocked", Conv.LONG, skippedBlocked); + } + + /** + * The estimated_screening_cost_usd field. + * + * @param estimatedScreeningCostUsd the value + * @return this builder + */ + public Builder estimatedScreeningCostUsd(double estimatedScreeningCostUsd) { + return set("estimated_screening_cost_usd", Conv.DOUBLE, estimatedScreeningCostUsd); + } + + /** + * The estimated_annual_monitoring_cost_usd field. + * + * @param estimatedAnnualMonitoringCostUsd the value + * @return this builder + */ + public Builder estimatedAnnualMonitoringCostUsd(double estimatedAnnualMonitoringCostUsd) { + return set("estimated_annual_monitoring_cost_usd", Conv.DOUBLE, estimatedAnnualMonitoringCostUsd); + } + + /** + * The balance_sufficient field. + * + * @param balanceSufficient the value + * @return this builder + */ + public Builder balanceSufficient(boolean balanceSufficient) { + return set("balance_sufficient", Conv.BOOLEAN, balanceSufficient); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Estimate} + */ + public Estimate build() { + return new Estimate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + } +} diff --git a/src/main/java/me/didit/types/UsersUpdateParams.java b/src/main/java/me/didit/types/UsersUpdateParams.java new file mode 100644 index 0000000..3f5be00 --- /dev/null +++ b/src/main/java/me/didit/types/UsersUpdateParams.java @@ -0,0 +1,288 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** Parameters for {@code users.update}. */ +public final class UsersUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("full_name", "display_name", "date_of_birth", "status", "metadata", "approved_emails", "approved_phones", "issuing_states"); + + private UsersUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersUpdateParams fromJson(JsonNode json) { + return new UsersUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Full name of the user + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional fullName() { + return Json.optional(json, "full_name", Conv.STRING); + } + + /** + * Custom display name for this user + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional displayName() { + return Json.optional(json, "display_name", Conv.STRING); + } + + /** + * Date of birth in YYYY-MM-DD format + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dateOfBirth() { + return Json.optional(json, "date_of_birth", Conv.DATE); + } + + /** + * User lifecycle status. Changing it via this generic PATCH does NOT sync the system blocklist or record a status-change activity; prefer the update-status endpoint. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(UsersUpdateParams.Status::of)); + } + + /** + * Arbitrary JSON object you attach to the user. Fully replaces the existing metadata on update โ€” merge client-side if you only want to add keys. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> metadata() { + return Json.optional(json, "metadata", Conv.OBJECT); + } + + /** + * Verified email addresses for this user, e.g. ["john@example.com"]. Fully replaces the stored list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedEmails() { + return Json.optional(json, "approved_emails", Conv.list(Conv.STRING)); + } + + /** + * Verified phone numbers for this user. Fully replaces the stored list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> approvedPhones() { + return Json.optional(json, "approved_phones", Conv.list(Conv.STRING)); + } + + /** + * Issuing countries (ISO 3166-1 alpha-3), e.g. ["USA"]. Fully replaces the stored list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> issuingStates() { + return Json.optional(json, "issuing_states", Conv.list(Conv.STRING)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersUpdateParams from) { + super(from); + } + + /** + * Full name of the user + * + * @param fullName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder fullName(@Nullable String fullName) { + return setNullable("full_name", Conv.STRING, fullName); + } + + /** + * Custom display name for this user + * + * @param displayName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder displayName(@Nullable String displayName) { + return setNullable("display_name", Conv.STRING, displayName); + } + + /** + * Date of birth in YYYY-MM-DD format + * + * @param dateOfBirth the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dateOfBirth(@Nullable LocalDate dateOfBirth) { + return setNullable("date_of_birth", Conv.DATE, dateOfBirth); + } + + /** + * User lifecycle status. Changing it via this generic PATCH does NOT sync the system blocklist or record a status-change activity; prefer the update-status endpoint. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersUpdateParams.Status status) { + return set("status", Conv.enumeration(UsersUpdateParams.Status::of), status); + } + + /** + * Arbitrary JSON object you attach to the user. Fully replaces the existing metadata on update โ€” merge client-side if you only want to add keys. + * + * @param metadata the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder metadata(@Nullable Map metadata) { + return setAny("metadata", metadata); + } + + /** + * Verified email addresses for this user, e.g. ["john@example.com"]. Fully replaces the stored list. + * + * @param approvedEmails the value + * @return this builder + */ + public Builder approvedEmails(List approvedEmails) { + return set("approved_emails", Conv.list(Conv.STRING), approvedEmails); + } + + /** + * Verified phone numbers for this user. Fully replaces the stored list. + * + * @param approvedPhones the value + * @return this builder + */ + public Builder approvedPhones(List approvedPhones) { + return set("approved_phones", Conv.list(Conv.STRING), approvedPhones); + } + + /** + * Issuing countries (ISO 3166-1 alpha-3), e.g. ["USA"]. Fully replaces the stored list. + * + * @param issuingStates the value + * @return this builder + */ + public Builder issuingStates(List issuingStates) { + return set("issuing_states", Conv.list(Conv.STRING), issuingStates); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersUpdateParams} + */ + public UsersUpdateParams build() { + return new UsersUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * User lifecycle status. Changing it via this generic PATCH does NOT sync the system blocklist or record a status-change activity; prefer the update-status endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/UsersUpdateStatusParams.java b/src/main/java/me/didit/types/UsersUpdateStatusParams.java new file mode 100644 index 0000000..e37c6fe --- /dev/null +++ b/src/main/java/me/didit/types/UsersUpdateStatusParams.java @@ -0,0 +1,147 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code users.update_status}. */ +public final class UsersUpdateStatusParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("status"); + + private UsersUpdateStatusParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersUpdateStatusParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersUpdateStatusParams fromJson(JsonNode json) { + return new UsersUpdateStatusParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * New lifecycle status. BLOCKED also adds the vendor_data to the system blocklist. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public UsersUpdateStatusParams.Status status() { + return Json.required(json, "status", Conv.enumeration(UsersUpdateStatusParams.Status::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersUpdateStatusParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersUpdateStatusParams from) { + super(from); + } + + /** + * New lifecycle status. BLOCKED also adds the vendor_data to the system blocklist. + * + * @param status the value + * @return this builder + */ + public Builder status(UsersUpdateStatusParams.Status status) { + return set("status", Conv.enumeration(UsersUpdateStatusParams.Status::of), status); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersUpdateStatusParams} + * @throws IllegalStateException when a required field is missing + */ + public UsersUpdateStatusParams build() { + require("status", false); + return new UsersUpdateStatusParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * New lifecycle status. BLOCKED also adds the vendor_data to the system blocklist. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "ACTIVE"}. */ + public static final Status ACTIVE = new Status("ACTIVE"); + + /** The value {@code "FLAGGED"}. */ + public static final Status FLAGGED = new Status("FLAGGED"); + + /** The value {@code "BLOCKED"}. */ + public static final Status BLOCKED = new Status("BLOCKED"); + + private static final List KNOWN_VALUES = List.of(ACTIVE, FLAGGED, BLOCKED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/UsersUploadFaceParams.java b/src/main/java/me/didit/types/UsersUploadFaceParams.java new file mode 100644 index 0000000..3d05859 --- /dev/null +++ b/src/main/java/me/didit/types/UsersUploadFaceParams.java @@ -0,0 +1,121 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code users.upload_face}. */ +public final class UsersUploadFaceParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("image", "comment"); + + private UsersUploadFaceParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersUploadFaceParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersUploadFaceParams fromJson(JsonNode json) { + return new UsersUploadFaceParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Raw base64-encoded JPG or PNG face image. Do not include a data:image/...;base64, prefix. Max decoded size: 2 MB. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String image() { + return Json.required(json, "image", Conv.STRING); + } + + /** + * Optional operator-visible note for the uploaded face. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersUploadFaceParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersUploadFaceParams from) { + super(from); + } + + /** + * Raw base64-encoded JPG or PNG face image. Do not include a data:image/...;base64, prefix. Max decoded size: 2 MB. + * + * @param image the value + * @return this builder + */ + public Builder image(String image) { + return set("image", Conv.STRING, image); + } + + /** + * Optional operator-visible note for the uploaded face. + * + * @param comment the value + * @return this builder + */ + public Builder comment(String comment) { + return set("comment", Conv.STRING, comment); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersUploadFaceParams} + * @throws IllegalStateException when a required field is missing + */ + public UsersUploadFaceParams build() { + require("image", false); + return new UsersUploadFaceParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/UsersUploadFaceResponse.java b/src/main/java/me/didit/types/UsersUploadFaceResponse.java new file mode 100644 index 0000000..52123e0 --- /dev/null +++ b/src/main/java/me/didit/types/UsersUploadFaceResponse.java @@ -0,0 +1,186 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class UsersUploadFaceResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "image_url", "comment", "uploaded_by", "created_at"); + + private UsersUploadFaceResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code UsersUploadFaceResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static UsersUploadFaceResponse fromJson(JsonNode json) { + return new UsersUploadFaceResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * UUID of the uploaded User face record. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String uuid() { + return Json.required(json, "uuid", Conv.STRING); + } + + /** + * Signed URL for the uploaded face image. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional imageUrl() { + return Json.optional(json, "image_url", Conv.STRING); + } + + /** + * Comment supplied when the face was uploaded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional comment() { + return Json.optional(json, "comment", Conv.STRING); + } + + /** + * Email or actor identifier of the uploader when available. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uploadedBy() { + return Json.optional(json, "uploaded_by", Conv.STRING); + } + + /** + * Upload timestamp. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public OffsetDateTime createdAt() { + return Json.required(json, "created_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link UsersUploadFaceResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(UsersUploadFaceResponse from) { + super(from); + } + + /** + * UUID of the uploaded User face record. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Signed URL for the uploaded face image. + * + * @param imageUrl the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder imageUrl(@Nullable String imageUrl) { + return setNullable("image_url", Conv.STRING, imageUrl); + } + + /** + * Comment supplied when the face was uploaded. + * + * @param comment the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder comment(@Nullable String comment) { + return setNullable("comment", Conv.STRING, comment); + } + + /** + * Email or actor identifier of the uploader when available. + * + * @param uploadedBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder uploadedBy(@Nullable String uploadedBy) { + return setNullable("uploaded_by", Conv.STRING, uploadedBy); + } + + /** + * Upload timestamp. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code UsersUploadFaceResponse} + * @throws IllegalStateException when a required field is missing + */ + public UsersUploadFaceResponse build() { + require("uuid", false); + require("image_url", true); + require("comment", true); + require("uploaded_by", true); + require("created_at", false); + return new UsersUploadFaceResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/ValidationError.java b/src/main/java/me/didit/types/ValidationError.java new file mode 100644 index 0000000..58aad14 --- /dev/null +++ b/src/main/java/me/didit/types/ValidationError.java @@ -0,0 +1,205 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; + +/** + * Validation error body. The intended envelope is a {field: ["message", ...]} map for field-level errors or a {detail: "..."} single-key envelope for business-rule errors. A handful of validators (password strength on register, code validity on verify-email) currently respond with a bare array ["message"] -- known server-side inconsistency. The schema below keeps that bare-array branch so client code generated from this spec deserializes today's responses, but new client code should treat it as the relevant field-keyed form ({password: [...]} or {code: [...]}) and the server contract will converge on that shape. + * + *

One of: {@code Variant1}, {@code Variant2}, {@code List}. Check with the {@code is...} + * methods and read with the {@code as...} methods. + */ +public final class ValidationError extends JsonUnion { + private ValidationError(JsonNode json) { + super(json); + } + + /** + * Reads a {@code ValidationError} from JSON. + * + * @param json any JSON value + * @return the union + */ + public static ValidationError fromJson(JsonNode json) { + return new ValidationError(json.deepCopy()); + } + + /** + * Wraps a {@code Variant1} value. + * + * @param value the value + * @return the union + */ + public static ValidationError ofVariant1(Map> value) { + return new ValidationError(Conv.map(Conv.list(Conv.STRING)).write(value)); + } + + /** + * Whether this value is a {@code Variant1}. + * + * @return true when it matches + */ + public boolean isVariant1() { + return json.isObject(); + } + + /** + * Reads this value as a {@code Variant1}. + * + * @return the value, or empty when {@link #isVariant1()} is false + */ + public Optional>> asVariant1() { + return isVariant1() ? Optional.of(Conv.map(Conv.list(Conv.STRING)).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code Variant2} value. + * + * @param value the value + * @return the union + */ + public static ValidationError ofVariant2(ValidationError.Variant2 value) { + return new ValidationError(Conv.model(ValidationError.Variant2::fromJson).write(value)); + } + + /** + * Whether this value is a {@code Variant2}. + * + * @return true when it matches + */ + public boolean isVariant2() { + return Json.hasAnyField(json, "detail"); + } + + /** + * Reads this value as a {@code Variant2}. + * + * @return the value, or empty when {@link #isVariant2()} is false + */ + public Optional asVariant2() { + return isVariant2() ? Optional.of(Conv.model(ValidationError.Variant2::fromJson).read(json)) : Optional.empty(); + } + + /** + * Wraps a {@code List} value. + * + * @param value the value + * @return the union + */ + public static ValidationError ofList(List value) { + return new ValidationError(Conv.list(Conv.STRING).write(value)); + } + + /** + * Whether this value is a {@code List}. + * + * @return true when it matches + */ + public boolean isList() { + return json.isArray(); + } + + /** + * Reads this value as a {@code List}. + * + * @return the value, or empty when {@link #isList()} is false + */ + public Optional> asList() { + return isList() ? Optional.of(Conv.list(Conv.STRING).read(json)) : Optional.empty(); + } + + public static final class Variant2 extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("detail"); + + private Variant2(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Variant2} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Variant2 fromJson(JsonNode json) { + return new Variant2(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The detail field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional detail() { + return Json.optional(json, "detail", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Variant2}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Variant2 from) { + super(from); + } + + /** + * The detail field. + * + * @param detail the value + * @return this builder + */ + public Builder detail(String detail) { + return set("detail", Conv.STRING, detail); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Variant2} + */ + public Variant2 build() { + return new Variant2(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/VaspDirectoryEntry.java b/src/main/java/me/didit/types/VaspDirectoryEntry.java new file mode 100644 index 0000000..f3f303f --- /dev/null +++ b/src/main/java/me/didit/types/VaspDirectoryEntry.java @@ -0,0 +1,357 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class VaspDirectoryEntry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "lei", "jurisdiction", "dd_status", "dd_score", "reachable_rails", "is_didit_customer", "dd_score_breakdown", "dd_assessed_at"); + + private VaspDirectoryEntry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VaspDirectoryEntry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VaspDirectoryEntry fromJson(JsonNode json) { + return new VaspDirectoryEntry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The lei field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lei() { + return Json.optional(json, "lei", Conv.STRING); + } + + /** + * The jurisdiction field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional jurisdiction() { + return Json.optional(json, "jurisdiction", Conv.STRING); + } + + /** + * The dd_status field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ddStatus() { + return Json.optional(json, "dd_status", Conv.enumeration(VaspDirectoryEntry.DdStatus::of)); + } + + /** + * The dd_score field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ddScore() { + return Json.optional(json, "dd_score", Conv.LONG); + } + + /** + * The reachable_rails field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> reachableRails() { + return Json.optional(json, "reachable_rails", Conv.list(Conv.enumeration(VaspDirectoryEntry.ReachableRails::of))); + } + + /** + * true for discoverable Didit applications (dd_status is always COMPLETED, dd_score always 0 for these); false for internal counterparty-registry rows, which carry a real due-diligence status and score. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDiditCustomer() { + return Json.optional(json, "is_didit_customer", Conv.BOOLEAN); + } + + /** + * Per-component contributions to dd_score (licensing/registry, sanctions/PEP, jurisdiction risk, on-chain analytics risk), all derived from checks Didit runs in-house. Empty for Didit-customer rows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> ddScoreBreakdown() { + return Json.optional(json, "dd_score_breakdown", Conv.map(Conv.LONG)); + } + + /** + * When the due-diligence assessment last ran. Null for Didit-customer rows. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional ddAssessedAt() { + return Json.optional(json, "dd_assessed_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VaspDirectoryEntry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VaspDirectoryEntry from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The lei field. + * + * @param lei the value + * @return this builder + */ + public Builder lei(String lei) { + return set("lei", Conv.STRING, lei); + } + + /** + * The jurisdiction field. + * + * @param jurisdiction the value + * @return this builder + */ + public Builder jurisdiction(String jurisdiction) { + return set("jurisdiction", Conv.STRING, jurisdiction); + } + + /** + * The dd_status field. + * + * @param ddStatus the value + * @return this builder + */ + public Builder ddStatus(VaspDirectoryEntry.DdStatus ddStatus) { + return set("dd_status", Conv.enumeration(VaspDirectoryEntry.DdStatus::of), ddStatus); + } + + /** + * The dd_score field. + * + * @param ddScore the value + * @return this builder + */ + public Builder ddScore(long ddScore) { + return set("dd_score", Conv.LONG, ddScore); + } + + /** + * The reachable_rails field. + * + * @param reachableRails the value + * @return this builder + */ + public Builder reachableRails(List reachableRails) { + return set("reachable_rails", Conv.list(Conv.enumeration(VaspDirectoryEntry.ReachableRails::of)), reachableRails); + } + + /** + * true for discoverable Didit applications (dd_status is always COMPLETED, dd_score always 0 for these); false for internal counterparty-registry rows, which carry a real due-diligence status and score. + * + * @param isDiditCustomer the value + * @return this builder + */ + public Builder isDiditCustomer(boolean isDiditCustomer) { + return set("is_didit_customer", Conv.BOOLEAN, isDiditCustomer); + } + + /** + * Per-component contributions to dd_score (licensing/registry, sanctions/PEP, jurisdiction risk, on-chain analytics risk), all derived from checks Didit runs in-house. Empty for Didit-customer rows. + * + * @param ddScoreBreakdown the value + * @return this builder + */ + public Builder ddScoreBreakdown(Map ddScoreBreakdown) { + return set("dd_score_breakdown", Conv.map(Conv.LONG), ddScoreBreakdown); + } + + /** + * When the due-diligence assessment last ran. Null for Didit-customer rows. + * + * @param ddAssessedAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder ddAssessedAt(@Nullable OffsetDateTime ddAssessedAt) { + return setNullable("dd_assessed_at", Conv.DATE_TIME, ddAssessedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VaspDirectoryEntry} + */ + public VaspDirectoryEntry build() { + return new VaspDirectoryEntry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class DdStatus extends StringEnum { + /** The value {@code "NOT_STARTED"}. */ + public static final DdStatus NOT_STARTED = new DdStatus("NOT_STARTED"); + + /** The value {@code "IN_PROGRESS"}. */ + public static final DdStatus IN_PROGRESS = new DdStatus("IN_PROGRESS"); + + /** The value {@code "COMPLETED"}. */ + public static final DdStatus COMPLETED = new DdStatus("COMPLETED"); + + /** The value {@code "REJECTED"}. */ + public static final DdStatus REJECTED = new DdStatus("REJECTED"); + + private static final List KNOWN_VALUES = List.of(NOT_STARTED, IN_PROGRESS, COMPLETED, REJECTED); + + private DdStatus(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static DdStatus of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, DdStatus::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ReachableRails extends StringEnum { + /** The value {@code "INTERNAL"}. */ + public static final ReachableRails INTERNAL = new ReachableRails("INTERNAL"); + + /** The value {@code "TRP"}. */ + public static final ReachableRails TRP = new ReachableRails("TRP"); + + /** The value {@code "GTR"}. */ + public static final ReachableRails GTR = new ReachableRails("GTR"); + + /** The value {@code "EMAIL"}. */ + public static final ReachableRails EMAIL = new ReachableRails("EMAIL"); + + private static final List KNOWN_VALUES = List.of(INTERNAL, TRP, GTR, EMAIL); + + private ReachableRails(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ReachableRails of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ReachableRails::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/VerifyEmailRequest.java b/src/main/java/me/didit/types/VerifyEmailRequest.java new file mode 100644 index 0000000..7a191d4 --- /dev/null +++ b/src/main/java/me/didit/types/VerifyEmailRequest.java @@ -0,0 +1,120 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class VerifyEmailRequest extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("email", "code"); + + private VerifyEmailRequest(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VerifyEmailRequest} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VerifyEmailRequest fromJson(JsonNode json) { + return new VerifyEmailRequest(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Email used during POST /programmatic/register/. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String email() { + return Json.required(json, "email", Conv.STRING); + } + + /** + * 6-character alphanumeric code from the verification email. Codes expire 10 minutes after the most recent code was sent. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String code() { + return Json.required(json, "code", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VerifyEmailRequest}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VerifyEmailRequest from) { + super(from); + } + + /** + * Email used during POST /programmatic/register/. + * + * @param email the value + * @return this builder + */ + public Builder email(String email) { + return set("email", Conv.STRING, email); + } + + /** + * 6-character alphanumeric code from the verification email. Codes expire 10 minutes after the most recent code was sent. + * + * @param code the value + * @return this builder + */ + public Builder code(String code) { + return set("code", Conv.STRING, code); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VerifyEmailRequest} + * @throws IllegalStateException when a required field is missing + */ + public VerifyEmailRequest build() { + require("email", false); + require("code", false); + return new VerifyEmailRequest(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/VerifyEmailResponse.java b/src/main/java/me/didit/types/VerifyEmailResponse.java new file mode 100644 index 0000000..8d2c2f5 --- /dev/null +++ b/src/main/java/me/didit/types/VerifyEmailResponse.java @@ -0,0 +1,178 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class VerifyEmailResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("access_token", "refresh_token", "expires_in", "organization", "application"); + + private VerifyEmailResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code VerifyEmailResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static VerifyEmailResponse fromJson(JsonNode json) { + return new VerifyEmailResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * RS256-signed JWT. Use as Authorization: Bearer <token> for Account Management endpoints on apx.didit.me/auth/v2. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional accessToken() { + return Json.optional(json, "access_token", Conv.STRING); + } + + /** + * Refresh token paired with the access token. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional refreshToken() { + return Json.optional(json, "refresh_token", Conv.STRING); + } + + /** + * Lifetime of the access token in seconds (default 86400). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional expiresIn() { + return Json.optional(json, "expires_in", Conv.LONG); + } + + /** + * Minimal organization shape returned inline by POST /programmatic/verify-email/. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional organization() { + return Json.optional(json, "organization", Conv.model(OrganizationSummary::fromJson)); + } + + /** + * Minimal application shape returned inline by POST /programmatic/verify-email/. Persist the api_key immediately. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional application() { + return Json.optional(json, "application", Conv.model(ApplicationCredentialsSummary::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link VerifyEmailResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(VerifyEmailResponse from) { + super(from); + } + + /** + * RS256-signed JWT. Use as Authorization: Bearer <token> for Account Management endpoints on apx.didit.me/auth/v2. + * + * @param accessToken the value + * @return this builder + */ + public Builder accessToken(String accessToken) { + return set("access_token", Conv.STRING, accessToken); + } + + /** + * Refresh token paired with the access token. + * + * @param refreshToken the value + * @return this builder + */ + public Builder refreshToken(String refreshToken) { + return set("refresh_token", Conv.STRING, refreshToken); + } + + /** + * Lifetime of the access token in seconds (default 86400). + * + * @param expiresIn the value + * @return this builder + */ + public Builder expiresIn(long expiresIn) { + return set("expires_in", Conv.LONG, expiresIn); + } + + /** + * Minimal organization shape returned inline by POST /programmatic/verify-email/. + * + * @param organization the value + * @return this builder + */ + public Builder organization(OrganizationSummary organization) { + return set("organization", Conv.model(OrganizationSummary::fromJson), organization); + } + + /** + * Minimal application shape returned inline by POST /programmatic/verify-email/. Persist the api_key immediately. + * + * @param application the value + * @return this builder + */ + public Builder application(ApplicationCredentialsSummary application) { + return set("application", Conv.model(ApplicationCredentialsSummary::fromJson), application); + } + + /** + * Builds the value. + * + * @return a new immutable {@code VerifyEmailResponse} + */ + public VerifyEmailResponse build() { + return new VerifyEmailResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/WalletAddressEntry.java b/src/main/java/me/didit/types/WalletAddressEntry.java new file mode 100644 index 0000000..93f7512 --- /dev/null +++ b/src/main/java/me/didit/types/WalletAddressEntry.java @@ -0,0 +1,280 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class WalletAddressEntry extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "address", "chain", "holder_vendor_data", "holder_name", "entity_type", "is_ownership_verified", "created_at", "self_declared", "travel_address"); + + private WalletAddressEntry(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletAddressEntry} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletAddressEntry fromJson(JsonNode json) { + return new WalletAddressEntry(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The wallet address. Unique per application and chain among non-deleted entries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional address() { + return Json.optional(json, "address", Conv.STRING); + } + + /** + * Free-text chain identifier, e.g. "ethereum", "bitcoin". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional chain() { + return Json.optional(json, "chain", Conv.STRING); + } + + /** + * Your internal identifier for the holder. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderVendorData() { + return Json.optional(json, "holder_vendor_data", Conv.STRING); + } + + /** + * Name of the wallet holder, used for the beneficiary name match. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderName() { + return Json.optional(json, "holder_name", Conv.STRING); + } + + /** + * Free text, defaults to "individual". + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * Read-only. Whether ownership of this address has been proven. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isOwnershipVerified() { + return Json.optional(json, "is_ownership_verified", Conv.BOOLEAN); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * Whether the entry was created as a self-declared ownership proof. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional selfDeclared() { + return Json.optional(json, "self_declared", Conv.BOOLEAN); + } + + /** + * The counterparty VASP's travel address for this wallet, if known. Lets Didit route this beneficiary's transfers over the TRP rail. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelAddress() { + return Json.optional(json, "travel_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletAddressEntry}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletAddressEntry from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The wallet address. Unique per application and chain among non-deleted entries. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * Free-text chain identifier, e.g. "ethereum", "bitcoin". + * + * @param chain the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder chain(@Nullable String chain) { + return setNullable("chain", Conv.STRING, chain); + } + + /** + * Your internal identifier for the holder. + * + * @param holderVendorData the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder holderVendorData(@Nullable String holderVendorData) { + return setNullable("holder_vendor_data", Conv.STRING, holderVendorData); + } + + /** + * Name of the wallet holder, used for the beneficiary name match. + * + * @param holderName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder holderName(@Nullable String holderName) { + return setNullable("holder_name", Conv.STRING, holderName); + } + + /** + * Free text, defaults to "individual". + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * Read-only. Whether ownership of this address has been proven. + * + * @param isOwnershipVerified the value + * @return this builder + */ + public Builder isOwnershipVerified(boolean isOwnershipVerified) { + return set("is_ownership_verified", Conv.BOOLEAN, isOwnershipVerified); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * Whether the entry was created as a self-declared ownership proof. + * + * @param selfDeclared the value + * @return this builder + */ + public Builder selfDeclared(boolean selfDeclared) { + return set("self_declared", Conv.BOOLEAN, selfDeclared); + } + + /** + * The counterparty VASP's travel address for this wallet, if known. Lets Didit route this beneficiary's transfers over the TRP rail. + * + * @param travelAddress the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder travelAddress(@Nullable String travelAddress) { + return setNullable("travel_address", Conv.STRING, travelAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletAddressEntry} + */ + public WalletAddressEntry build() { + return new WalletAddressEntry(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/WalletAddressEntryCreate.java b/src/main/java/me/didit/types/WalletAddressEntryCreate.java new file mode 100644 index 0000000..4fbe4bc --- /dev/null +++ b/src/main/java/me/didit/types/WalletAddressEntryCreate.java @@ -0,0 +1,220 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +public final class WalletAddressEntryCreate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("address", "chain", "holder_vendor_data", "holder_name", "entity_type", "self_declared", "travel_address"); + + private WalletAddressEntryCreate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletAddressEntryCreate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletAddressEntryCreate fromJson(JsonNode json) { + return new WalletAddressEntryCreate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The address field. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String address() { + return Json.required(json, "address", Conv.STRING); + } + + /** + * The chain field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional chain() { + return Json.optional(json, "chain", Conv.STRING); + } + + /** + * The holder_vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderVendorData() { + return Json.optional(json, "holder_vendor_data", Conv.STRING); + } + + /** + * The holder_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderName() { + return Json.optional(json, "holder_name", Conv.STRING); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * Write-only. When true, the entry is created already ownership-verified via a SELF_DECLARATION proof. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional selfDeclared() { + return Json.optional(json, "self_declared", Conv.BOOLEAN); + } + + /** + * Optional. The counterparty VASP's travel address for this wallet, enabling TRP routing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelAddress() { + return Json.optional(json, "travel_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletAddressEntryCreate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletAddressEntryCreate from) { + super(from); + } + + /** + * The address field. + * + * @param address the value + * @return this builder + */ + public Builder address(String address) { + return set("address", Conv.STRING, address); + } + + /** + * The chain field. + * + * @param chain the value + * @return this builder + */ + public Builder chain(String chain) { + return set("chain", Conv.STRING, chain); + } + + /** + * The holder_vendor_data field. + * + * @param holderVendorData the value + * @return this builder + */ + public Builder holderVendorData(String holderVendorData) { + return set("holder_vendor_data", Conv.STRING, holderVendorData); + } + + /** + * The holder_name field. + * + * @param holderName the value + * @return this builder + */ + public Builder holderName(String holderName) { + return set("holder_name", Conv.STRING, holderName); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * Write-only. When true, the entry is created already ownership-verified via a SELF_DECLARATION proof. + * + * @param selfDeclared the value + * @return this builder + */ + public Builder selfDeclared(boolean selfDeclared) { + return set("self_declared", Conv.BOOLEAN, selfDeclared); + } + + /** + * Optional. The counterparty VASP's travel address for this wallet, enabling TRP routing. + * + * @param travelAddress the value + * @return this builder + */ + public Builder travelAddress(String travelAddress) { + return set("travel_address", Conv.STRING, travelAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletAddressEntryCreate} + * @throws IllegalStateException when a required field is missing + */ + public WalletAddressEntryCreate build() { + require("address", false); + return new WalletAddressEntryCreate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/WalletAddressEntryUpdate.java b/src/main/java/me/didit/types/WalletAddressEntryUpdate.java new file mode 100644 index 0000000..c6c49a8 --- /dev/null +++ b/src/main/java/me/didit/types/WalletAddressEntryUpdate.java @@ -0,0 +1,161 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** + * PATCH is a partial update; the response echoes only holder_name, holder_vendor_data, entity_type, and travel_address. + */ +public final class WalletAddressEntryUpdate extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("holder_name", "holder_vendor_data", "entity_type", "travel_address"); + + private WalletAddressEntryUpdate(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletAddressEntryUpdate} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletAddressEntryUpdate fromJson(JsonNode json) { + return new WalletAddressEntryUpdate(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The holder_name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderName() { + return Json.optional(json, "holder_name", Conv.STRING); + } + + /** + * The holder_vendor_data field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional holderVendorData() { + return Json.optional(json, "holder_vendor_data", Conv.STRING); + } + + /** + * The entity_type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * The travel_address field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional travelAddress() { + return Json.optional(json, "travel_address", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletAddressEntryUpdate}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletAddressEntryUpdate from) { + super(from); + } + + /** + * The holder_name field. + * + * @param holderName the value + * @return this builder + */ + public Builder holderName(String holderName) { + return set("holder_name", Conv.STRING, holderName); + } + + /** + * The holder_vendor_data field. + * + * @param holderVendorData the value + * @return this builder + */ + public Builder holderVendorData(String holderVendorData) { + return set("holder_vendor_data", Conv.STRING, holderVendorData); + } + + /** + * The entity_type field. + * + * @param entityType the value + * @return this builder + */ + public Builder entityType(String entityType) { + return set("entity_type", Conv.STRING, entityType); + } + + /** + * The travel_address field. + * + * @param travelAddress the value + * @return this builder + */ + public Builder travelAddress(String travelAddress) { + return set("travel_address", Conv.STRING, travelAddress); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletAddressEntryUpdate} + */ + public WalletAddressEntryUpdate build() { + return new WalletAddressEntryUpdate(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/WalletScreeningResult.java b/src/main/java/me/didit/types/WalletScreeningResult.java new file mode 100644 index 0000000..501b305 --- /dev/null +++ b/src/main/java/me/didit/types/WalletScreeningResult.java @@ -0,0 +1,2515 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class WalletScreeningResult extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("provider", "screening_type", "risk_score", "severity", "status", "summary", "wallet_address", "transaction_hash", "blockchain", "block_timestamp", "total_value_usd", "fee_usd", "sender_rows", "receiver_rows", "transaction_flows", "transaction_flows_status", "transaction_flows_error", "source_of_funds", "destination_of_funds", "counterparty_connections", "network_nodes", "network_edges", "sanctions_hit", "pep_counterparty", "dominant_risk_category", "risk_factors", "raw_response", "report_signature"); + + private WalletScreeningResult(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletScreeningResult} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletScreeningResult fromJson(JsonNode json) { + return new WalletScreeningResult(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Provider that performed the screening (e.g. merklescience, crystal). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String provider() { + return Json.required(json, "provider", Conv.STRING); + } + + /** + * Always WALLET_SCREENING for this endpoint. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public WalletScreeningResult.ScreeningType screeningType() { + return Json.required(json, "screening_type", Conv.enumeration(WalletScreeningResult.ScreeningType::of)); + } + + /** + * Normalised 0-100 risk score. Higher means greater exposure to risky entities. Merkle Science grades an address 0-5, which maps to 0, 15, 35, 55, 75 or 95. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public long riskScore() { + return Json.required(json, "risk_score", Conv.LONG); + } + + /** + * Risk bucket derived from risk_score: 0-9 UNKNOWN, 10-39 LOW, 40-69 MEDIUM, 70-89 HIGH, 90-100 CRITICAL. UNKNOWN is the lowest band, not a separate no-data state: risk_score 0 (the common clean-address case) means no adverse assessment, while a non-zero score in the 1-9 range is a real but sub-LOW signal - read the risk_score, not just the band. Never treat UNKNOWN as an affirmative low-risk or clear rating; do not display it as a pass. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public WalletScreeningResult.Severity severity() { + return Json.required(json, "severity", Conv.enumeration(WalletScreeningResult.Severity::of)); + } + + /** + * Screening outcome status. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public WalletScreeningResult.Status status() { + return Json.required(json, "status", Conv.enumeration(WalletScreeningResult.Status::of)); + } + + /** + * Human-readable summary of the screening result. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String summary() { + return Json.required(json, "summary", Conv.STRING); + } + + /** + * The screened address, echoed back. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String walletAddress() { + return Json.required(json, "wallet_address", Conv.STRING); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionHash() { + return Json.optional(json, "transaction_hash", Conv.STRING); + } + + /** + * The blockchain that was screened. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String blockchain() { + return Json.required(json, "blockchain", Conv.STRING); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional blockTimestamp() { + return Json.optional(json, "block_timestamp", Conv.STRING); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalValueUsd() { + return Json.optional(json, "total_value_usd", Conv.DOUBLE); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional feeUsd() { + return Json.optional(json, "fee_usd", Conv.DOUBLE); + } + + /** + * Transaction screening field, shared with the result shape. Always empty on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> senderRows() { + return Json.optional(json, "sender_rows", Conv.list(Conv.OBJECT)); + } + + /** + * Transaction screening field, shared with the result shape. Always empty on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> receiverRows() { + return Json.optional(json, "receiver_rows", Conv.list(Conv.OBJECT)); + } + + /** + * Transaction screening field, shared with the result shape. Always empty on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> transactionFlows() { + return Json.optional(json, "transaction_flows", Conv.list(Conv.OBJECT)); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionFlowsStatus() { + return Json.optional(json, "transaction_flows_status", Conv.STRING); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional transactionFlowsError() { + return Json.optional(json, "transaction_flows_error", Conv.STRING); + } + + /** + * Where the address received funds from, attributed by entity. Each entry is an exposure breakdown. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List sourceOfFunds() { + return Json.required(json, "source_of_funds", Conv.list(Conv.model(WalletScreeningResult.SourceOfFunds::fromJson))); + } + + /** + * Where the address sent funds to, attributed by entity. Same item shape as source_of_funds with exposure_direction = outgoing. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List destinationOfFunds() { + return Json.required(json, "destination_of_funds", Conv.list(Conv.model(WalletScreeningResult.DestinationOfFunds::fromJson))); + } + + /** + * Entities the provider attributes the screened address to. For Merkle Science these come from the address's own owner and user tags, so the same entity can appear twice, and they carry no fund flows: received_usd, sent_usd, received_hops and sent_hops are null and percentage is 0. Do not route on risk_level or is_direct here: use sanctions_hit, dominant_risk_category and risk_factors[].is_high_risk for the verdict, and exposure_type in source_of_funds/destination_of_funds for directness. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public List counterpartyConnections() { + return Json.required(json, "counterparty_connections", Conv.list(Conv.model(WalletScreeningResult.CounterpartyConnections::fromJson))); + } + + /** + * Exposure graph nodes for transaction screening. Empty on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> networkNodes() { + return Json.optional(json, "network_nodes", Conv.list(Conv.OBJECT)); + } + + /** + * Exposure graph edges for transaction screening. Empty on a wallet screening result. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional>> networkEdges() { + return Json.optional(json, "network_edges", Conv.list(Conv.OBJECT)); + } + + /** + * True if the address has direct or indirect sanctions exposure. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public boolean sanctionsHit() { + return Json.required(json, "sanctions_hit", Conv.BOOLEAN); + } + + /** + * Politically exposed person exposure. null when no PEP finding is available, which is every result today because no provider reports one; false only for an explicit negative screening result. Do not read null as a completed PEP check. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional pepCounterparty() { + return Json.optional(json, "pep_counterparty", Conv.BOOLEAN); + } + + /** + * Highest-weighted high-risk category, or null when none is dominant (e.g. sanctioned, mixer, stolen_funds). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional dominantRiskCategory() { + return Json.optional(json, "dominant_risk_category", Conv.STRING); + } + + /** + * Ranked explanation of risk_score: what produced this verdict. Providers grade an address on their own model and return only a verdict (Merkle Science returns an integer 0-5), so the score alone is not actionable. Ordered high-risk first, then by the value that moved through each driver, capped at the five strongest; source_of_funds and destination_of_funds always carry the complete breakdown. A high risk_score with no is_high_risk entry means the provider reported no sanctions or attributed-entity match and graded the address purely on its own exposure model - summary states this explicitly. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> riskFactors() { + return Json.optional(json, "risk_factors", Conv.list(Conv.model(WalletScreeningResult.RiskFactors::fromJson))); + } + + /** + * The provider's own payload. Its shape is provider-specific and can change without notice: read the normalised fields instead of parsing it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> rawResponse() { + return Json.optional(json, "raw_response", Conv.OBJECT); + } + + /** + * Opaque HMAC-SHA256 signature over this exact result, scoped to your application. Not meaningful on its own โ€” repost the full response body, unmodified and including this field, to POST /v3/wallet-screening/pdf/ to render it as a PDF. The PDF endpoint rejects the request with 400 if report_signature is missing or if any signed field (e.g. risk_score, severity, sanctions_hit) was edited before repost. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String reportSignature() { + return Json.required(json, "report_signature", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletScreeningResult}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletScreeningResult from) { + super(from); + } + + /** + * Provider that performed the screening (e.g. merklescience, crystal). + * + * @param provider the value + * @return this builder + */ + public Builder provider(String provider) { + return set("provider", Conv.STRING, provider); + } + + /** + * Always WALLET_SCREENING for this endpoint. + * + * @param screeningType the value + * @return this builder + */ + public Builder screeningType(WalletScreeningResult.ScreeningType screeningType) { + return set("screening_type", Conv.enumeration(WalletScreeningResult.ScreeningType::of), screeningType); + } + + /** + * Normalised 0-100 risk score. Higher means greater exposure to risky entities. Merkle Science grades an address 0-5, which maps to 0, 15, 35, 55, 75 or 95. + * + * @param riskScore the value + * @return this builder + */ + public Builder riskScore(long riskScore) { + return set("risk_score", Conv.LONG, riskScore); + } + + /** + * Risk bucket derived from risk_score: 0-9 UNKNOWN, 10-39 LOW, 40-69 MEDIUM, 70-89 HIGH, 90-100 CRITICAL. UNKNOWN is the lowest band, not a separate no-data state: risk_score 0 (the common clean-address case) means no adverse assessment, while a non-zero score in the 1-9 range is a real but sub-LOW signal - read the risk_score, not just the band. Never treat UNKNOWN as an affirmative low-risk or clear rating; do not display it as a pass. + * + * @param severity the value + * @return this builder + */ + public Builder severity(WalletScreeningResult.Severity severity) { + return set("severity", Conv.enumeration(WalletScreeningResult.Severity::of), severity); + } + + /** + * Screening outcome status. + * + * @param status the value + * @return this builder + */ + public Builder status(WalletScreeningResult.Status status) { + return set("status", Conv.enumeration(WalletScreeningResult.Status::of), status); + } + + /** + * Human-readable summary of the screening result. + * + * @param summary the value + * @return this builder + */ + public Builder summary(String summary) { + return set("summary", Conv.STRING, summary); + } + + /** + * The screened address, echoed back. + * + * @param walletAddress the value + * @return this builder + */ + public Builder walletAddress(String walletAddress) { + return set("wallet_address", Conv.STRING, walletAddress); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @param transactionHash the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder transactionHash(@Nullable String transactionHash) { + return setNullable("transaction_hash", Conv.STRING, transactionHash); + } + + /** + * The blockchain that was screened. + * + * @param blockchain the value + * @return this builder + */ + public Builder blockchain(String blockchain) { + return set("blockchain", Conv.STRING, blockchain); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @param blockTimestamp the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder blockTimestamp(@Nullable String blockTimestamp) { + return setNullable("block_timestamp", Conv.STRING, blockTimestamp); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @param totalValueUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder totalValueUsd(@Nullable Double totalValueUsd) { + return setNullable("total_value_usd", Conv.DOUBLE, totalValueUsd); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @param feeUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder feeUsd(@Nullable Double feeUsd) { + return setNullable("fee_usd", Conv.DOUBLE, feeUsd); + } + + /** + * Transaction screening field, shared with the result shape. Always empty on a wallet screening result. + * + * @param senderRows the value + * @return this builder + */ + public Builder senderRows(List> senderRows) { + return setAny("sender_rows", senderRows); + } + + /** + * Transaction screening field, shared with the result shape. Always empty on a wallet screening result. + * + * @param receiverRows the value + * @return this builder + */ + public Builder receiverRows(List> receiverRows) { + return setAny("receiver_rows", receiverRows); + } + + /** + * Transaction screening field, shared with the result shape. Always empty on a wallet screening result. + * + * @param transactionFlows the value + * @return this builder + */ + public Builder transactionFlows(List> transactionFlows) { + return setAny("transaction_flows", transactionFlows); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @param transactionFlowsStatus the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder transactionFlowsStatus(@Nullable String transactionFlowsStatus) { + return setNullable("transaction_flows_status", Conv.STRING, transactionFlowsStatus); + } + + /** + * Transaction screening field, shared with the result shape. Always null on a wallet screening result. + * + * @param transactionFlowsError the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder transactionFlowsError(@Nullable String transactionFlowsError) { + return setNullable("transaction_flows_error", Conv.STRING, transactionFlowsError); + } + + /** + * Where the address received funds from, attributed by entity. Each entry is an exposure breakdown. + * + * @param sourceOfFunds the value + * @return this builder + */ + public Builder sourceOfFunds(List sourceOfFunds) { + return set("source_of_funds", Conv.list(Conv.model(WalletScreeningResult.SourceOfFunds::fromJson)), sourceOfFunds); + } + + /** + * Where the address sent funds to, attributed by entity. Same item shape as source_of_funds with exposure_direction = outgoing. + * + * @param destinationOfFunds the value + * @return this builder + */ + public Builder destinationOfFunds(List destinationOfFunds) { + return set("destination_of_funds", Conv.list(Conv.model(WalletScreeningResult.DestinationOfFunds::fromJson)), destinationOfFunds); + } + + /** + * Entities the provider attributes the screened address to. For Merkle Science these come from the address's own owner and user tags, so the same entity can appear twice, and they carry no fund flows: received_usd, sent_usd, received_hops and sent_hops are null and percentage is 0. Do not route on risk_level or is_direct here: use sanctions_hit, dominant_risk_category and risk_factors[].is_high_risk for the verdict, and exposure_type in source_of_funds/destination_of_funds for directness. + * + * @param counterpartyConnections the value + * @return this builder + */ + public Builder counterpartyConnections(List counterpartyConnections) { + return set("counterparty_connections", Conv.list(Conv.model(WalletScreeningResult.CounterpartyConnections::fromJson)), counterpartyConnections); + } + + /** + * Exposure graph nodes for transaction screening. Empty on a wallet screening result. + * + * @param networkNodes the value + * @return this builder + */ + public Builder networkNodes(List> networkNodes) { + return setAny("network_nodes", networkNodes); + } + + /** + * Exposure graph edges for transaction screening. Empty on a wallet screening result. + * + * @param networkEdges the value + * @return this builder + */ + public Builder networkEdges(List> networkEdges) { + return setAny("network_edges", networkEdges); + } + + /** + * True if the address has direct or indirect sanctions exposure. + * + * @param sanctionsHit the value + * @return this builder + */ + public Builder sanctionsHit(boolean sanctionsHit) { + return set("sanctions_hit", Conv.BOOLEAN, sanctionsHit); + } + + /** + * Politically exposed person exposure. null when no PEP finding is available, which is every result today because no provider reports one; false only for an explicit negative screening result. Do not read null as a completed PEP check. + * + * @param pepCounterparty the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder pepCounterparty(@Nullable Boolean pepCounterparty) { + return setNullable("pep_counterparty", Conv.BOOLEAN, pepCounterparty); + } + + /** + * Highest-weighted high-risk category, or null when none is dominant (e.g. sanctioned, mixer, stolen_funds). + * + * @param dominantRiskCategory the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder dominantRiskCategory(@Nullable String dominantRiskCategory) { + return setNullable("dominant_risk_category", Conv.STRING, dominantRiskCategory); + } + + /** + * Ranked explanation of risk_score: what produced this verdict. Providers grade an address on their own model and return only a verdict (Merkle Science returns an integer 0-5), so the score alone is not actionable. Ordered high-risk first, then by the value that moved through each driver, capped at the five strongest; source_of_funds and destination_of_funds always carry the complete breakdown. A high risk_score with no is_high_risk entry means the provider reported no sanctions or attributed-entity match and graded the address purely on its own exposure model - summary states this explicitly. + * + * @param riskFactors the value + * @return this builder + */ + public Builder riskFactors(List riskFactors) { + return set("risk_factors", Conv.list(Conv.model(WalletScreeningResult.RiskFactors::fromJson)), riskFactors); + } + + /** + * The provider's own payload. Its shape is provider-specific and can change without notice: read the normalised fields instead of parsing it. + * + * @param rawResponse the value + * @return this builder + */ + public Builder rawResponse(Map rawResponse) { + return setAny("raw_response", rawResponse); + } + + /** + * Opaque HMAC-SHA256 signature over this exact result, scoped to your application. Not meaningful on its own โ€” repost the full response body, unmodified and including this field, to POST /v3/wallet-screening/pdf/ to render it as a PDF. The PDF endpoint rejects the request with 400 if report_signature is missing or if any signed field (e.g. risk_score, severity, sanctions_hit) was edited before repost. + * + * @param reportSignature the value + * @return this builder + */ + public Builder reportSignature(String reportSignature) { + return set("report_signature", Conv.STRING, reportSignature); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletScreeningResult} + * @throws IllegalStateException when a required field is missing + */ + public WalletScreeningResult build() { + require("provider", false); + require("screening_type", false); + require("risk_score", false); + require("severity", false); + require("status", false); + require("summary", false); + require("wallet_address", false); + require("blockchain", false); + require("source_of_funds", false); + require("destination_of_funds", false); + require("counterparty_connections", false); + require("sanctions_hit", false); + require("dominant_risk_category", true); + require("report_signature", false); + return new WalletScreeningResult(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Always WALLET_SCREENING for this endpoint. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ScreeningType extends StringEnum { + /** The value {@code "WALLET_SCREENING"}. */ + public static final ScreeningType WALLET_SCREENING = new ScreeningType("WALLET_SCREENING"); + + private static final List KNOWN_VALUES = List.of(WALLET_SCREENING); + + private ScreeningType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ScreeningType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ScreeningType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Risk bucket derived from risk_score: 0-9 UNKNOWN, 10-39 LOW, 40-69 MEDIUM, 70-89 HIGH, 90-100 CRITICAL. UNKNOWN is the lowest band, not a separate no-data state: risk_score 0 (the common clean-address case) means no adverse assessment, while a non-zero score in the 1-9 range is a real but sub-LOW signal - read the risk_score, not just the band. Never treat UNKNOWN as an affirmative low-risk or clear rating; do not display it as a pass. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Severity extends StringEnum { + /** The value {@code "UNKNOWN"}. */ + public static final Severity UNKNOWN = new Severity("UNKNOWN"); + + /** The value {@code "LOW"}. */ + public static final Severity LOW = new Severity("LOW"); + + /** The value {@code "MEDIUM"}. */ + public static final Severity MEDIUM = new Severity("MEDIUM"); + + /** The value {@code "HIGH"}. */ + public static final Severity HIGH = new Severity("HIGH"); + + /** The value {@code "CRITICAL"}. */ + public static final Severity CRITICAL = new Severity("CRITICAL"); + + private static final List KNOWN_VALUES = List.of(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL); + + private Severity(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Severity of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Severity::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Screening outcome status. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "SCREENED"}. */ + public static final Status SCREENED = new Status("SCREENED"); + + /** The value {@code "PENDING"}. */ + public static final Status PENDING = new Status("PENDING"); + + /** The value {@code "ERROR"}. */ + public static final Status ERROR = new Status("ERROR"); + + private static final List KNOWN_VALUES = List.of(SCREENED, PENDING, ERROR); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class SourceOfFunds extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("category", "percentage", "amount_usd", "entity_name", "entity_type", "entity_subtype", "hops", "description", "is_direct", "exposure_direction", "exposure_type", "provider_entity_id", "provider_entity_type_id", "provider_entity_subtype_id", "country", "raw_amount", "raw_currency"); + + private SourceOfFunds(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code SourceOfFunds} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static SourceOfFunds fromJson(JsonNode json) { + return new SourceOfFunds(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Normalised risk category, e.g. exchange_licensed, dex, defi, payment_processor, mixer, darknet_market, sanctioned, stolen_funds, high_risk_exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * Share of the direction's total exposure, 0-100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional percentage() { + return Json.optional(json, "percentage", Conv.DOUBLE); + } + + /** + * USD value attributed to this entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amountUsd() { + return Json.optional(json, "amount_usd", Conv.DOUBLE); + } + + /** + * Name of the attributed entity, for example an exchange, a mixer or a sanctioned group. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityName() { + return Json.optional(json, "entity_name", Conv.STRING); + } + + /** + * Provider entity type (e.g. Exchange, DeFi, Sanctions, Theft). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * More granular subtype (e.g. Mandatory KYC and AML, OFAC, Yield Aggregator). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entitySubtype() { + return Json.optional(json, "entity_subtype", Conv.STRING); + } + + /** + * Number of hops to the entity (1 for a direct counterparty), when the provider reports one. Always null for Merkle Science, which reports only whether exposure is direct or indirect: use exposure_type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hops() { + return Json.optional(json, "hops", Conv.LONG); + } + + /** + * entity_type / entity_subtype, as the provider labels the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * True when exposure_type is direct. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDirect() { + return Json.optional(json, "is_direct", Conv.BOOLEAN); + } + + /** + * Whether the funds came from (incoming) or went to (outgoing) this entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exposureDirection() { + return Json.optional(json, "exposure_direction", Conv.enumeration(WalletScreeningResult.SourceOfFunds.ExposureDirection::of)); + } + + /** + * direct (1 hop) or indirect (multi-hop) exposure. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exposureType() { + return Json.optional(json, "exposure_type", Conv.enumeration(WalletScreeningResult.SourceOfFunds.ExposureType::of)); + } + + /** + * The provider's own identifier for the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntityId() { + return Json.optional(json, "provider_entity_id", Conv.STRING); + } + + /** + * The provider's own identifier for entity_type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntityTypeId() { + return Json.optional(json, "provider_entity_type_id", Conv.STRING); + } + + /** + * The provider's own identifier for entity_subtype. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntitySubtypeId() { + return Json.optional(json, "provider_entity_subtype_id", Conv.STRING); + } + + /** + * Primary ISO 3166-1 alpha-2 country of the entity. Empty or null when the provider does not know it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Amount in the asset's own unit, when the provider reports it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rawAmount() { + return Json.optional(json, "raw_amount", Conv.DOUBLE); + } + + /** + * Unit of raw_amount, when the provider reports it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rawCurrency() { + return Json.optional(json, "raw_currency", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link SourceOfFunds}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(SourceOfFunds from) { + super(from); + } + + /** + * Normalised risk category, e.g. exchange_licensed, dex, defi, payment_processor, mixer, darknet_market, sanctioned, stolen_funds, high_risk_exchange. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * Share of the direction's total exposure, 0-100. + * + * @param percentage the value + * @return this builder + */ + public Builder percentage(double percentage) { + return set("percentage", Conv.DOUBLE, percentage); + } + + /** + * USD value attributed to this entity. + * + * @param amountUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amountUsd(@Nullable Double amountUsd) { + return setNullable("amount_usd", Conv.DOUBLE, amountUsd); + } + + /** + * Name of the attributed entity, for example an exchange, a mixer or a sanctioned group. + * + * @param entityName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityName(@Nullable String entityName) { + return setNullable("entity_name", Conv.STRING, entityName); + } + + /** + * Provider entity type (e.g. Exchange, DeFi, Sanctions, Theft). + * + * @param entityType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityType(@Nullable String entityType) { + return setNullable("entity_type", Conv.STRING, entityType); + } + + /** + * More granular subtype (e.g. Mandatory KYC and AML, OFAC, Yield Aggregator). + * + * @param entitySubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entitySubtype(@Nullable String entitySubtype) { + return setNullable("entity_subtype", Conv.STRING, entitySubtype); + } + + /** + * Number of hops to the entity (1 for a direct counterparty), when the provider reports one. Always null for Merkle Science, which reports only whether exposure is direct or indirect: use exposure_type. + * + * @param hops the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder hops(@Nullable Long hops) { + return setNullable("hops", Conv.LONG, hops); + } + + /** + * entity_type / entity_subtype, as the provider labels the entity. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * True when exposure_type is direct. + * + * @param isDirect the value + * @return this builder + */ + public Builder isDirect(boolean isDirect) { + return set("is_direct", Conv.BOOLEAN, isDirect); + } + + /** + * Whether the funds came from (incoming) or went to (outgoing) this entity. + * + * @param exposureDirection the value + * @return this builder + */ + public Builder exposureDirection(WalletScreeningResult.SourceOfFunds.ExposureDirection exposureDirection) { + return set("exposure_direction", Conv.enumeration(WalletScreeningResult.SourceOfFunds.ExposureDirection::of), exposureDirection); + } + + /** + * direct (1 hop) or indirect (multi-hop) exposure. + * + * @param exposureType the value + * @return this builder + */ + public Builder exposureType(WalletScreeningResult.SourceOfFunds.ExposureType exposureType) { + return set("exposure_type", Conv.enumeration(WalletScreeningResult.SourceOfFunds.ExposureType::of), exposureType); + } + + /** + * The provider's own identifier for the entity. + * + * @param providerEntityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntityId(@Nullable String providerEntityId) { + return setNullable("provider_entity_id", Conv.STRING, providerEntityId); + } + + /** + * The provider's own identifier for entity_type. + * + * @param providerEntityTypeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntityTypeId(@Nullable String providerEntityTypeId) { + return setNullable("provider_entity_type_id", Conv.STRING, providerEntityTypeId); + } + + /** + * The provider's own identifier for entity_subtype. + * + * @param providerEntitySubtypeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntitySubtypeId(@Nullable String providerEntitySubtypeId) { + return setNullable("provider_entity_subtype_id", Conv.STRING, providerEntitySubtypeId); + } + + /** + * Primary ISO 3166-1 alpha-2 country of the entity. Empty or null when the provider does not know it. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Amount in the asset's own unit, when the provider reports it. + * + * @param rawAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rawAmount(@Nullable Double rawAmount) { + return setNullable("raw_amount", Conv.DOUBLE, rawAmount); + } + + /** + * Unit of raw_amount, when the provider reports it. + * + * @param rawCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rawCurrency(@Nullable String rawCurrency) { + return setNullable("raw_currency", Conv.STRING, rawCurrency); + } + + /** + * Builds the value. + * + * @return a new immutable {@code SourceOfFunds} + */ + public SourceOfFunds build() { + return new SourceOfFunds(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the funds came from (incoming) or went to (outgoing) this entity. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExposureDirection extends StringEnum { + /** The value {@code "incoming"}. */ + public static final ExposureDirection INCOMING = new ExposureDirection("incoming"); + + /** The value {@code "outgoing"}. */ + public static final ExposureDirection OUTGOING = new ExposureDirection("outgoing"); + + /** The value {@code "connected"}. */ + public static final ExposureDirection CONNECTED = new ExposureDirection("connected"); + + private static final List KNOWN_VALUES = List.of(INCOMING, OUTGOING, CONNECTED); + + private ExposureDirection(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExposureDirection of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExposureDirection::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * direct (1 hop) or indirect (multi-hop) exposure. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExposureType extends StringEnum { + /** The value {@code "direct"}. */ + public static final ExposureType DIRECT = new ExposureType("direct"); + + /** The value {@code "indirect"}. */ + public static final ExposureType INDIRECT = new ExposureType("indirect"); + + private static final List KNOWN_VALUES = List.of(DIRECT, INDIRECT); + + private ExposureType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExposureType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExposureType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class DestinationOfFunds extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("category", "percentage", "amount_usd", "entity_name", "entity_type", "entity_subtype", "hops", "description", "is_direct", "exposure_direction", "exposure_type", "provider_entity_id", "provider_entity_type_id", "provider_entity_subtype_id", "country", "raw_amount", "raw_currency"); + + private DestinationOfFunds(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code DestinationOfFunds} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static DestinationOfFunds fromJson(JsonNode json) { + return new DestinationOfFunds(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Normalised risk category, e.g. exchange_licensed, dex, defi, payment_processor, mixer, darknet_market, sanctioned, stolen_funds, high_risk_exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * Share of the direction's total exposure, 0-100. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional percentage() { + return Json.optional(json, "percentage", Conv.DOUBLE); + } + + /** + * USD value attributed to this entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amountUsd() { + return Json.optional(json, "amount_usd", Conv.DOUBLE); + } + + /** + * Name of the attributed entity, for example an exchange, a mixer or a sanctioned group. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityName() { + return Json.optional(json, "entity_name", Conv.STRING); + } + + /** + * Provider entity type (e.g. Exchange, DeFi, Sanctions, Theft). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * More granular subtype (e.g. Mandatory KYC and AML, OFAC, Yield Aggregator). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entitySubtype() { + return Json.optional(json, "entity_subtype", Conv.STRING); + } + + /** + * Number of hops to the entity (1 for a direct counterparty), when the provider reports one. Always null for Merkle Science, which reports only whether exposure is direct or indirect: use exposure_type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hops() { + return Json.optional(json, "hops", Conv.LONG); + } + + /** + * entity_type / entity_subtype, as the provider labels the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + /** + * True when exposure_type is direct. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDirect() { + return Json.optional(json, "is_direct", Conv.BOOLEAN); + } + + /** + * Whether the funds came from (incoming) or went to (outgoing) this entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exposureDirection() { + return Json.optional(json, "exposure_direction", Conv.enumeration(WalletScreeningResult.DestinationOfFunds.ExposureDirection::of)); + } + + /** + * direct (1 hop) or indirect (multi-hop) exposure. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exposureType() { + return Json.optional(json, "exposure_type", Conv.enumeration(WalletScreeningResult.DestinationOfFunds.ExposureType::of)); + } + + /** + * The provider's own identifier for the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntityId() { + return Json.optional(json, "provider_entity_id", Conv.STRING); + } + + /** + * The provider's own identifier for entity_type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntityTypeId() { + return Json.optional(json, "provider_entity_type_id", Conv.STRING); + } + + /** + * The provider's own identifier for entity_subtype. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntitySubtypeId() { + return Json.optional(json, "provider_entity_subtype_id", Conv.STRING); + } + + /** + * Primary ISO 3166-1 alpha-2 country of the entity. Empty or null when the provider does not know it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * Amount in the asset's own unit, when the provider reports it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rawAmount() { + return Json.optional(json, "raw_amount", Conv.DOUBLE); + } + + /** + * Unit of raw_amount, when the provider reports it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional rawCurrency() { + return Json.optional(json, "raw_currency", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link DestinationOfFunds}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(DestinationOfFunds from) { + super(from); + } + + /** + * Normalised risk category, e.g. exchange_licensed, dex, defi, payment_processor, mixer, darknet_market, sanctioned, stolen_funds, high_risk_exchange. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * Share of the direction's total exposure, 0-100. + * + * @param percentage the value + * @return this builder + */ + public Builder percentage(double percentage) { + return set("percentage", Conv.DOUBLE, percentage); + } + + /** + * USD value attributed to this entity. + * + * @param amountUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amountUsd(@Nullable Double amountUsd) { + return setNullable("amount_usd", Conv.DOUBLE, amountUsd); + } + + /** + * Name of the attributed entity, for example an exchange, a mixer or a sanctioned group. + * + * @param entityName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityName(@Nullable String entityName) { + return setNullable("entity_name", Conv.STRING, entityName); + } + + /** + * Provider entity type (e.g. Exchange, DeFi, Sanctions, Theft). + * + * @param entityType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityType(@Nullable String entityType) { + return setNullable("entity_type", Conv.STRING, entityType); + } + + /** + * More granular subtype (e.g. Mandatory KYC and AML, OFAC, Yield Aggregator). + * + * @param entitySubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entitySubtype(@Nullable String entitySubtype) { + return setNullable("entity_subtype", Conv.STRING, entitySubtype); + } + + /** + * Number of hops to the entity (1 for a direct counterparty), when the provider reports one. Always null for Merkle Science, which reports only whether exposure is direct or indirect: use exposure_type. + * + * @param hops the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder hops(@Nullable Long hops) { + return setNullable("hops", Conv.LONG, hops); + } + + /** + * entity_type / entity_subtype, as the provider labels the entity. + * + * @param description the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder description(@Nullable String description) { + return setNullable("description", Conv.STRING, description); + } + + /** + * True when exposure_type is direct. + * + * @param isDirect the value + * @return this builder + */ + public Builder isDirect(boolean isDirect) { + return set("is_direct", Conv.BOOLEAN, isDirect); + } + + /** + * Whether the funds came from (incoming) or went to (outgoing) this entity. + * + * @param exposureDirection the value + * @return this builder + */ + public Builder exposureDirection(WalletScreeningResult.DestinationOfFunds.ExposureDirection exposureDirection) { + return set("exposure_direction", Conv.enumeration(WalletScreeningResult.DestinationOfFunds.ExposureDirection::of), exposureDirection); + } + + /** + * direct (1 hop) or indirect (multi-hop) exposure. + * + * @param exposureType the value + * @return this builder + */ + public Builder exposureType(WalletScreeningResult.DestinationOfFunds.ExposureType exposureType) { + return set("exposure_type", Conv.enumeration(WalletScreeningResult.DestinationOfFunds.ExposureType::of), exposureType); + } + + /** + * The provider's own identifier for the entity. + * + * @param providerEntityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntityId(@Nullable String providerEntityId) { + return setNullable("provider_entity_id", Conv.STRING, providerEntityId); + } + + /** + * The provider's own identifier for entity_type. + * + * @param providerEntityTypeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntityTypeId(@Nullable String providerEntityTypeId) { + return setNullable("provider_entity_type_id", Conv.STRING, providerEntityTypeId); + } + + /** + * The provider's own identifier for entity_subtype. + * + * @param providerEntitySubtypeId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntitySubtypeId(@Nullable String providerEntitySubtypeId) { + return setNullable("provider_entity_subtype_id", Conv.STRING, providerEntitySubtypeId); + } + + /** + * Primary ISO 3166-1 alpha-2 country of the entity. Empty or null when the provider does not know it. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * Amount in the asset's own unit, when the provider reports it. + * + * @param rawAmount the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rawAmount(@Nullable Double rawAmount) { + return setNullable("raw_amount", Conv.DOUBLE, rawAmount); + } + + /** + * Unit of raw_amount, when the provider reports it. + * + * @param rawCurrency the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder rawCurrency(@Nullable String rawCurrency) { + return setNullable("raw_currency", Conv.STRING, rawCurrency); + } + + /** + * Builds the value. + * + * @return a new immutable {@code DestinationOfFunds} + */ + public DestinationOfFunds build() { + return new DestinationOfFunds(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Whether the funds came from (incoming) or went to (outgoing) this entity. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExposureDirection extends StringEnum { + /** The value {@code "incoming"}. */ + public static final ExposureDirection INCOMING = new ExposureDirection("incoming"); + + /** The value {@code "outgoing"}. */ + public static final ExposureDirection OUTGOING = new ExposureDirection("outgoing"); + + /** The value {@code "connected"}. */ + public static final ExposureDirection CONNECTED = new ExposureDirection("connected"); + + private static final List KNOWN_VALUES = List.of(INCOMING, OUTGOING, CONNECTED); + + private ExposureDirection(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExposureDirection of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExposureDirection::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * direct (1 hop) or indirect (multi-hop) exposure. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExposureType extends StringEnum { + /** The value {@code "direct"}. */ + public static final ExposureType DIRECT = new ExposureType("direct"); + + /** The value {@code "indirect"}. */ + public static final ExposureType INDIRECT = new ExposureType("indirect"); + + private static final List KNOWN_VALUES = List.of(DIRECT, INDIRECT); + + private ExposureType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExposureType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExposureType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } + + public static final class CounterpartyConnections extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("entity_name", "entity_type", "entity_subtype", "risk_level", "categories", "received_usd", "sent_usd", "received_hops", "sent_hops", "percentage", "is_direct", "country", "provider_entity_id"); + + private CounterpartyConnections(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CounterpartyConnections} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CounterpartyConnections fromJson(JsonNode json) { + return new CounterpartyConnections(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Attributed entity name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityName() { + return Json.optional(json, "entity_name", Conv.STRING); + } + + /** + * Provider entity type. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityType() { + return Json.optional(json, "entity_type", Conv.STRING); + } + + /** + * Provider entity subtype. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entitySubtype() { + return Json.optional(json, "entity_subtype", Conv.STRING); + } + + /** + * Lowercase and provider-dependent. For Merkle Science it is the address's own 0-5 risk grade (no_risk, low, medium_low, medium, high, critical), raised to high when the entity's category is high risk; it is not a separate grade of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional riskLevel() { + return Json.optional(json, "risk_level", Conv.STRING); + } + + /** + * Normalised risk categories of the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> categories() { + return Json.optional(json, "categories", Conv.list(Conv.STRING)); + } + + /** + * USD received from the entity, when the provider reports it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional receivedUsd() { + return Json.optional(json, "received_usd", Conv.DOUBLE); + } + + /** + * USD sent to the entity, when the provider reports it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentUsd() { + return Json.optional(json, "sent_usd", Conv.DOUBLE); + } + + /** + * Hops to the entity on the receiving side, when the provider reports them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional receivedHops() { + return Json.optional(json, "received_hops", Conv.LONG); + } + + /** + * Hops to the entity on the sending side, when the provider reports them. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sentHops() { + return Json.optional(json, "sent_hops", Conv.LONG); + } + + /** + * Share of the address's exposure, when the provider reports it; otherwise 0. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional percentage() { + return Json.optional(json, "percentage", Conv.DOUBLE); + } + + /** + * Always true for Merkle Science, whose connections are attributions rather than counterparties. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDirect() { + return Json.optional(json, "is_direct", Conv.BOOLEAN); + } + + /** + * Country of the entity, when known. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional country() { + return Json.optional(json, "country", Conv.STRING); + } + + /** + * The provider's own identifier for the entity. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional providerEntityId() { + return Json.optional(json, "provider_entity_id", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CounterpartyConnections}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CounterpartyConnections from) { + super(from); + } + + /** + * Attributed entity name. + * + * @param entityName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityName(@Nullable String entityName) { + return setNullable("entity_name", Conv.STRING, entityName); + } + + /** + * Provider entity type. + * + * @param entityType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityType(@Nullable String entityType) { + return setNullable("entity_type", Conv.STRING, entityType); + } + + /** + * Provider entity subtype. + * + * @param entitySubtype the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entitySubtype(@Nullable String entitySubtype) { + return setNullable("entity_subtype", Conv.STRING, entitySubtype); + } + + /** + * Lowercase and provider-dependent. For Merkle Science it is the address's own 0-5 risk grade (no_risk, low, medium_low, medium, high, critical), raised to high when the entity's category is high risk; it is not a separate grade of the entity. + * + * @param riskLevel the value + * @return this builder + */ + public Builder riskLevel(String riskLevel) { + return set("risk_level", Conv.STRING, riskLevel); + } + + /** + * Normalised risk categories of the entity. + * + * @param categories the value + * @return this builder + */ + public Builder categories(List categories) { + return set("categories", Conv.list(Conv.STRING), categories); + } + + /** + * USD received from the entity, when the provider reports it. + * + * @param receivedUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder receivedUsd(@Nullable Double receivedUsd) { + return setNullable("received_usd", Conv.DOUBLE, receivedUsd); + } + + /** + * USD sent to the entity, when the provider reports it. + * + * @param sentUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sentUsd(@Nullable Double sentUsd) { + return setNullable("sent_usd", Conv.DOUBLE, sentUsd); + } + + /** + * Hops to the entity on the receiving side, when the provider reports them. + * + * @param receivedHops the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder receivedHops(@Nullable Long receivedHops) { + return setNullable("received_hops", Conv.LONG, receivedHops); + } + + /** + * Hops to the entity on the sending side, when the provider reports them. + * + * @param sentHops the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder sentHops(@Nullable Long sentHops) { + return setNullable("sent_hops", Conv.LONG, sentHops); + } + + /** + * Share of the address's exposure, when the provider reports it; otherwise 0. + * + * @param percentage the value + * @return this builder + */ + public Builder percentage(double percentage) { + return set("percentage", Conv.DOUBLE, percentage); + } + + /** + * Always true for Merkle Science, whose connections are attributions rather than counterparties. + * + * @param isDirect the value + * @return this builder + */ + public Builder isDirect(boolean isDirect) { + return set("is_direct", Conv.BOOLEAN, isDirect); + } + + /** + * Country of the entity, when known. + * + * @param country the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder country(@Nullable String country) { + return setNullable("country", Conv.STRING, country); + } + + /** + * The provider's own identifier for the entity. + * + * @param providerEntityId the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder providerEntityId(@Nullable String providerEntityId) { + return setNullable("provider_entity_id", Conv.STRING, providerEntityId); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CounterpartyConnections} + */ + public CounterpartyConnections build() { + return new CounterpartyConnections(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } + + public static final class RiskFactors extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("source", "category", "label", "entity_name", "direction", "exposure_type", "amount_usd", "percentage", "is_high_risk", "description"); + + private RiskFactors(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code RiskFactors} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static RiskFactors fromJson(JsonNode json) { + return new RiskFactors(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * attribution is what the provider says the address itself is (its own tag or cluster); exposure is where its funds actually moved. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional source() { + return Json.optional(json, "source", Conv.enumeration(WalletScreeningResult.RiskFactors.Source::of)); + } + + /** + * Normalised risk category, same vocabulary as the exposure breakdown. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional category() { + return Json.optional(json, "category", Conv.STRING); + } + + /** + * The provider's own wording for the driver (e.g. Gambling / Crypto only), which is what you would also see in the provider's console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * Attributed entity behind the driver, for example a gambling site or an exchange. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional entityName() { + return Json.optional(json, "entity_name", Conv.STRING); + } + + /** + * Direction of the fund flow, attribution when the driver is the address's own tag, or unknown when the provider did not report a direction. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional direction() { + return Json.optional(json, "direction", Conv.enumeration(WalletScreeningResult.RiskFactors.Direction::of)); + } + + /** + * direct (1 hop) or indirect (multi-hop), attribution for the address's own tag, or unknown when the provider did not state how many hops away the counterparty is. Treat unknown as unclassified, not as direct. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional exposureType() { + return Json.optional(json, "exposure_type", Conv.enumeration(WalletScreeningResult.RiskFactors.ExposureType::of)); + } + + /** + * USD value attributed to this driver. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional amountUsd() { + return Json.optional(json, "amount_usd", Conv.DOUBLE); + } + + /** + * Share of the address's TOTAL screened volume, both directions combined - unlike percentage inside source_of_funds/destination_of_funds, which is normalised per direction. Comparable and summable across the whole list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional percentage() { + return Json.optional(json, "percentage", Conv.DOUBLE); + } + + /** + * Whether the category is one Didit treats as high risk (sanctioned, mixer, stolen_funds, ransomware, scam, darknet_market, terrorist_financing, child_exploitation, hacked_exchange, high_risk_exchange, seized_funds). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isHighRisk() { + return Json.optional(json, "is_high_risk", Conv.BOOLEAN); + } + + /** + * One-line rendering of the driver, e.g. 9.01% indirect outgoing exposure to Gambling / Crypto only (Example Gambling). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional description() { + return Json.optional(json, "description", Conv.STRING); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link RiskFactors}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(RiskFactors from) { + super(from); + } + + /** + * attribution is what the provider says the address itself is (its own tag or cluster); exposure is where its funds actually moved. + * + * @param source the value + * @return this builder + */ + public Builder source(WalletScreeningResult.RiskFactors.Source source) { + return set("source", Conv.enumeration(WalletScreeningResult.RiskFactors.Source::of), source); + } + + /** + * Normalised risk category, same vocabulary as the exposure breakdown. + * + * @param category the value + * @return this builder + */ + public Builder category(String category) { + return set("category", Conv.STRING, category); + } + + /** + * The provider's own wording for the driver (e.g. Gambling / Crypto only), which is what you would also see in the provider's console. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * Attributed entity behind the driver, for example a gambling site or an exchange. + * + * @param entityName the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder entityName(@Nullable String entityName) { + return setNullable("entity_name", Conv.STRING, entityName); + } + + /** + * Direction of the fund flow, attribution when the driver is the address's own tag, or unknown when the provider did not report a direction. + * + * @param direction the value + * @return this builder + */ + public Builder direction(WalletScreeningResult.RiskFactors.Direction direction) { + return set("direction", Conv.enumeration(WalletScreeningResult.RiskFactors.Direction::of), direction); + } + + /** + * direct (1 hop) or indirect (multi-hop), attribution for the address's own tag, or unknown when the provider did not state how many hops away the counterparty is. Treat unknown as unclassified, not as direct. + * + * @param exposureType the value + * @return this builder + */ + public Builder exposureType(WalletScreeningResult.RiskFactors.ExposureType exposureType) { + return set("exposure_type", Conv.enumeration(WalletScreeningResult.RiskFactors.ExposureType::of), exposureType); + } + + /** + * USD value attributed to this driver. + * + * @param amountUsd the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder amountUsd(@Nullable Double amountUsd) { + return setNullable("amount_usd", Conv.DOUBLE, amountUsd); + } + + /** + * Share of the address's TOTAL screened volume, both directions combined - unlike percentage inside source_of_funds/destination_of_funds, which is normalised per direction. Comparable and summable across the whole list. + * + * @param percentage the value + * @return this builder + */ + public Builder percentage(double percentage) { + return set("percentage", Conv.DOUBLE, percentage); + } + + /** + * Whether the category is one Didit treats as high risk (sanctioned, mixer, stolen_funds, ransomware, scam, darknet_market, terrorist_financing, child_exploitation, hacked_exchange, high_risk_exchange, seized_funds). + * + * @param isHighRisk the value + * @return this builder + */ + public Builder isHighRisk(boolean isHighRisk) { + return set("is_high_risk", Conv.BOOLEAN, isHighRisk); + } + + /** + * One-line rendering of the driver, e.g. 9.01% indirect outgoing exposure to Gambling / Crypto only (Example Gambling). + * + * @param description the value + * @return this builder + */ + public Builder description(String description) { + return set("description", Conv.STRING, description); + } + + /** + * Builds the value. + * + * @return a new immutable {@code RiskFactors} + */ + public RiskFactors build() { + return new RiskFactors(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * attribution is what the provider says the address itself is (its own tag or cluster); exposure is where its funds actually moved. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Source extends StringEnum { + /** The value {@code "attribution"}. */ + public static final Source ATTRIBUTION = new Source("attribution"); + + /** The value {@code "exposure"}. */ + public static final Source EXPOSURE = new Source("exposure"); + + private static final List KNOWN_VALUES = List.of(ATTRIBUTION, EXPOSURE); + + private Source(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Source of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Source::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Direction of the fund flow, attribution when the driver is the address's own tag, or unknown when the provider did not report a direction. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Direction extends StringEnum { + /** The value {@code "incoming"}. */ + public static final Direction INCOMING = new Direction("incoming"); + + /** The value {@code "outgoing"}. */ + public static final Direction OUTGOING = new Direction("outgoing"); + + /** The value {@code "connected"}. */ + public static final Direction CONNECTED = new Direction("connected"); + + /** The value {@code "unknown"}. */ + public static final Direction UNKNOWN = new Direction("unknown"); + + /** The value {@code "attribution"}. */ + public static final Direction ATTRIBUTION = new Direction("attribution"); + + private static final List KNOWN_VALUES = List.of(INCOMING, OUTGOING, CONNECTED, UNKNOWN, ATTRIBUTION); + + private Direction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Direction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Direction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * direct (1 hop) or indirect (multi-hop), attribution for the address's own tag, or unknown when the provider did not state how many hops away the counterparty is. Treat unknown as unclassified, not as direct. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class ExposureType extends StringEnum { + /** The value {@code "direct"}. */ + public static final ExposureType DIRECT = new ExposureType("direct"); + + /** The value {@code "indirect"}. */ + public static final ExposureType INDIRECT = new ExposureType("indirect"); + + /** The value {@code "unknown"}. */ + public static final ExposureType UNKNOWN = new ExposureType("unknown"); + + /** The value {@code "attribution"}. */ + public static final ExposureType ATTRIBUTION = new ExposureType("attribution"); + + private static final List KNOWN_VALUES = List.of(DIRECT, INDIRECT, UNKNOWN, ATTRIBUTION); + + private ExposureType(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static ExposureType of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, ExposureType::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/WalletScreeningScreenParams.java b/src/main/java/me/didit/types/WalletScreeningScreenParams.java new file mode 100644 index 0000000..817f91b --- /dev/null +++ b/src/main/java/me/didit/types/WalletScreeningScreenParams.java @@ -0,0 +1,277 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code wallet_screening.screen}. */ +public final class WalletScreeningScreenParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("wallet_address", "blockchain", "direction"); + + private WalletScreeningScreenParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WalletScreeningScreenParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WalletScreeningScreenParams fromJson(JsonNode json) { + return new WalletScreeningScreenParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The crypto address or network identifier to screen. Must match the selected network (e.g. a 0x-prefixed 40-hex-char address for EVM chains). Alias: address. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String walletAddress() { + return Json.required(json, "wallet_address", Conv.STRING); + } + + /** + * Network identifier. Managed screening supports BTC, ETH, LTC, XRP, BCH, DOGE, TRX, SOL, MATIC, BNB, BASE (Base), OP (Optimism), and ARB (Arbitrum One). USDT and USDC are legacy Ethereum aliases, not multi-network searches. Connected-provider coverage varies. LIGHTNING requires a supported connected provider. Celo, Mode and Plume are not currently supported. Alias: currency. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public WalletScreeningScreenParams.Blockchain blockchain() { + return Json.required(json, "blockchain", Conv.enumeration(WalletScreeningScreenParams.Blockchain::of)); + } + + /** + * Optional. Whether the address is being screened as an inbound (deposit) or outbound (withdrawal) counterparty. Accepts inbound, outbound, deposit, or withdrawal. Defaults to a neutral pre-transfer screen when omitted. This is passed to the provider as context only; it does not change the returned risk_score, severity, or the source_of_funds/destination_of_funds breakdowns, which are always both returned regardless of direction. Changing or omitting direction therefore does not require re-screening an address. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional direction() { + return Json.optional(json, "direction", Conv.enumeration(WalletScreeningScreenParams.Direction::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WalletScreeningScreenParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WalletScreeningScreenParams from) { + super(from); + } + + /** + * The crypto address or network identifier to screen. Must match the selected network (e.g. a 0x-prefixed 40-hex-char address for EVM chains). Alias: address. + * + * @param walletAddress the value + * @return this builder + */ + public Builder walletAddress(String walletAddress) { + return set("wallet_address", Conv.STRING, walletAddress); + } + + /** + * Network identifier. Managed screening supports BTC, ETH, LTC, XRP, BCH, DOGE, TRX, SOL, MATIC, BNB, BASE (Base), OP (Optimism), and ARB (Arbitrum One). USDT and USDC are legacy Ethereum aliases, not multi-network searches. Connected-provider coverage varies. LIGHTNING requires a supported connected provider. Celo, Mode and Plume are not currently supported. Alias: currency. + * + * @param blockchain the value + * @return this builder + */ + public Builder blockchain(WalletScreeningScreenParams.Blockchain blockchain) { + return set("blockchain", Conv.enumeration(WalletScreeningScreenParams.Blockchain::of), blockchain); + } + + /** + * Optional. Whether the address is being screened as an inbound (deposit) or outbound (withdrawal) counterparty. Accepts inbound, outbound, deposit, or withdrawal. Defaults to a neutral pre-transfer screen when omitted. This is passed to the provider as context only; it does not change the returned risk_score, severity, or the source_of_funds/destination_of_funds breakdowns, which are always both returned regardless of direction. Changing or omitting direction therefore does not require re-screening an address. + * + * @param direction the value + * @return this builder + */ + public Builder direction(WalletScreeningScreenParams.Direction direction) { + return set("direction", Conv.enumeration(WalletScreeningScreenParams.Direction::of), direction); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WalletScreeningScreenParams} + * @throws IllegalStateException when a required field is missing + */ + public WalletScreeningScreenParams build() { + require("wallet_address", false); + require("blockchain", false); + return new WalletScreeningScreenParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Network identifier. Managed screening supports BTC, ETH, LTC, XRP, BCH, DOGE, TRX, SOL, MATIC, BNB, BASE (Base), OP (Optimism), and ARB (Arbitrum One). USDT and USDC are legacy Ethereum aliases, not multi-network searches. Connected-provider coverage varies. LIGHTNING requires a supported connected provider. Celo, Mode and Plume are not currently supported. Alias: currency. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Blockchain extends StringEnum { + /** The value {@code "BTC"}. */ + public static final Blockchain BTC = new Blockchain("BTC"); + + /** The value {@code "LIGHTNING"}. */ + public static final Blockchain LIGHTNING = new Blockchain("LIGHTNING"); + + /** The value {@code "ETH"}. */ + public static final Blockchain ETH = new Blockchain("ETH"); + + /** The value {@code "LTC"}. */ + public static final Blockchain LTC = new Blockchain("LTC"); + + /** The value {@code "XRP"}. */ + public static final Blockchain XRP = new Blockchain("XRP"); + + /** The value {@code "BCH"}. */ + public static final Blockchain BCH = new Blockchain("BCH"); + + /** The value {@code "DOGE"}. */ + public static final Blockchain DOGE = new Blockchain("DOGE"); + + /** The value {@code "TRX"}. */ + public static final Blockchain TRX = new Blockchain("TRX"); + + /** The value {@code "SOL"}. */ + public static final Blockchain SOL = new Blockchain("SOL"); + + /** The value {@code "MATIC"}. */ + public static final Blockchain MATIC = new Blockchain("MATIC"); + + /** The value {@code "BNB"}. */ + public static final Blockchain BNB = new Blockchain("BNB"); + + /** The value {@code "USDT"}. */ + public static final Blockchain USDT = new Blockchain("USDT"); + + /** The value {@code "USDC"}. */ + public static final Blockchain USDC = new Blockchain("USDC"); + + /** The value {@code "BASE"}. */ + public static final Blockchain BASE = new Blockchain("BASE"); + + /** The value {@code "OP"}. */ + public static final Blockchain OP = new Blockchain("OP"); + + /** The value {@code "ARB"}. */ + public static final Blockchain ARB = new Blockchain("ARB"); + + private static final List KNOWN_VALUES = List.of(BTC, LIGHTNING, ETH, LTC, XRP, BCH, DOGE, TRX, SOL, MATIC, BNB, USDT, USDC, BASE, OP, ARB); + + private Blockchain(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Blockchain of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Blockchain::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Optional. Whether the address is being screened as an inbound (deposit) or outbound (withdrawal) counterparty. Accepts inbound, outbound, deposit, or withdrawal. Defaults to a neutral pre-transfer screen when omitted. This is passed to the provider as context only; it does not change the returned risk_score, severity, or the source_of_funds/destination_of_funds breakdowns, which are always both returned regardless of direction. Changing or omitting direction therefore does not require re-screening an address. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Direction extends StringEnum { + /** The value {@code "inbound"}. */ + public static final Direction INBOUND = new Direction("inbound"); + + /** The value {@code "outbound"}. */ + public static final Direction OUTBOUND = new Direction("outbound"); + + /** The value {@code "deposit"}. */ + public static final Direction DEPOSIT = new Direction("deposit"); + + /** The value {@code "withdrawal"}. */ + public static final Direction WITHDRAWAL = new Direction("withdrawal"); + + private static final List KNOWN_VALUES = List.of(INBOUND, OUTBOUND, DEPOSIT, WITHDRAWAL); + + private Direction(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Direction of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Direction::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/WebhookEvent.java b/src/main/java/me/didit/types/WebhookEvent.java new file mode 100644 index 0000000..6e38886 --- /dev/null +++ b/src/main/java/me/didit/types/WebhookEvent.java @@ -0,0 +1,72 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import java.util.List; +import me.didit.core.StringEnum; + +/** + * Supported webhook event name. Use these exact strings in subscribed_events; unsupported values are rejected. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ +public final class WebhookEvent extends StringEnum { + /** The value {@code "status.updated"}. */ + public static final WebhookEvent STATUS_UPDATED = new WebhookEvent("status.updated"); + + /** The value {@code "data.updated"}. */ + public static final WebhookEvent DATA_UPDATED = new WebhookEvent("data.updated"); + + /** The value {@code "user.status.updated"}. */ + public static final WebhookEvent USER_STATUS_UPDATED = new WebhookEvent("user.status.updated"); + + /** The value {@code "user.data.updated"}. */ + public static final WebhookEvent USER_DATA_UPDATED = new WebhookEvent("user.data.updated"); + + /** The value {@code "business.status.updated"}. */ + public static final WebhookEvent BUSINESS_STATUS_UPDATED = new WebhookEvent("business.status.updated"); + + /** The value {@code "business.data.updated"}. */ + public static final WebhookEvent BUSINESS_DATA_UPDATED = new WebhookEvent("business.data.updated"); + + /** The value {@code "activity.created"}. */ + public static final WebhookEvent ACTIVITY_CREATED = new WebhookEvent("activity.created"); + + /** The value {@code "transaction.created"}. */ + public static final WebhookEvent TRANSACTION_CREATED = new WebhookEvent("transaction.created"); + + /** The value {@code "transaction.status.updated"}. */ + public static final WebhookEvent TRANSACTION_STATUS_UPDATED = new WebhookEvent("transaction.status.updated"); + + /** The value {@code "travel_rule.status.updated"}. */ + public static final WebhookEvent TRAVEL_RULE_STATUS_UPDATED = new WebhookEvent("travel_rule.status.updated"); + + private static final List KNOWN_VALUES = List.of(STATUS_UPDATED, DATA_UPDATED, USER_STATUS_UPDATED, USER_DATA_UPDATED, BUSINESS_STATUS_UPDATED, BUSINESS_DATA_UPDATED, ACTIVITY_CREATED, TRANSACTION_CREATED, TRANSACTION_STATUS_UPDATED, TRAVEL_RULE_STATUS_UPDATED); + + private WebhookEvent(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookEvent of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookEvent::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } +} diff --git a/src/main/java/me/didit/types/WebhooksDestinationsCreateParams.java b/src/main/java/me/didit/types/WebhooksDestinationsCreateParams.java new file mode 100644 index 0000000..de35fa7 --- /dev/null +++ b/src/main/java/me/didit/types/WebhooksDestinationsCreateParams.java @@ -0,0 +1,229 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code webhooks.destinations.create}. */ +public final class WebhooksDestinationsCreateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("label", "url", "enabled", "webhook_version", "subscribed_events"); + + private WebhooksDestinationsCreateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WebhooksDestinationsCreateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WebhooksDestinationsCreateParams fromJson(JsonNode json) { + return new WebhooksDestinationsCreateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Human-readable name displayed in Console โ†’ Webhooks. Helps distinguish destinations when you have several (e.g. "Prod", "Staging mirror"). + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String label() { + return Json.required(json, "label", Conv.STRING); + } + + /** + * HTTPS URL that will receive POST requests. Must be unique per application among non-deleted destinations. Use a stable, hardened endpoint โ€” Didit retries failed deliveries on a backoff schedule. + * + * @return the value + * @throws me.didit.errors.UnexpectedResponseException when the field is absent or has another type + */ + public String url() { + return Json.required(json, "url", Conv.STRING); + } + + /** + * When false, the destination is saved but Didit will not push any webhooks to it. Useful for staging configs you want to keep parked. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * Payload schema version Didit will send. v3 is the current/recommended format; older versions are kept for backward compatibility with legacy integrations. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookVersion() { + return Json.optional(json, "webhook_version", Conv.enumeration(WebhooksDestinationsCreateParams.WebhookVersion::of)); + } + + /** + * Events to deliver. Effectively required: an explicit [] is rejected with 400, and omitting the field creates a destination with no subscriptions that receives nothing. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subscribedEvents() { + return Json.optional(json, "subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WebhooksDestinationsCreateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WebhooksDestinationsCreateParams from) { + super(from); + } + + /** + * Human-readable name displayed in Console โ†’ Webhooks. Helps distinguish destinations when you have several (e.g. "Prod", "Staging mirror"). + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * HTTPS URL that will receive POST requests. Must be unique per application among non-deleted destinations. Use a stable, hardened endpoint โ€” Didit retries failed deliveries on a backoff schedule. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * When false, the destination is saved but Didit will not push any webhooks to it. Useful for staging configs you want to keep parked. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * Payload schema version Didit will send. v3 is the current/recommended format; older versions are kept for backward compatibility with legacy integrations. + * + * @param webhookVersion the value + * @return this builder + */ + public Builder webhookVersion(WebhooksDestinationsCreateParams.WebhookVersion webhookVersion) { + return set("webhook_version", Conv.enumeration(WebhooksDestinationsCreateParams.WebhookVersion::of), webhookVersion); + } + + /** + * Events to deliver. Effectively required: an explicit [] is rejected with 400, and omitting the field creates a destination with no subscriptions that receives nothing. + * + * @param subscribedEvents the value + * @return this builder + */ + public Builder subscribedEvents(List subscribedEvents) { + return set("subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of)), subscribedEvents); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WebhooksDestinationsCreateParams} + * @throws IllegalStateException when a required field is missing + */ + public WebhooksDestinationsCreateParams build() { + require("label", false); + require("url", false); + return new WebhooksDestinationsCreateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Payload schema version Didit will send. v3 is the current/recommended format; older versions are kept for backward compatibility with legacy integrations. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WebhookVersion extends StringEnum { + /** The value {@code "v1"}. */ + public static final WebhookVersion V_1 = new WebhookVersion("v1"); + + /** The value {@code "v2"}. */ + public static final WebhookVersion V_2 = new WebhookVersion("v2"); + + /** The value {@code "v3"}. */ + public static final WebhookVersion V_3 = new WebhookVersion("v3"); + + private static final List KNOWN_VALUES = List.of(V_1, V_2, V_3); + + private WebhookVersion(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookVersion of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookVersion::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/WebhooksDestinationsCreateResponse.java b/src/main/java/me/didit/types/WebhooksDestinationsCreateResponse.java new file mode 100644 index 0000000..3d7c12c --- /dev/null +++ b/src/main/java/me/didit/types/WebhooksDestinationsCreateResponse.java @@ -0,0 +1,532 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class WebhooksDestinationsCreateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "label", "url", "enabled", "webhook_version", "secret_shared_key", "subscribed_events", "created_at", "updated_at", "summary"); + + private WebhooksDestinationsCreateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WebhooksDestinationsCreateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WebhooksDestinationsCreateResponse fromJson(JsonNode json) { + return new WebhooksDestinationsCreateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable destination identifier. Use as {destination_uuid} in subsequent calls. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The webhook_version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookVersion() { + return Json.optional(json, "webhook_version", Conv.enumeration(WebhooksDestinationsCreateResponse.WebhookVersion::of)); + } + + /** + * Auto-generated HMAC signing secret bound to this destination (43-character URL-safe token). Use it to verify the signature headers on incoming webhooks. Always returned in full to API-key callers; Console users need the read:webhooks permission, otherwise they see an empty string. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional secretSharedKey() { + return Json.optional(json, "secret_shared_key", Conv.STRING); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subscribedEvents() { + return Json.optional(json, "subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * Delivery health summary (all zero/null on a brand-new destination). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.model(WebhooksDestinationsCreateResponse.Summary::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WebhooksDestinationsCreateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WebhooksDestinationsCreateResponse from) { + super(from); + } + + /** + * Stable destination identifier. Use as {destination_uuid} in subsequent calls. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The webhook_version field. + * + * @param webhookVersion the value + * @return this builder + */ + public Builder webhookVersion(WebhooksDestinationsCreateResponse.WebhookVersion webhookVersion) { + return set("webhook_version", Conv.enumeration(WebhooksDestinationsCreateResponse.WebhookVersion::of), webhookVersion); + } + + /** + * Auto-generated HMAC signing secret bound to this destination (43-character URL-safe token). Use it to verify the signature headers on incoming webhooks. Always returned in full to API-key callers; Console users need the read:webhooks permission, otherwise they see an empty string. + * + * @param secretSharedKey the value + * @return this builder + */ + public Builder secretSharedKey(String secretSharedKey) { + return set("secret_shared_key", Conv.STRING, secretSharedKey); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @param subscribedEvents the value + * @return this builder + */ + public Builder subscribedEvents(List subscribedEvents) { + return set("subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of)), subscribedEvents); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Delivery health summary (all zero/null on a brand-new destination). + * + * @param summary the value + * @return this builder + */ + public Builder summary(WebhooksDestinationsCreateResponse.Summary summary) { + return set("summary", Conv.model(WebhooksDestinationsCreateResponse.Summary::fromJson), summary); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WebhooksDestinationsCreateResponse} + */ + public WebhooksDestinationsCreateResponse build() { + return new WebhooksDestinationsCreateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WebhookVersion extends StringEnum { + /** The value {@code "v1"}. */ + public static final WebhookVersion V_1 = new WebhookVersion("v1"); + + /** The value {@code "v2"}. */ + public static final WebhookVersion V_2 = new WebhookVersion("v2"); + + /** The value {@code "v3"}. */ + public static final WebhookVersion V_3 = new WebhookVersion("v3"); + + private static final List KNOWN_VALUES = List.of(V_1, V_2, V_3); + + private WebhookVersion(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookVersion of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookVersion::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Delivery health summary (all zero/null on a brand-new destination). */ + public static final class Summary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total_deliveries", "failed_deliveries", "error_rate_percentage", "min_response_time_ms", "avg_response_time_ms", "max_response_time_ms", "last_delivery_at"); + + private Summary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Summary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Summary fromJson(JsonNode json) { + return new Summary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The total_deliveries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalDeliveries() { + return Json.optional(json, "total_deliveries", Conv.LONG); + } + + /** + * The failed_deliveries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedDeliveries() { + return Json.optional(json, "failed_deliveries", Conv.LONG); + } + + /** + * The error_rate_percentage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional errorRatePercentage() { + return Json.optional(json, "error_rate_percentage", Conv.LONG); + } + + /** + * The min_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minResponseTimeMs() { + return Json.optional(json, "min_response_time_ms", Conv.LONG); + } + + /** + * The avg_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResponseTimeMs() { + return Json.optional(json, "avg_response_time_ms", Conv.LONG); + } + + /** + * The max_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxResponseTimeMs() { + return Json.optional(json, "max_response_time_ms", Conv.LONG); + } + + /** + * The last_delivery_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastDeliveryAt() { + return Json.optional(json, "last_delivery_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Summary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Summary from) { + super(from); + } + + /** + * The total_deliveries field. + * + * @param totalDeliveries the value + * @return this builder + */ + public Builder totalDeliveries(long totalDeliveries) { + return set("total_deliveries", Conv.LONG, totalDeliveries); + } + + /** + * The failed_deliveries field. + * + * @param failedDeliveries the value + * @return this builder + */ + public Builder failedDeliveries(long failedDeliveries) { + return set("failed_deliveries", Conv.LONG, failedDeliveries); + } + + /** + * The error_rate_percentage field. + * + * @param errorRatePercentage the value + * @return this builder + */ + public Builder errorRatePercentage(long errorRatePercentage) { + return set("error_rate_percentage", Conv.LONG, errorRatePercentage); + } + + /** + * The min_response_time_ms field. + * + * @param minResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder minResponseTimeMs(@Nullable Long minResponseTimeMs) { + return setNullable("min_response_time_ms", Conv.LONG, minResponseTimeMs); + } + + /** + * The avg_response_time_ms field. + * + * @param avgResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder avgResponseTimeMs(@Nullable Long avgResponseTimeMs) { + return setNullable("avg_response_time_ms", Conv.LONG, avgResponseTimeMs); + } + + /** + * The max_response_time_ms field. + * + * @param maxResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxResponseTimeMs(@Nullable Long maxResponseTimeMs) { + return setNullable("max_response_time_ms", Conv.LONG, maxResponseTimeMs); + } + + /** + * The last_delivery_at field. + * + * @param lastDeliveryAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastDeliveryAt(@Nullable OffsetDateTime lastDeliveryAt) { + return setNullable("last_delivery_at", Conv.DATE_TIME, lastDeliveryAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Summary} + */ + public Summary build() { + return new Summary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/WebhooksDestinationsListResponse.java b/src/main/java/me/didit/types/WebhooksDestinationsListResponse.java new file mode 100644 index 0000000..ba94f67 --- /dev/null +++ b/src/main/java/me/didit/types/WebhooksDestinationsListResponse.java @@ -0,0 +1,407 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class WebhooksDestinationsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "label", "url", "enabled", "webhook_version", "subscribed_events", "subscribed_events_count", "deliveries_count", "failed_deliveries_count", "average_response_time_ms", "error_rate_percentage", "last_delivery_at", "created_at", "updated_at"); + + private WebhooksDestinationsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WebhooksDestinationsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WebhooksDestinationsListResponse fromJson(JsonNode json) { + return new WebhooksDestinationsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Stable destination identifier; use as {destination_uuid} for update/delete. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Human-readable name shown in the Console. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * Destination URL that receives POST requests with the webhook payload. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * When false, Didit silently skips delivery to this destination. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * Payload schema version sent to this destination. v3 is the current/recommended format. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookVersion() { + return Json.optional(json, "webhook_version", Conv.enumeration(WebhooksDestinationsListResponse.WebhookVersion::of)); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subscribedEvents() { + return Json.optional(json, "subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of))); + } + + /** + * Cached length of subscribed_events, useful for UI rendering. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional subscribedEventsCount() { + return Json.optional(json, "subscribed_events_count", Conv.LONG); + } + + /** + * Total delivery attempts (successful + failed) recorded for this destination. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional deliveriesCount() { + return Json.optional(json, "deliveries_count", Conv.LONG); + } + + /** + * Delivery attempts whose target responded with HTTP โ‰ฅ 400 (or did not respond). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedDeliveriesCount() { + return Json.optional(json, "failed_deliveries_count", Conv.LONG); + } + + /** + * Average target response time in milliseconds, rounded to an integer. null if no deliveries yet. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional averageResponseTimeMs() { + return Json.optional(json, "average_response_time_ms", Conv.LONG); + } + + /** + * round(failed_deliveries_count / deliveries_count * 100); 0 when there are no deliveries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional errorRatePercentage() { + return Json.optional(json, "error_rate_percentage", Conv.LONG); + } + + /** + * Timestamp of the most recent delivery attempt (success or failure). null if never delivered. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastDeliveryAt() { + return Json.optional(json, "last_delivery_at", Conv.DATE_TIME); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WebhooksDestinationsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WebhooksDestinationsListResponse from) { + super(from); + } + + /** + * Stable destination identifier; use as {destination_uuid} for update/delete. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Human-readable name shown in the Console. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * Destination URL that receives POST requests with the webhook payload. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * When false, Didit silently skips delivery to this destination. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * Payload schema version sent to this destination. v3 is the current/recommended format. + * + * @param webhookVersion the value + * @return this builder + */ + public Builder webhookVersion(WebhooksDestinationsListResponse.WebhookVersion webhookVersion) { + return set("webhook_version", Conv.enumeration(WebhooksDestinationsListResponse.WebhookVersion::of), webhookVersion); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @param subscribedEvents the value + * @return this builder + */ + public Builder subscribedEvents(List subscribedEvents) { + return set("subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of)), subscribedEvents); + } + + /** + * Cached length of subscribed_events, useful for UI rendering. + * + * @param subscribedEventsCount the value + * @return this builder + */ + public Builder subscribedEventsCount(long subscribedEventsCount) { + return set("subscribed_events_count", Conv.LONG, subscribedEventsCount); + } + + /** + * Total delivery attempts (successful + failed) recorded for this destination. + * + * @param deliveriesCount the value + * @return this builder + */ + public Builder deliveriesCount(long deliveriesCount) { + return set("deliveries_count", Conv.LONG, deliveriesCount); + } + + /** + * Delivery attempts whose target responded with HTTP โ‰ฅ 400 (or did not respond). + * + * @param failedDeliveriesCount the value + * @return this builder + */ + public Builder failedDeliveriesCount(long failedDeliveriesCount) { + return set("failed_deliveries_count", Conv.LONG, failedDeliveriesCount); + } + + /** + * Average target response time in milliseconds, rounded to an integer. null if no deliveries yet. + * + * @param averageResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder averageResponseTimeMs(@Nullable Long averageResponseTimeMs) { + return setNullable("average_response_time_ms", Conv.LONG, averageResponseTimeMs); + } + + /** + * round(failed_deliveries_count / deliveries_count * 100); 0 when there are no deliveries. + * + * @param errorRatePercentage the value + * @return this builder + */ + public Builder errorRatePercentage(long errorRatePercentage) { + return set("error_rate_percentage", Conv.LONG, errorRatePercentage); + } + + /** + * Timestamp of the most recent delivery attempt (success or failure). null if never delivered. + * + * @param lastDeliveryAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastDeliveryAt(@Nullable OffsetDateTime lastDeliveryAt) { + return setNullable("last_delivery_at", Conv.DATE_TIME, lastDeliveryAt); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WebhooksDestinationsListResponse} + */ + public WebhooksDestinationsListResponse build() { + return new WebhooksDestinationsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Payload schema version sent to this destination. v3 is the current/recommended format. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WebhookVersion extends StringEnum { + /** The value {@code "v1"}. */ + public static final WebhookVersion V_1 = new WebhookVersion("v1"); + + /** The value {@code "v2"}. */ + public static final WebhookVersion V_2 = new WebhookVersion("v2"); + + /** The value {@code "v3"}. */ + public static final WebhookVersion V_3 = new WebhookVersion("v3"); + + private static final List KNOWN_VALUES = List.of(V_1, V_2, V_3); + + private WebhookVersion(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookVersion of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookVersion::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/WebhooksDestinationsRetrieveResponse.java b/src/main/java/me/didit/types/WebhooksDestinationsRetrieveResponse.java new file mode 100644 index 0000000..995b3d5 --- /dev/null +++ b/src/main/java/me/didit/types/WebhooksDestinationsRetrieveResponse.java @@ -0,0 +1,532 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class WebhooksDestinationsRetrieveResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "label", "url", "enabled", "webhook_version", "secret_shared_key", "subscribed_events", "created_at", "updated_at", "summary"); + + private WebhooksDestinationsRetrieveResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WebhooksDestinationsRetrieveResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WebhooksDestinationsRetrieveResponse fromJson(JsonNode json) { + return new WebhooksDestinationsRetrieveResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The webhook_version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookVersion() { + return Json.optional(json, "webhook_version", Conv.enumeration(WebhooksDestinationsRetrieveResponse.WebhookVersion::of)); + } + + /** + * HMAC signing secret (43-character URL-safe token). Always returned in full to API-key callers; Console users need read:webhooks, otherwise an empty string. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional secretSharedKey() { + return Json.optional(json, "secret_shared_key", Conv.STRING); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subscribedEvents() { + return Json.optional(json, "subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * Delivery health metrics aggregated over the destination's lifetime. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.model(WebhooksDestinationsRetrieveResponse.Summary::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WebhooksDestinationsRetrieveResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WebhooksDestinationsRetrieveResponse from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The webhook_version field. + * + * @param webhookVersion the value + * @return this builder + */ + public Builder webhookVersion(WebhooksDestinationsRetrieveResponse.WebhookVersion webhookVersion) { + return set("webhook_version", Conv.enumeration(WebhooksDestinationsRetrieveResponse.WebhookVersion::of), webhookVersion); + } + + /** + * HMAC signing secret (43-character URL-safe token). Always returned in full to API-key callers; Console users need read:webhooks, otherwise an empty string. + * + * @param secretSharedKey the value + * @return this builder + */ + public Builder secretSharedKey(String secretSharedKey) { + return set("secret_shared_key", Conv.STRING, secretSharedKey); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @param subscribedEvents the value + * @return this builder + */ + public Builder subscribedEvents(List subscribedEvents) { + return set("subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of)), subscribedEvents); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Delivery health metrics aggregated over the destination's lifetime. + * + * @param summary the value + * @return this builder + */ + public Builder summary(WebhooksDestinationsRetrieveResponse.Summary summary) { + return set("summary", Conv.model(WebhooksDestinationsRetrieveResponse.Summary::fromJson), summary); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WebhooksDestinationsRetrieveResponse} + */ + public WebhooksDestinationsRetrieveResponse build() { + return new WebhooksDestinationsRetrieveResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WebhookVersion extends StringEnum { + /** The value {@code "v1"}. */ + public static final WebhookVersion V_1 = new WebhookVersion("v1"); + + /** The value {@code "v2"}. */ + public static final WebhookVersion V_2 = new WebhookVersion("v2"); + + /** The value {@code "v3"}. */ + public static final WebhookVersion V_3 = new WebhookVersion("v3"); + + private static final List KNOWN_VALUES = List.of(V_1, V_2, V_3); + + private WebhookVersion(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookVersion of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookVersion::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** Delivery health metrics aggregated over the destination's lifetime. */ + public static final class Summary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total_deliveries", "failed_deliveries", "error_rate_percentage", "min_response_time_ms", "avg_response_time_ms", "max_response_time_ms", "last_delivery_at"); + + private Summary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Summary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Summary fromJson(JsonNode json) { + return new Summary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The total_deliveries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalDeliveries() { + return Json.optional(json, "total_deliveries", Conv.LONG); + } + + /** + * The failed_deliveries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedDeliveries() { + return Json.optional(json, "failed_deliveries", Conv.LONG); + } + + /** + * The error_rate_percentage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional errorRatePercentage() { + return Json.optional(json, "error_rate_percentage", Conv.LONG); + } + + /** + * The min_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minResponseTimeMs() { + return Json.optional(json, "min_response_time_ms", Conv.LONG); + } + + /** + * The avg_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResponseTimeMs() { + return Json.optional(json, "avg_response_time_ms", Conv.LONG); + } + + /** + * The max_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxResponseTimeMs() { + return Json.optional(json, "max_response_time_ms", Conv.LONG); + } + + /** + * The last_delivery_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastDeliveryAt() { + return Json.optional(json, "last_delivery_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Summary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Summary from) { + super(from); + } + + /** + * The total_deliveries field. + * + * @param totalDeliveries the value + * @return this builder + */ + public Builder totalDeliveries(long totalDeliveries) { + return set("total_deliveries", Conv.LONG, totalDeliveries); + } + + /** + * The failed_deliveries field. + * + * @param failedDeliveries the value + * @return this builder + */ + public Builder failedDeliveries(long failedDeliveries) { + return set("failed_deliveries", Conv.LONG, failedDeliveries); + } + + /** + * The error_rate_percentage field. + * + * @param errorRatePercentage the value + * @return this builder + */ + public Builder errorRatePercentage(long errorRatePercentage) { + return set("error_rate_percentage", Conv.LONG, errorRatePercentage); + } + + /** + * The min_response_time_ms field. + * + * @param minResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder minResponseTimeMs(@Nullable Long minResponseTimeMs) { + return setNullable("min_response_time_ms", Conv.LONG, minResponseTimeMs); + } + + /** + * The avg_response_time_ms field. + * + * @param avgResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder avgResponseTimeMs(@Nullable Long avgResponseTimeMs) { + return setNullable("avg_response_time_ms", Conv.LONG, avgResponseTimeMs); + } + + /** + * The max_response_time_ms field. + * + * @param maxResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxResponseTimeMs(@Nullable Long maxResponseTimeMs) { + return setNullable("max_response_time_ms", Conv.LONG, maxResponseTimeMs); + } + + /** + * The last_delivery_at field. + * + * @param lastDeliveryAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastDeliveryAt(@Nullable OffsetDateTime lastDeliveryAt) { + return setNullable("last_delivery_at", Conv.DATE_TIME, lastDeliveryAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Summary} + */ + public Summary build() { + return new Summary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/WebhooksDestinationsUpdateParams.java b/src/main/java/me/didit/types/WebhooksDestinationsUpdateParams.java new file mode 100644 index 0000000..a37663c --- /dev/null +++ b/src/main/java/me/didit/types/WebhooksDestinationsUpdateParams.java @@ -0,0 +1,226 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; + +/** Parameters for {@code webhooks.destinations.update}. */ +public final class WebhooksDestinationsUpdateParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("label", "url", "enabled", "webhook_version", "subscribed_events"); + + private WebhooksDestinationsUpdateParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WebhooksDestinationsUpdateParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WebhooksDestinationsUpdateParams fromJson(JsonNode json) { + return new WebhooksDestinationsUpdateParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * New human-readable name. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * New target URL. Must be unique within the application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * Set to false to pause deliveries to this destination without deleting it. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * New payload schema version for future deliveries. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookVersion() { + return Json.optional(json, "webhook_version", Conv.enumeration(WebhooksDestinationsUpdateParams.WebhookVersion::of)); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subscribedEvents() { + return Json.optional(json, "subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WebhooksDestinationsUpdateParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WebhooksDestinationsUpdateParams from) { + super(from); + } + + /** + * New human-readable name. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * New target URL. Must be unique within the application. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * Set to false to pause deliveries to this destination without deleting it. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * New payload schema version for future deliveries. + * + * @param webhookVersion the value + * @return this builder + */ + public Builder webhookVersion(WebhooksDestinationsUpdateParams.WebhookVersion webhookVersion) { + return set("webhook_version", Conv.enumeration(WebhooksDestinationsUpdateParams.WebhookVersion::of), webhookVersion); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @param subscribedEvents the value + * @return this builder + */ + public Builder subscribedEvents(List subscribedEvents) { + return set("subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of)), subscribedEvents); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WebhooksDestinationsUpdateParams} + */ + public WebhooksDestinationsUpdateParams build() { + return new WebhooksDestinationsUpdateParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * New payload schema version for future deliveries. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WebhookVersion extends StringEnum { + /** The value {@code "v1"}. */ + public static final WebhookVersion V_1 = new WebhookVersion("v1"); + + /** The value {@code "v2"}. */ + public static final WebhookVersion V_2 = new WebhookVersion("v2"); + + /** The value {@code "v3"}. */ + public static final WebhookVersion V_3 = new WebhookVersion("v3"); + + private static final List KNOWN_VALUES = List.of(V_1, V_2, V_3); + + private WebhookVersion(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookVersion of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookVersion::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } +} diff --git a/src/main/java/me/didit/types/WebhooksDestinationsUpdateResponse.java b/src/main/java/me/didit/types/WebhooksDestinationsUpdateResponse.java new file mode 100644 index 0000000..0386f6b --- /dev/null +++ b/src/main/java/me/didit/types/WebhooksDestinationsUpdateResponse.java @@ -0,0 +1,531 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +public final class WebhooksDestinationsUpdateResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "label", "url", "enabled", "webhook_version", "secret_shared_key", "subscribed_events", "created_at", "updated_at", "summary"); + + private WebhooksDestinationsUpdateResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WebhooksDestinationsUpdateResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WebhooksDestinationsUpdateResponse fromJson(JsonNode json) { + return new WebhooksDestinationsUpdateResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The uuid field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * The label field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional label() { + return Json.optional(json, "label", Conv.STRING); + } + + /** + * The url field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional url() { + return Json.optional(json, "url", Conv.STRING); + } + + /** + * The enabled field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional enabled() { + return Json.optional(json, "enabled", Conv.BOOLEAN); + } + + /** + * The webhook_version field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional webhookVersion() { + return Json.optional(json, "webhook_version", Conv.enumeration(WebhooksDestinationsUpdateResponse.WebhookVersion::of)); + } + + /** + * The secret_shared_key field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional secretSharedKey() { + return Json.optional(json, "secret_shared_key", Conv.STRING); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> subscribedEvents() { + return Json.optional(json, "subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of))); + } + + /** + * The created_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdAt() { + return Json.optional(json, "created_at", Conv.DATE_TIME); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + /** + * The summary field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional summary() { + return Json.optional(json, "summary", Conv.model(WebhooksDestinationsUpdateResponse.Summary::fromJson)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WebhooksDestinationsUpdateResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WebhooksDestinationsUpdateResponse from) { + super(from); + } + + /** + * The uuid field. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * The label field. + * + * @param label the value + * @return this builder + */ + public Builder label(String label) { + return set("label", Conv.STRING, label); + } + + /** + * The url field. + * + * @param url the value + * @return this builder + */ + public Builder url(String url) { + return set("url", Conv.STRING, url); + } + + /** + * The enabled field. + * + * @param enabled the value + * @return this builder + */ + public Builder enabled(boolean enabled) { + return set("enabled", Conv.BOOLEAN, enabled); + } + + /** + * The webhook_version field. + * + * @param webhookVersion the value + * @return this builder + */ + public Builder webhookVersion(WebhooksDestinationsUpdateResponse.WebhookVersion webhookVersion) { + return set("webhook_version", Conv.enumeration(WebhooksDestinationsUpdateResponse.WebhookVersion::of), webhookVersion); + } + + /** + * The secret_shared_key field. + * + * @param secretSharedKey the value + * @return this builder + */ + public Builder secretSharedKey(String secretSharedKey) { + return set("secret_shared_key", Conv.STRING, secretSharedKey); + } + + /** + * Event filter for this webhook destination. Didit delivers only webhooks whose event type exactly matches one of these values โ€” there is no wildcard subscription. When sent, the list must contain at least one valid event (an explicit [] is rejected with 400); a destination whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale, never merged. + * + * @param subscribedEvents the value + * @return this builder + */ + public Builder subscribedEvents(List subscribedEvents) { + return set("subscribed_events", Conv.list(Conv.enumeration(WebhookEvent::of)), subscribedEvents); + } + + /** + * The created_at field. + * + * @param createdAt the value + * @return this builder + */ + public Builder createdAt(OffsetDateTime createdAt) { + return set("created_at", Conv.DATE_TIME, createdAt); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * The summary field. + * + * @param summary the value + * @return this builder + */ + public Builder summary(WebhooksDestinationsUpdateResponse.Summary summary) { + return set("summary", Conv.model(WebhooksDestinationsUpdateResponse.Summary::fromJson), summary); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WebhooksDestinationsUpdateResponse} + */ + public WebhooksDestinationsUpdateResponse build() { + return new WebhooksDestinationsUpdateResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class WebhookVersion extends StringEnum { + /** The value {@code "v1"}. */ + public static final WebhookVersion V_1 = new WebhookVersion("v1"); + + /** The value {@code "v2"}. */ + public static final WebhookVersion V_2 = new WebhookVersion("v2"); + + /** The value {@code "v3"}. */ + public static final WebhookVersion V_3 = new WebhookVersion("v3"); + + private static final List KNOWN_VALUES = List.of(V_1, V_2, V_3); + + private WebhookVersion(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static WebhookVersion of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, WebhookVersion::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + public static final class Summary extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("total_deliveries", "failed_deliveries", "error_rate_percentage", "min_response_time_ms", "avg_response_time_ms", "max_response_time_ms", "last_delivery_at"); + + private Summary(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code Summary} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static Summary fromJson(JsonNode json) { + return new Summary(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The total_deliveries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalDeliveries() { + return Json.optional(json, "total_deliveries", Conv.LONG); + } + + /** + * The failed_deliveries field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional failedDeliveries() { + return Json.optional(json, "failed_deliveries", Conv.LONG); + } + + /** + * The error_rate_percentage field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional errorRatePercentage() { + return Json.optional(json, "error_rate_percentage", Conv.LONG); + } + + /** + * The min_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minResponseTimeMs() { + return Json.optional(json, "min_response_time_ms", Conv.LONG); + } + + /** + * The avg_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional avgResponseTimeMs() { + return Json.optional(json, "avg_response_time_ms", Conv.LONG); + } + + /** + * The max_response_time_ms field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxResponseTimeMs() { + return Json.optional(json, "max_response_time_ms", Conv.LONG); + } + + /** + * The last_delivery_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional lastDeliveryAt() { + return Json.optional(json, "last_delivery_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link Summary}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Summary from) { + super(from); + } + + /** + * The total_deliveries field. + * + * @param totalDeliveries the value + * @return this builder + */ + public Builder totalDeliveries(long totalDeliveries) { + return set("total_deliveries", Conv.LONG, totalDeliveries); + } + + /** + * The failed_deliveries field. + * + * @param failedDeliveries the value + * @return this builder + */ + public Builder failedDeliveries(long failedDeliveries) { + return set("failed_deliveries", Conv.LONG, failedDeliveries); + } + + /** + * The error_rate_percentage field. + * + * @param errorRatePercentage the value + * @return this builder + */ + public Builder errorRatePercentage(long errorRatePercentage) { + return set("error_rate_percentage", Conv.LONG, errorRatePercentage); + } + + /** + * The min_response_time_ms field. + * + * @param minResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder minResponseTimeMs(@Nullable Long minResponseTimeMs) { + return setNullable("min_response_time_ms", Conv.LONG, minResponseTimeMs); + } + + /** + * The avg_response_time_ms field. + * + * @param avgResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder avgResponseTimeMs(@Nullable Long avgResponseTimeMs) { + return setNullable("avg_response_time_ms", Conv.LONG, avgResponseTimeMs); + } + + /** + * The max_response_time_ms field. + * + * @param maxResponseTimeMs the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder maxResponseTimeMs(@Nullable Long maxResponseTimeMs) { + return setNullable("max_response_time_ms", Conv.LONG, maxResponseTimeMs); + } + + /** + * The last_delivery_at field. + * + * @param lastDeliveryAt the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder lastDeliveryAt(@Nullable OffsetDateTime lastDeliveryAt) { + return setNullable("last_delivery_at", Conv.DATE_TIME, lastDeliveryAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code Summary} + */ + public Summary build() { + return new Summary(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + } +} diff --git a/src/main/java/me/didit/types/WorkflowListItem.java b/src/main/java/me/didit/types/WorkflowListItem.java new file mode 100644 index 0000000..6380a15 --- /dev/null +++ b/src/main/java/me/didit/types/WorkflowListItem.java @@ -0,0 +1,735 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import me.didit.core.StringEnum; +import org.jspecify.annotations.Nullable; + +/** One workflow version in the list view. */ +public final class WorkflowListItem extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("uuid", "workflow_id", "workflow_label", "workflow_type", "is_default", "is_archived", "is_white_label_enabled", "total_price", "min_price", "max_price", "features", "is_simple_workflow", "is_editable", "workflow_url", "max_retry_attempts", "retry_window_days", "session_expiration_time", "version", "status", "has_draft", "created_by", "updated_at"); + + private WorkflowListItem(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WorkflowListItem} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WorkflowListItem fromJson(JsonNode json) { + return new WorkflowListItem(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Per-version UUID. Use as {settings_uuid} for get/update/delete, and as workflow_id when creating sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional uuid() { + return Json.optional(json, "uuid", Conv.STRING); + } + + /** + * Stable group ID shared by every version of the same workflow. Equals uuid for version 1. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowId() { + return Json.optional(json, "workflow_id", Conv.STRING); + } + + /** + * Display name for the workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowLabel() { + return Json.optional(json, "workflow_label", Conv.STRING); + } + + /** + * Base type for simple workflows: kyc, kyb, adaptive_age_verification, biometric_authentication, etc. null for graph-based workflows without a KYB feature. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowType() { + return Json.optional(json, "workflow_type", Conv.STRING); + } + + /** + * Whether this is the default workflow for new sessions. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isDefault() { + return Json.optional(json, "is_default", Conv.BOOLEAN); + } + + /** + * The is_archived field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isArchived() { + return Json.optional(json, "is_archived", Conv.BOOLEAN); + } + + /** + * Whether white-label customization applies to sessions created with this workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isWhiteLabelEnabled() { + return Json.optional(json, "is_white_label_enabled", Conv.BOOLEAN); + } + + /** + * Fixed price per verification in USD (JSON number, excludes variable-priced features such as DATABASE_VALIDATION and PHONE_VERIFICATION). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional totalPrice() { + return Json.optional(json, "total_price", Conv.DOUBLE); + } + + /** + * Cheapest fixed price across workflow-graph paths, in USD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional minPrice() { + return Json.optional(json, "min_price", Conv.DOUBLE); + } + + /** + * Most expensive fixed price across workflow-graph paths, in USD. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxPrice() { + return Json.optional(json, "max_price", Conv.DOUBLE); + } + + /** + * Enabled features as a single " + "-joined string, e.g. "OCR + LIVENESS + FACE_MATCH". Split on " + " to get a list. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional features() { + return Json.optional(json, "features", Conv.STRING); + } + + /** + * True when the workflow has no custom workflow graph. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isSimpleWorkflow() { + return Json.optional(json, "is_simple_workflow", Conv.BOOLEAN); + } + + /** + * True when this version is a draft (drafts are editable in place; published versions are immutable in the Console). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional isEditable() { + return Json.optional(json, "is_editable", Conv.BOOLEAN); + } + + /** + * Public shareable verification URL for this workflow (https://verify.didit.me/u/<token>). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional workflowUrl() { + return Json.optional(json, "workflow_url", Conv.STRING); + } + + /** + * Maximum retry attempts allowed after a declined verification (0-10). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional maxRetryAttempts() { + return Json.optional(json, "max_retry_attempts", Conv.LONG); + } + + /** + * Rolling window in days used to count retries (1-365). null = all-time limit. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional retryWindowDays() { + return Json.optional(json, "retry_window_days", Conv.LONG); + } + + /** + * Seconds before an unfinished session expires (3600-2419200). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional sessionExpirationTime() { + return Json.optional(json, "session_expiration_time", Conv.LONG); + } + + /** + * Version number within the workflow_id group, starting at 1. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional version() { + return Json.optional(json, "version", Conv.LONG); + } + + /** + * Version status. New sessions use the latest published version of a group. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional status() { + return Json.optional(json, "status", Conv.enumeration(WorkflowListItem.Status::of)); + } + + /** + * True when any version in this workflow_id group is currently a draft. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional hasDraft() { + return Json.optional(json, "has_draft", Conv.BOOLEAN); + } + + /** + * Who created this version: {name, email, type} where type is user (Console user, email set) or api_key (name is the client id, email is null). null when no creator was recorded. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional createdBy() { + return Json.optional(json, "created_by", Conv.model(WorkflowListItem.CreatedBy::fromJson)); + } + + /** + * The updated_at field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional updatedAt() { + return Json.optional(json, "updated_at", Conv.DATE_TIME); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WorkflowListItem}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WorkflowListItem from) { + super(from); + } + + /** + * Per-version UUID. Use as {settings_uuid} for get/update/delete, and as workflow_id when creating sessions. + * + * @param uuid the value + * @return this builder + */ + public Builder uuid(String uuid) { + return set("uuid", Conv.STRING, uuid); + } + + /** + * Stable group ID shared by every version of the same workflow. Equals uuid for version 1. + * + * @param workflowId the value + * @return this builder + */ + public Builder workflowId(String workflowId) { + return set("workflow_id", Conv.STRING, workflowId); + } + + /** + * Display name for the workflow. + * + * @param workflowLabel the value + * @return this builder + */ + public Builder workflowLabel(String workflowLabel) { + return set("workflow_label", Conv.STRING, workflowLabel); + } + + /** + * Base type for simple workflows: kyc, kyb, adaptive_age_verification, biometric_authentication, etc. null for graph-based workflows without a KYB feature. + * + * @param workflowType the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder workflowType(@Nullable String workflowType) { + return setNullable("workflow_type", Conv.STRING, workflowType); + } + + /** + * Whether this is the default workflow for new sessions. + * + * @param isDefault the value + * @return this builder + */ + public Builder isDefault(boolean isDefault) { + return set("is_default", Conv.BOOLEAN, isDefault); + } + + /** + * The is_archived field. + * + * @param isArchived the value + * @return this builder + */ + public Builder isArchived(boolean isArchived) { + return set("is_archived", Conv.BOOLEAN, isArchived); + } + + /** + * Whether white-label customization applies to sessions created with this workflow. + * + * @param isWhiteLabelEnabled the value + * @return this builder + */ + public Builder isWhiteLabelEnabled(boolean isWhiteLabelEnabled) { + return set("is_white_label_enabled", Conv.BOOLEAN, isWhiteLabelEnabled); + } + + /** + * Fixed price per verification in USD (JSON number, excludes variable-priced features such as DATABASE_VALIDATION and PHONE_VERIFICATION). + * + * @param totalPrice the value + * @return this builder + */ + public Builder totalPrice(double totalPrice) { + return set("total_price", Conv.DOUBLE, totalPrice); + } + + /** + * Cheapest fixed price across workflow-graph paths, in USD. + * + * @param minPrice the value + * @return this builder + */ + public Builder minPrice(double minPrice) { + return set("min_price", Conv.DOUBLE, minPrice); + } + + /** + * Most expensive fixed price across workflow-graph paths, in USD. + * + * @param maxPrice the value + * @return this builder + */ + public Builder maxPrice(double maxPrice) { + return set("max_price", Conv.DOUBLE, maxPrice); + } + + /** + * Enabled features as a single " + "-joined string, e.g. "OCR + LIVENESS + FACE_MATCH". Split on " + " to get a list. + * + * @param features the value + * @return this builder + */ + public Builder features(String features) { + return set("features", Conv.STRING, features); + } + + /** + * True when the workflow has no custom workflow graph. + * + * @param isSimpleWorkflow the value + * @return this builder + */ + public Builder isSimpleWorkflow(boolean isSimpleWorkflow) { + return set("is_simple_workflow", Conv.BOOLEAN, isSimpleWorkflow); + } + + /** + * True when this version is a draft (drafts are editable in place; published versions are immutable in the Console). + * + * @param isEditable the value + * @return this builder + */ + public Builder isEditable(boolean isEditable) { + return set("is_editable", Conv.BOOLEAN, isEditable); + } + + /** + * Public shareable verification URL for this workflow (https://verify.didit.me/u/<token>). + * + * @param workflowUrl the value + * @return this builder + */ + public Builder workflowUrl(String workflowUrl) { + return set("workflow_url", Conv.STRING, workflowUrl); + } + + /** + * Maximum retry attempts allowed after a declined verification (0-10). + * + * @param maxRetryAttempts the value + * @return this builder + */ + public Builder maxRetryAttempts(long maxRetryAttempts) { + return set("max_retry_attempts", Conv.LONG, maxRetryAttempts); + } + + /** + * Rolling window in days used to count retries (1-365). null = all-time limit. + * + * @param retryWindowDays the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder retryWindowDays(@Nullable Long retryWindowDays) { + return setNullable("retry_window_days", Conv.LONG, retryWindowDays); + } + + /** + * Seconds before an unfinished session expires (3600-2419200). + * + * @param sessionExpirationTime the value + * @return this builder + */ + public Builder sessionExpirationTime(long sessionExpirationTime) { + return set("session_expiration_time", Conv.LONG, sessionExpirationTime); + } + + /** + * Version number within the workflow_id group, starting at 1. + * + * @param version the value + * @return this builder + */ + public Builder version(long version) { + return set("version", Conv.LONG, version); + } + + /** + * Version status. New sessions use the latest published version of a group. + * + * @param status the value + * @return this builder + */ + public Builder status(WorkflowListItem.Status status) { + return set("status", Conv.enumeration(WorkflowListItem.Status::of), status); + } + + /** + * True when any version in this workflow_id group is currently a draft. + * + * @param hasDraft the value + * @return this builder + */ + public Builder hasDraft(boolean hasDraft) { + return set("has_draft", Conv.BOOLEAN, hasDraft); + } + + /** + * Who created this version: {name, email, type} where type is user (Console user, email set) or api_key (name is the client id, email is null). null when no creator was recorded. + * + * @param createdBy the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder createdBy(WorkflowListItem.@Nullable CreatedBy createdBy) { + return setNullable("created_by", Conv.model(WorkflowListItem.CreatedBy::fromJson), createdBy); + } + + /** + * The updated_at field. + * + * @param updatedAt the value + * @return this builder + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + return set("updated_at", Conv.DATE_TIME, updatedAt); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WorkflowListItem} + */ + public WorkflowListItem build() { + return new WorkflowListItem(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * Version status. New sessions use the latest published version of a group. + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Status extends StringEnum { + /** The value {@code "draft"}. */ + public static final Status DRAFT = new Status("draft"); + + /** The value {@code "published"}. */ + public static final Status PUBLISHED = new Status("published"); + + private static final List KNOWN_VALUES = List.of(DRAFT, PUBLISHED); + + private Status(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Status of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Status::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** + * Who created this version: {name, email, type} where type is user (Console user, email set) or api_key (name is the client id, email is null). null when no creator was recorded. + */ + public static final class CreatedBy extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("name", "email", "type"); + + private CreatedBy(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code CreatedBy} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static CreatedBy fromJson(JsonNode json) { + return new CreatedBy(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * The name field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional name() { + return Json.optional(json, "name", Conv.STRING); + } + + /** + * The email field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional email() { + return Json.optional(json, "email", Conv.STRING); + } + + /** + * The type field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional type() { + return Json.optional(json, "type", Conv.enumeration(WorkflowListItem.CreatedBy.Type::of)); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link CreatedBy}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(CreatedBy from) { + super(from); + } + + /** + * The name field. + * + * @param name the value + * @return this builder + */ + public Builder name(String name) { + return set("name", Conv.STRING, name); + } + + /** + * The email field. + * + * @param email the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder email(@Nullable String email) { + return setNullable("email", Conv.STRING, email); + } + + /** + * The type field. + * + * @param type the value + * @return this builder + */ + public Builder type(WorkflowListItem.CreatedBy.Type type) { + return set("type", Conv.enumeration(WorkflowListItem.CreatedBy.Type::of), type); + } + + /** + * Builds the value. + * + * @return a new immutable {@code CreatedBy} + */ + public CreatedBy build() { + return new CreatedBy(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } + + /** + * + *

An open enum: {@link #of(String)} accepts values this SDK version does not know yet. + */ + public static final class Type extends StringEnum { + /** The value {@code "user"}. */ + public static final Type USER = new Type("user"); + + /** The value {@code "api_key"}. */ + public static final Type API_KEY = new Type("api_key"); + + private static final List KNOWN_VALUES = List.of(USER, API_KEY); + + private Type(String value) { + super(value); + } + + /** + * Returns the constant for a known value, or a new instance for any other value. + * + * @param value the string value + * @return the enum value + */ + public static Type of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Type::new); + } + + /** + * Returns the values known to this SDK version. + * + * @return the known values + */ + public static List knownValues() { + return KNOWN_VALUES; + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + } +} diff --git a/src/main/java/me/didit/types/WorkflowsListParams.java b/src/main/java/me/didit/types/WorkflowsListParams.java new file mode 100644 index 0000000..9acd5c0 --- /dev/null +++ b/src/main/java/me/didit/types/WorkflowsListParams.java @@ -0,0 +1,119 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; + +/** Parameters for {@code workflows.list}. */ +public final class WorkflowsListParams extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("limit", "offset"); + + private WorkflowsListParams(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WorkflowsListParams} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WorkflowsListParams fromJson(JsonNode json) { + return new WorkflowsListParams(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Page size (number of workflows per page). + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional limit() { + return Json.optional(json, "limit", Conv.LONG); + } + + /** + * Number of rows to skip before the first returned workflow. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional offset() { + return Json.optional(json, "offset", Conv.LONG); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WorkflowsListParams}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WorkflowsListParams from) { + super(from); + } + + /** + * Page size (number of workflows per page). + * + * @param limit the value + * @return this builder + */ + public Builder limit(long limit) { + return set("limit", Conv.LONG, limit); + } + + /** + * Number of rows to skip before the first returned workflow. + * + * @param offset the value + * @return this builder + */ + public Builder offset(long offset) { + return set("offset", Conv.LONG, offset); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WorkflowsListParams} + */ + public WorkflowsListParams build() { + return new WorkflowsListParams(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/WorkflowsListResponse.java b/src/main/java/me/didit/types/WorkflowsListResponse.java new file mode 100644 index 0000000..5ff9866 --- /dev/null +++ b/src/main/java/me/didit/types/WorkflowsListResponse.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.types; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.Conv; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.core.JsonModel; +import org.jspecify.annotations.Nullable; + +public final class WorkflowsListResponse extends JsonModel { + private static final Set KNOWN_FIELDS = Set.of("count", "next", "previous", "results"); + + private WorkflowsListResponse(ObjectNode json, Map> files) { + super(json, files); + } + + /** + * Reads a {@code WorkflowsListResponse} from JSON. Unknown fields are kept and readable + * through {@link #_additionalProperties()}. + * + * @param json a JSON object + * @return the parsed value + */ + public static WorkflowsListResponse fromJson(JsonNode json) { + return new WorkflowsListResponse(Json.copyObject(json), Map.of()); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Returns a builder holding a copy of every field of this value. + * + * @return a new builder + */ + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Total number of workflow versions for the application. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional count() { + return Json.optional(json, "count", Conv.LONG); + } + + /** + * URL of the next page, or null on the last page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional next() { + return Json.optional(json, "next", Conv.STRING); + } + + /** + * URL of the previous page, or null on the first page. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional previous() { + return Json.optional(json, "previous", Conv.STRING); + } + + /** + * The results field. + * + * @return the value, or empty when the field is absent or null + * @throws me.didit.errors.UnexpectedResponseException when the field has another type + */ + public Optional> results() { + return Json.optional(json, "results", Conv.list(Conv.model(WorkflowListItem::fromJson))); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + /** Builds a {@link WorkflowsListResponse}. */ + public static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(WorkflowsListResponse from) { + super(from); + } + + /** + * Total number of workflow versions for the application. + * + * @param count the value + * @return this builder + */ + public Builder count(long count) { + return set("count", Conv.LONG, count); + } + + /** + * URL of the next page, or null on the last page. + * + * @param next the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder next(@Nullable String next) { + return setNullable("next", Conv.STRING, next); + } + + /** + * URL of the previous page, or null on the first page. + * + * @param previous the value, or {@code null} to send JSON null + * @return this builder + */ + public Builder previous(@Nullable String previous) { + return setNullable("previous", Conv.STRING, previous); + } + + /** + * The results field. + * + * @param results the value + * @return this builder + */ + public Builder results(List results) { + return set("results", Conv.list(Conv.model(WorkflowListItem::fromJson)), results); + } + + /** + * Builds the value. + * + * @return a new immutable {@code WorkflowsListResponse} + */ + public WorkflowsListResponse build() { + return new WorkflowsListResponse(buildJson(), buildFiles()); + } + + @Override + protected Builder self() { + return this; + } + } +} diff --git a/src/main/java/me/didit/types/package-info.java b/src/main/java/me/didit/types/package-info.java new file mode 100644 index 0000000..5d28b8b --- /dev/null +++ b/src/main/java/me/didit/types/package-info.java @@ -0,0 +1,6 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +/** Request and response types of the Didit API, generated from the OpenAPI documents. */ +@NullMarked +package me.didit.types; + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/me/didit/webhooks/ActivityCreatedEvent.java b/src/main/java/me/didit/webhooks/ActivityCreatedEvent.java new file mode 100644 index 0000000..cbdf1ca --- /dev/null +++ b/src/main/java/me/didit/webhooks/ActivityCreatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code activity.created}: reserved; the envelope only. */ +public final class ActivityCreatedEvent extends WebhookEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "activity.created"; + + ActivityCreatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/BusinessDataUpdatedEvent.java b/src/main/java/me/didit/webhooks/BusinessDataUpdatedEvent.java new file mode 100644 index 0000000..cbb5443 --- /dev/null +++ b/src/main/java/me/didit/webhooks/BusinessDataUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code business.data.updated}: a business's data changed. */ +public final class BusinessDataUpdatedEvent extends BusinessEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "business.data.updated"; + + BusinessDataUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/BusinessEvent.java b/src/main/java/me/didit/webhooks/BusinessEvent.java new file mode 100644 index 0000000..c1d6b89 --- /dev/null +++ b/src/main/java/me/didit/webhooks/BusinessEvent.java @@ -0,0 +1,40 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** A business event */ +public abstract class BusinessEvent extends WebhookEvent { + BusinessEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * Didit's id of {@code business.status.updated} or {@code business.data.updated}.:the business. + * + * @return the id + */ + public final Optional vendorBusinessId() { + return optional("vendor_business_id", Conv.STRING); + } + + /** + * Your reference for {@code business.status.updated} or {@code business.data.updated}.:the + * business. + * + * @return the vendor data + */ + public final Optional vendorData() { + return optional("vendor_data", Conv.STRING); + } + + /** + * The status of {@code business.status.updated} or {@code business.data.updated}.:the business. + * + * @return the status + */ + public final Optional status() { + return optional("status", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/webhooks/BusinessStatusUpdatedEvent.java b/src/main/java/me/didit/webhooks/BusinessStatusUpdatedEvent.java new file mode 100644 index 0000000..c05743f --- /dev/null +++ b/src/main/java/me/didit/webhooks/BusinessStatusUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code business.status.updated}: a business's status changed. */ +public final class BusinessStatusUpdatedEvent extends BusinessEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "business.status.updated"; + + BusinessStatusUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/CanonicalJson.java b/src/main/java/me/didit/webhooks/CanonicalJson.java new file mode 100644 index 0000000..baf3de3 --- /dev/null +++ b/src/main/java/me/didit/webhooks/CanonicalJson.java @@ -0,0 +1,250 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.JsonNode; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.MathContext; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * The canonical JSON that {@code X-Signature-V2} signs (DESIGN 9.2): Python's {@code + * json.dumps(shorten_floats(value), sort_keys=True, separators=(",", ":"), ensure_ascii=False)}. + */ +final class CanonicalJson { + private CanonicalJson() {} + + /** Thrown for values Python could not have produced, such as NaN or lone surrogates. */ + static final class InvalidValueException extends Exception { + private static final long serialVersionUID = 1L; + + InvalidValueException(String message) { + super(message); + } + } + + static String write(JsonNode value) throws InvalidValueException { + StringBuilder out = new StringBuilder(); + write(value, out, 0); + return out.toString(); + } + + private static void write(JsonNode value, StringBuilder out, int depth) + throws InvalidValueException { + if (depth > 512) { + throw new InvalidValueException("JSON nested too deeply"); + } + if (value.isObject()) { + List> entries = new ArrayList<>(value.properties()); + entries.sort((a, b) -> compareCodePoints(a.getKey(), b.getKey())); + out.append('{'); + boolean first = true; + for (Map.Entry entry : entries) { + if (!first) { + out.append(','); + } + first = false; + string(entry.getKey(), out); + out.append(':'); + write(entry.getValue(), out, depth + 1); + } + out.append('}'); + } else if (value.isArray()) { + out.append('['); + boolean first = true; + for (JsonNode item : value) { + if (!first) { + out.append(','); + } + first = false; + write(item, out, depth + 1); + } + out.append(']'); + } else if (value.isTextual()) { + string(value.textValue(), out); + } else if (value.isNumber()) { + number(value, out); + } else if (value.isBoolean()) { + out.append(value.booleanValue() ? "true" : "false"); + } else if (value.isNull()) { + out.append("null"); + } else { + throw new InvalidValueException("Unsupported JSON value: " + value.getNodeType()); + } + } + + /** Orders strings by Unicode code point, like Python, not by UTF-16 code unit. */ + static int compareCodePoints(String a, String b) { + int i = 0; + int j = 0; + while (i < a.length() && j < b.length()) { + int ca = a.codePointAt(i); + int cb = b.codePointAt(j); + if (ca != cb) { + return Integer.compare(ca, cb); + } + i += Character.charCount(ca); + j += Character.charCount(cb); + } + return Integer.compare(a.length() - i, b.length() - j); + } + + private static void string(String text, StringBuilder out) throws InvalidValueException { + out.append('"'); + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + if (Character.isHighSurrogate(c)) { + if (i + 1 < text.length() && Character.isLowSurrogate(text.charAt(i + 1))) { + out.append(c).append(text.charAt(i + 1)); + i++; + continue; + } + throw new InvalidValueException("Lone surrogate in a string"); + } + if (Character.isLowSurrogate(c)) { + throw new InvalidValueException("Lone surrogate in a string"); + } + switch (c) { + case '"': + out.append("\\\""); + break; + case '\\': + out.append("\\\\"); + break; + case '\n': + out.append("\\n"); + break; + case '\r': + out.append("\\r"); + break; + case '\t': + out.append("\\t"); + break; + case '\b': + out.append("\\b"); + break; + case '\f': + out.append("\\f"); + break; + default: + if (c < 0x20) { + out.append(String.format(java.util.Locale.ROOT, "\\u%04x", (int) c)); + } else { + out.append(c); + } + } + } + out.append('"'); + } + + /** + * Python parses a number token without a fraction or exponent as an exact integer and anything + * else as a double; {@code shorten_floats} then turns doubles with an integral value into + * integers. + */ + private static void number(JsonNode value, StringBuilder out) throws InvalidValueException { + if (value.isIntegralNumber()) { + out.append(value.bigIntegerValue().toString()); + return; + } + BigDecimal decimal = value.decimalValue(); + double d = Double.parseDouble(decimal.toString()); + if (Double.isNaN(d) || Double.isInfinite(d)) { + throw new InvalidValueException("Number out of range for a double: " + decimal); + } + if (d == Math.rint(d)) { + out.append(new BigDecimal(d).toBigIntegerExact().toString()); + return; + } + out.append(pythonRepr(d)); + } + + /** + * Python's {@code repr(float)}: the shortest digits that read back as the same double, in + * scientific notation when the decimal exponent is below -4 or at least 16. + */ + static String pythonRepr(double d) { + if (d == 0) { + return (1 / d < 0) ? "-0.0" : "0.0"; + } + BigDecimal shortest = shortest(d); + String sign = shortest.signum() < 0 ? "-" : ""; + BigDecimal abs = shortest.abs(); + String digits = abs.unscaledValue().toString(); + // Strip trailing zeros from the digits while keeping the value. + int trailing = 0; + while (trailing < digits.length() - 1 && digits.charAt(digits.length() - 1 - trailing) == '0') { + trailing++; + } + digits = digits.substring(0, digits.length() - trailing); + int scale = abs.scale() - trailing; + // value = 0.digits * 10^exponent10 where exponent10 = digits.length - scale + int pointPosition = digits.length() - scale; + int exponent = pointPosition - 1; + if (exponent < -4 || exponent >= 16) { + StringBuilder out = new StringBuilder(sign).append(digits.charAt(0)); + if (digits.length() > 1) { + out.append('.').append(digits, 1, digits.length()); + } + out.append('e').append(exponent < 0 ? '-' : '+'); + int e = Math.abs(exponent); + if (e < 10) { + out.append('0'); + } + return out.append(e).toString(); + } + StringBuilder out = new StringBuilder(sign); + if (pointPosition <= 0) { + out.append("0."); + for (int i = 0; i < -pointPosition; i++) { + out.append('0'); + } + out.append(digits); + } else if (pointPosition >= digits.length()) { + out.append(digits); + for (int i = digits.length(); i < pointPosition; i++) { + out.append('0'); + } + out.append(".0"); + } else { + out.append(digits, 0, pointPosition) + .append('.') + .append(digits, pointPosition, digits.length()); + } + return out.toString(); + } + + /** + * The shortest decimal that reads back as {@code d}; among candidates of that length, the one + * closest to the exact binary value, like David Gay's algorithm that Python uses. + */ + static BigDecimal shortest(double d) { + BigDecimal exact = new BigDecimal(d); + for (int precision = 1; precision <= 17; precision++) { + BigDecimal down = exact.round(new MathContext(precision, RoundingMode.DOWN)); + BigDecimal up = exact.round(new MathContext(precision, RoundingMode.UP)); + boolean downOk = Double.parseDouble(down.toString()) == d; + boolean upOk = Double.parseDouble(up.toString()) == d; + if (downOk && upOk) { + int cmp = exact.subtract(down).abs().compareTo(up.subtract(exact).abs()); + if (cmp < 0) { + return down; + } + if (cmp > 0) { + return up; + } + BigInteger lastDown = down.unscaledValue(); + return lastDown.testBit(0) ? up : down; + } + if (downOk) { + return down; + } + if (upOk) { + return up; + } + } + return exact.round(new MathContext(17, RoundingMode.HALF_EVEN)); + } +} diff --git a/src/main/java/me/didit/webhooks/KybRegistrySearchResolvedEvent.java b/src/main/java/me/didit/webhooks/KybRegistrySearchResolvedEvent.java new file mode 100644 index 0000000..811a9d9 --- /dev/null +++ b/src/main/java/me/didit/webhooks/KybRegistrySearchResolvedEvent.java @@ -0,0 +1,17 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** + * {@code kyb.registry_search.resolved}: a business registry search finished. Didit delivers it + * unsigned today, so {@link Webhooks#verify} rejects it with {@code missing_signature}; {@link + * Webhooks#parseEvent} reads it. + */ +public final class KybRegistrySearchResolvedEvent extends WebhookEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "kyb.registry_search.resolved"; + + KybRegistrySearchResolvedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/SessionDataUpdatedEvent.java b/src/main/java/me/didit/webhooks/SessionDataUpdatedEvent.java new file mode 100644 index 0000000..936f60a --- /dev/null +++ b/src/main/java/me/didit/webhooks/SessionDataUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code data.updated}: the data of a verification session changed. */ +public final class SessionDataUpdatedEvent extends SessionEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "data.updated"; + + SessionDataUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/SessionEvent.java b/src/main/java/me/didit/webhooks/SessionEvent.java new file mode 100644 index 0000000..f90f474 --- /dev/null +++ b/src/main/java/me/didit/webhooks/SessionEvent.java @@ -0,0 +1,107 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Map; +import java.util.Optional; +import me.didit.core.Conv; +import me.didit.types.SessionsRetrieveDecisionResponse; + +/** A verification session event: {@code status.updated} or {@code data.updated}. */ +public abstract class SessionEvent extends WebhookEvent { + SessionEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * The session id. + * + * @return the id + */ + public final Optional sessionId() { + return optional("session_id", Conv.STRING); + } + + /** + * The business session id, for KYB sessions. + * + * @return the id + */ + public final Optional businessSessionId() { + return optional("business_session_id", Conv.STRING); + } + + /** + * {@code user} (KYC) or {@code business} (KYB). + * + * @return the session kind + */ + public final Optional sessionKind() { + return optional("session_kind", Conv.STRING); + } + + /** + * The session status, for example {@code Approved}. + * + * @return the status + */ + public final Optional status() { + return optional("status", Conv.STRING); + } + + /** + * The workflow of the session. + * + * @return the workflow id + */ + public final Optional workflowId() { + return optional("workflow_id", Conv.STRING); + } + + /** + * The workflow version the session ran. + * + * @return the version + */ + public final Optional workflowVersion() { + return optional("workflow_version", Conv.LONG); + } + + /** + * Your reference for the user or business, as given when the session was created. + * + * @return the vendor data + */ + public final Optional vendorData() { + return optional("vendor_data", Conv.STRING); + } + + /** + * The metadata given when the session was created. + * + * @return the metadata + */ + public final Optional> metadata() { + return optional("metadata", Conv.OBJECT); + } + + /** + * The decision, sent with {@code Approved}, {@code Declined}, {@code In Review} and {@code + * Abandoned}. Its fields depend on the application's webhook version; read raw values with {@link + * SessionsRetrieveDecisionResponse#_json()}. + * + * @return the decision + */ + public final Optional decision() { + return optional("decision", Conv.model(SessionsRetrieveDecisionResponse::fromJson)); + } + + /** + * What the user must resubmit, sent with {@code Resubmitted}. + * + * @return {@code nodes_to_resubmit} and {@code reasons} + */ + public final Optional resubmitInfo() { + return optional("resubmit_info", Conv.ANY); + } +} diff --git a/src/main/java/me/didit/webhooks/SessionStatusUpdatedEvent.java b/src/main/java/me/didit/webhooks/SessionStatusUpdatedEvent.java new file mode 100644 index 0000000..305652c --- /dev/null +++ b/src/main/java/me/didit/webhooks/SessionStatusUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code status.updated}: a verification session changed status. */ +public final class SessionStatusUpdatedEvent extends SessionEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "status.updated"; + + SessionStatusUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/TransactionCreatedEvent.java b/src/main/java/me/didit/webhooks/TransactionCreatedEvent.java new file mode 100644 index 0000000..3843496 --- /dev/null +++ b/src/main/java/me/didit/webhooks/TransactionCreatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code transaction.created}: a transaction was screened. */ +public final class TransactionCreatedEvent extends TransactionEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "transaction.created"; + + TransactionCreatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/TransactionEvent.java b/src/main/java/me/didit/webhooks/TransactionEvent.java new file mode 100644 index 0000000..2e961f4 --- /dev/null +++ b/src/main/java/me/didit/webhooks/TransactionEvent.java @@ -0,0 +1,97 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; +import me.didit.types.TransactionDetail; + +/** + * A transaction monitoring event: {@code transaction.created} or {@code + * transaction.status.updated}. + */ +public abstract class TransactionEvent extends WebhookEvent { + TransactionEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * Didit's transaction id. + * + * @return the id + */ + public final Optional transactionId() { + return optional("transaction_id", Conv.STRING); + } + + /** + * Your transaction reference. + * + * @return the reference + */ + public final Optional txnId() { + return optional("txn_id", Conv.STRING); + } + + /** + * The transaction status. + * + * @return the status + */ + public final Optional status() { + return optional("status", Conv.STRING); + } + + /** + * The risk score. + * + * @return the score + */ + public final Optional score() { + return optional("score", Conv.DOUBLE); + } + + /** + * The severity. + * + * @return the severity + */ + public final Optional severity() { + return optional("severity", Conv.STRING); + } + + /** + * The amount, as a decimal string. + * + * @return the amount + */ + public final Optional amount() { + return optional("amount", Conv.STRING); + } + + /** + * The currency. + * + * @return the currency + */ + public final Optional currency() { + return optional("currency", Conv.STRING); + } + + /** + * {@code inbound} or {@code outbound}. + * + * @return the direction + */ + public final Optional direction() { + return optional("direction", Conv.STRING); + } + + /** + * The action the subject must take, when one is required. + * + * @return the action + */ + public final Optional actionRequired() { + return optional("action_required", Conv.union(TransactionDetail.ActionRequired::fromJson)); + } +} diff --git a/src/main/java/me/didit/webhooks/TransactionStatusUpdatedEvent.java b/src/main/java/me/didit/webhooks/TransactionStatusUpdatedEvent.java new file mode 100644 index 0000000..327c2b0 --- /dev/null +++ b/src/main/java/me/didit/webhooks/TransactionStatusUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code transaction.status.updated}: a transaction changed status. */ +public final class TransactionStatusUpdatedEvent extends TransactionEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "transaction.status.updated"; + + TransactionStatusUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/TravelRuleStatusUpdatedEvent.java b/src/main/java/me/didit/webhooks/TravelRuleStatusUpdatedEvent.java new file mode 100644 index 0000000..05331dd --- /dev/null +++ b/src/main/java/me/didit/webhooks/TravelRuleStatusUpdatedEvent.java @@ -0,0 +1,60 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** {@code travel_rule.status.updated}: the Travel Rule status of a transaction changed. */ +public final class TravelRuleStatusUpdatedEvent extends WebhookEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "travel_rule.status.updated"; + + TravelRuleStatusUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * Didit's transaction id. + * + * @return the id + */ + public Optional transactionId() { + return optional("transaction_id", Conv.STRING); + } + + /** + * Your transaction reference. + * + * @return the reference + */ + public Optional txnId() { + return optional("txn_id", Conv.STRING); + } + + /** + * The Travel Rule status. + * + * @return the status + */ + public Optional travelRuleStatus() { + return optional("travel_rule_status", Conv.STRING); + } + + /** + * The Travel Rule rail, for example a protocol name. + * + * @return the rail + */ + public Optional rail() { + return optional("rail", Conv.STRING); + } + + /** + * {@code inbound} or {@code outbound}. + * + * @return the direction + */ + public Optional direction() { + return optional("direction", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/webhooks/UnknownEvent.java b/src/main/java/me/didit/webhooks/UnknownEvent.java new file mode 100644 index 0000000..240d015 --- /dev/null +++ b/src/main/java/me/didit/webhooks/UnknownEvent.java @@ -0,0 +1,22 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** + * An event type this SDK version does not know. The payload is kept: read it with {@link + * #payload()}. + */ +public final class UnknownEvent extends WebhookEvent { + UnknownEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * The whole payload. + * + * @return a copy of the JSON object + */ + public ObjectNode payload() { + return _json(); + } +} diff --git a/src/main/java/me/didit/webhooks/UserDataUpdatedEvent.java b/src/main/java/me/didit/webhooks/UserDataUpdatedEvent.java new file mode 100644 index 0000000..74b60c8 --- /dev/null +++ b/src/main/java/me/didit/webhooks/UserDataUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code user.data.updated}: a user's data changed. */ +public final class UserDataUpdatedEvent extends UserEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "user.data.updated"; + + UserDataUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/UserEvent.java b/src/main/java/me/didit/webhooks/UserEvent.java new file mode 100644 index 0000000..3d237b2 --- /dev/null +++ b/src/main/java/me/didit/webhooks/UserEvent.java @@ -0,0 +1,39 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** A user event */ +public abstract class UserEvent extends WebhookEvent { + UserEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * Didit's id of {@code user.status.updated} or {@code user.data.updated}.:the user. + * + * @return the id + */ + public final Optional vendorUserId() { + return optional("vendor_user_id", Conv.STRING); + } + + /** + * Your reference for {@code user.status.updated} or {@code user.data.updated}.:the user. + * + * @return the vendor data + */ + public final Optional vendorData() { + return optional("vendor_data", Conv.STRING); + } + + /** + * The status of {@code user.status.updated} or {@code user.data.updated}.:the user. + * + * @return the status + */ + public final Optional status() { + return optional("status", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/webhooks/UserStatusUpdatedEvent.java b/src/main/java/me/didit/webhooks/UserStatusUpdatedEvent.java new file mode 100644 index 0000000..bfe3fd4 --- /dev/null +++ b/src/main/java/me/didit/webhooks/UserStatusUpdatedEvent.java @@ -0,0 +1,13 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** {@code user.status.updated}: a user's status changed. */ +public final class UserStatusUpdatedEvent extends UserEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "user.status.updated"; + + UserStatusUpdatedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } +} diff --git a/src/main/java/me/didit/webhooks/VerifiedBy.java b/src/main/java/me/didit/webhooks/VerifiedBy.java new file mode 100644 index 0000000..1fbddca --- /dev/null +++ b/src/main/java/me/didit/webhooks/VerifiedBy.java @@ -0,0 +1,17 @@ +package me.didit.webhooks; + +/** Which signature authenticated a webhook delivery. */ +public enum VerifiedBy { + /** {@code X-Signature} (or its {@code -Previous}): the HMAC of the exact body bytes. */ + SIGNATURE, + /** {@code X-Signature-V2} (or its {@code -Previous}): the HMAC of the canonical JSON. */ + SIGNATURE_V2, + /** + * {@code X-Signature-Simple} (or its {@code -Previous}), accepted only with {@code allowSimple}. + * It covers the envelope only: the body is not authenticated, so re-fetch the record from the API + * before acting on it. + */ + SIGNATURE_SIMPLE, + /** Not verified: the event was parsed with {@link Webhooks#parseEvent}. */ + NONE +} diff --git a/src/main/java/me/didit/webhooks/VerifyOptions.java b/src/main/java/me/didit/webhooks/VerifyOptions.java new file mode 100644 index 0000000..268f3e0 --- /dev/null +++ b/src/main/java/me/didit/webhooks/VerifyOptions.java @@ -0,0 +1,163 @@ +package me.didit.webhooks; + +import java.time.Clock; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Options of {@link Webhooks#verify}: the secrets, the timestamp tolerance and whether the + * deprecated Simple signature is accepted. + * + *

{@code
+ * VerifyOptions options = VerifyOptions.builder()
+ *     .secret(System.getenv("DIDIT_WEBHOOK_SECRET"))
+ *     .secret(System.getenv("DIDIT_WEBHOOK_SECRET_PREVIOUS")) // during a rotation
+ *     .build();
+ * }
+ */ +public final class VerifyOptions { + /** The default tolerance between the delivery timestamp and now. */ + public static final Duration DEFAULT_TOLERANCE = Duration.ofMinutes(5); + + private final List secrets; + private final Duration tolerance; + private final boolean allowSimple; + private final Clock clock; + + private VerifyOptions(Builder b) { + this.secrets = List.copyOf(b.secrets); + this.tolerance = b.tolerance; + this.allowSimple = b.allowSimple; + this.clock = b.clock; + } + + /** + * Options with one secret and the defaults. + * + * @param secret the endpoint's webhook secret + * @return the options + */ + public static VerifyOptions of(String secret) { + return builder().secret(secret).build(); + } + + /** + * Returns an empty builder. + * + * @return a new builder + */ + public static Builder builder() { + return new Builder(); + } + + List secrets() { + return secrets; + } + + Duration tolerance() { + return tolerance; + } + + boolean allowSimple() { + return allowSimple; + } + + Clock clock() { + return clock; + } + + @Override + public String toString() { + return "VerifyOptions{secrets=" + + secrets.size() + + ", tolerance=" + + tolerance + + ", allowSimple=" + + allowSimple + + "}"; + } + + /** Builds {@link VerifyOptions}. */ + public static final class Builder { + private final List secrets = new ArrayList<>(); + private Duration tolerance = DEFAULT_TOLERANCE; + private boolean allowSimple; + private Clock clock = Clock.systemUTC(); + + private Builder() {} + + /** + * Adds a secret. Add the current and the previous secret during a rotation. + * + * @param secret a webhook secret + * @return this builder + */ + public Builder secret(String secret) { + secrets.add(Objects.requireNonNull(secret, "secret")); + return this; + } + + /** + * Adds several secrets. + * + * @param secrets webhook secrets + * @return this builder + */ + public Builder secrets(List secrets) { + for (String secret : secrets) { + secret(secret); + } + return this; + } + + /** + * The largest accepted difference between the delivery timestamp and now. Defaults to 300 + * seconds. + * + * @param tolerance zero or more + * @return this builder + */ + public Builder tolerance(Duration tolerance) { + Objects.requireNonNull(tolerance, "tolerance"); + if (tolerance.isNegative()) { + throw new IllegalArgumentException("tolerance must not be negative"); + } + this.tolerance = tolerance; + return this; + } + + /** + * Accepts the deprecated {@code X-Signature-Simple}, which authenticates the envelope only. Off + * by default. {@link Webhooks#verifyParsed} ignores it: it checks {@code X-Signature-V2} only. + * + * @param allowSimple whether to accept it + * @return this builder + */ + public Builder allowSimple(boolean allowSimple) { + this.allowSimple = allowSimple; + return this; + } + + /** + * The clock that gives "now", for tests. + * + * @param clock the clock + * @return this builder + */ + public Builder clock(Clock clock) { + this.clock = Objects.requireNonNull(clock, "clock"); + return this; + } + + /** + * Builds the options. + * + * @return the options + */ + public VerifyOptions build() { + return new VerifyOptions(this); + } + } +} diff --git a/src/main/java/me/didit/webhooks/WebhookEvent.java b/src/main/java/me/didit/webhooks/WebhookEvent.java new file mode 100644 index 0000000..5363cae --- /dev/null +++ b/src/main/java/me/didit/webhooks/WebhookEvent.java @@ -0,0 +1,176 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; +import me.didit.core.Json; + +/** + * A verified webhook delivery (DESIGN 9.4). Check the concrete type with {@code instanceof} (or + * Kotlin's {@code when}); unknown types arrive as {@link UnknownEvent}. + * + *

Every getter is lenient: fields Didit does not send for a given event are empty, and {@link + * #_json()} returns the whole payload. + */ +public abstract class WebhookEvent { + /** The payload, owned by this event. */ + final ObjectNode json; + + private final VerifiedBy verifiedBy; + + WebhookEvent(ObjectNode json, VerifiedBy verifiedBy) { + this.json = json; + this.verifiedBy = verifiedBy; + } + + static WebhookEvent of(ObjectNode json, VerifiedBy verifiedBy) { + String type = type(json); + switch (type) { + case SessionStatusUpdatedEvent.TYPE: + return new SessionStatusUpdatedEvent(json, verifiedBy); + case SessionDataUpdatedEvent.TYPE: + return new SessionDataUpdatedEvent(json, verifiedBy); + case UserStatusUpdatedEvent.TYPE: + return new UserStatusUpdatedEvent(json, verifiedBy); + case UserDataUpdatedEvent.TYPE: + return new UserDataUpdatedEvent(json, verifiedBy); + case BusinessStatusUpdatedEvent.TYPE: + return new BusinessStatusUpdatedEvent(json, verifiedBy); + case BusinessDataUpdatedEvent.TYPE: + return new BusinessDataUpdatedEvent(json, verifiedBy); + case ActivityCreatedEvent.TYPE: + return new ActivityCreatedEvent(json, verifiedBy); + case TransactionCreatedEvent.TYPE: + return new TransactionCreatedEvent(json, verifiedBy); + case TransactionStatusUpdatedEvent.TYPE: + return new TransactionStatusUpdatedEvent(json, verifiedBy); + case TravelRuleStatusUpdatedEvent.TYPE: + return new TravelRuleStatusUpdatedEvent(json, verifiedBy); + case WorkflowComplianceChangedEvent.TYPE: + return new WorkflowComplianceChangedEvent(json, verifiedBy); + case KybRegistrySearchResolvedEvent.TYPE: + return new KybRegistrySearchResolvedEvent(json, verifiedBy); + default: + return new UnknownEvent(json, verifiedBy); + } + } + + /** {@code webhook_type}, or {@code event_type} for deliveries that use that name. */ + static String type(ObjectNode json) { + for (String field : new String[] {"webhook_type", "event_type"}) { + JsonNode value = json.get(field); + if (value != null && value.isTextual()) { + return value.textValue(); + } + } + return ""; + } + + /** + * The event type, for example {@code status.updated}. + * + * @return the type; empty when the payload names none + */ + public final String webhookType() { + return type(json); + } + + /** + * The unique id of this event; use it to drop duplicate deliveries. + * + * @return the id + */ + public final Optional eventId() { + return optional("event_id", Conv.STRING); + } + + /** + * When the delivery was signed, in unix seconds. + * + * @return the timestamp + */ + public final Optional timestamp() { + return optional("timestamp", Conv.LONG); + } + + /** + * When the change happened, in unix seconds. + * + * @return the time + */ + public final Optional createdAt() { + return optional("created_at", Conv.LONG); + } + + /** + * The application the event belongs to. + * + * @return the application id + */ + public final Optional applicationId() { + return optional("application_id", Conv.STRING); + } + + /** + * {@code live} or {@code sandbox}. + * + * @return the environment + */ + public final Optional environment() { + return optional("environment", Conv.STRING); + } + + /** + * Whether the event comes from a sandbox application. + * + * @return true for sandbox events + */ + public final boolean isSandbox() { + return environment().map("sandbox"::equals).orElse(false); + } + + /** + * Which signature verified the delivery. + * + * @return the signature kind + */ + public final VerifiedBy verifiedBy() { + return verifiedBy; + } + + /** + * Whether the whole body is authenticated. False when only the deprecated Simple signature + * matched: then re-fetch the record from the API before acting on it. + * + * @return true for {@code X-Signature} and {@code X-Signature-V2} + */ + public final boolean isBodyAuthenticated() { + return verifiedBy == VerifiedBy.SIGNATURE || verifiedBy == VerifiedBy.SIGNATURE_V2; + } + + /** + * A copy of the whole payload. + * + * @return the JSON object + */ + public final ObjectNode _json() { + return json.deepCopy(); + } + + final Optional optional(String field, Conv conv) { + return Json.optional(json, field, conv); + } + + @Override + public String toString() { + return getClass().getSimpleName() + + "{type=" + + webhookType() + + ", eventId=" + + eventId().orElse("none") + + ", verifiedBy=" + + verifiedBy + + "}"; + } +} diff --git a/src/main/java/me/didit/webhooks/WebhookMethods.java b/src/main/java/me/didit/webhooks/WebhookMethods.java new file mode 100644 index 0000000..71daa05 --- /dev/null +++ b/src/main/java/me/didit/webhooks/WebhookMethods.java @@ -0,0 +1,64 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.Map; +import java.util.function.Function; +import org.jspecify.annotations.Nullable; + +/** + * The webhook helpers reachable as {@code client.webhooks().verify(...)}; they do the same as the + * static methods of {@link Webhooks} and need no API key. + */ +public abstract class WebhookMethods { + /** Creates the helpers. */ + protected WebhookMethods() {} + + /** + * Verifies a delivery. See {@link Webhooks#verify(String, Map, String)}. + * + * @param rawBody the request body exactly as received + * @param headers the request headers + * @param secret the endpoint's webhook secret + * @return the typed event + */ + public final WebhookEvent verify(String rawBody, Map headers, String secret) { + return Webhooks.verify(rawBody, headers, secret); + } + + /** + * Verifies a delivery. See {@link Webhooks#verify(byte[], Map, VerifyOptions)}. + * + * @param rawBody the request body exactly as received + * @param headers the request headers + * @param options the secrets, tolerance and Simple opt-in + * @return the typed event + */ + public final WebhookEvent verify(byte[] rawBody, Map headers, VerifyOptions options) { + return Webhooks.verify(rawBody, headers, options); + } + + /** + * Verifies a delivery. See {@link Webhooks#verify(byte[], Function, VerifyOptions)}. + * + * @param rawBody the request body exactly as received + * @param headers returns a header's value by name, or {@code null} + * @param options the secrets, tolerance and Simple opt-in + * @return the typed event + */ + public final WebhookEvent verify( + byte[] rawBody, Function headers, VerifyOptions options) { + return Webhooks.verify(rawBody, headers, options); + } + + /** + * Verifies a parsed delivery. See {@link Webhooks#verifyParsed(JsonNode, Map, String)}. + * + * @param payload the parsed JSON body + * @param headers the request headers + * @param secret the endpoint's webhook secret + * @return the typed event + */ + public final WebhookEvent verifyParsed(JsonNode payload, Map headers, String secret) { + return Webhooks.verifyParsed(payload, headers, secret); + } +} diff --git a/src/main/java/me/didit/webhooks/Webhooks.java b/src/main/java/me/didit/webhooks/Webhooks.java new file mode 100644 index 0000000..1cb2c77 --- /dev/null +++ b/src/main/java/me/didit/webhooks/Webhooks.java @@ -0,0 +1,548 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.json.JsonReadFeature; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.cfg.JsonNodeFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CodingErrorAction; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.regex.Pattern; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import me.didit.core.Json; +import me.didit.errors.ConfigurationException; +import me.didit.errors.WebhookVerificationException; +import me.didit.errors.WebhookVerificationException.Reason; +import org.jspecify.annotations.Nullable; + +/** + * Verifies Didit webhook deliveries and parses them into typed events (DESIGN 9). No framework + * dependency: pass the raw body and the request headers. + * + *

{@code
+ * WebhookEvent event = Webhooks.verify(rawBody, headers, System.getenv("DIDIT_WEBHOOK_SECRET"));
+ * if (event instanceof SessionStatusUpdatedEvent) {
+ *   SessionStatusUpdatedEvent e = (SessionStatusUpdatedEvent) event;
+ *   System.out.println(e.sessionId() + " is " + e.status());
+ * }
+ * }
+ * + *

Verify the raw body whenever your framework gives access to it. {@code X-Signature-V2} also + * survives middleware that re-encodes JSON, and {@link #verifyParsed} checks only that one. + */ +public final class Webhooks { + /** The signature headers, current secret first. */ + static final String SIGNATURE = "X-Signature"; + + static final String SIGNATURE_PREVIOUS = "X-Signature-Previous"; + static final String SIGNATURE_V2 = "X-Signature-V2"; + static final String SIGNATURE_V2_PREVIOUS = "X-Signature-V2-Previous"; + static final String SIGNATURE_SIMPLE = "X-Signature-Simple"; + static final String SIGNATURE_SIMPLE_PREVIOUS = "X-Signature-Simple-Previous"; + static final String TIMESTAMP = "X-Timestamp"; + + private static final List ALL_SIGNATURES = + List.of( + SIGNATURE, + SIGNATURE_PREVIOUS, + SIGNATURE_V2, + SIGNATURE_V2_PREVIOUS, + SIGNATURE_SIMPLE, + SIGNATURE_SIMPLE_PREVIOUS); + private static final Pattern HEX64 = Pattern.compile("[0-9a-f]{64}"); + private static final Pattern DIGITS = Pattern.compile("[0-9]{1,20}"); + + private static final ObjectMapper STRICT = + JsonMapper.builder() + .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) + .configure(JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES, false) + .disable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS) + .enable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS) + .build(); + + static { + STRICT + .getFactory() + .setStreamReadConstraints(StreamReadConstraints.builder().maxNestingDepth(500).build()); + } + + private Webhooks() {} + + /** + * Verifies a delivery with one secret and the default options. + * + * @param rawBody the request body exactly as received + * @param headers the request headers; values may be strings or lists of strings + * @param secret the endpoint's webhook secret + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when the secret is empty + */ + public static WebhookEvent verify(String rawBody, Map headers, String secret) { + return verify( + rawBody.getBytes(StandardCharsets.UTF_8), lookup(headers), VerifyOptions.of(secret)); + } + + /** + * Verifies a delivery with one secret and the default options. + * + * @param rawBody the request body exactly as received + * @param headers the request headers; values may be strings or lists of strings + * @param secret the endpoint's webhook secret + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when the secret is empty + */ + public static WebhookEvent verify(byte[] rawBody, Map headers, String secret) { + return verify(rawBody, lookup(headers), VerifyOptions.of(secret)); + } + + /** + * Verifies a delivery. + * + * @param rawBody the request body exactly as received + * @param headers the request headers; values may be strings or lists of strings + * @param options the secrets, tolerance and Simple opt-in + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when no secret or an empty one is given + */ + public static WebhookEvent verify(String rawBody, Map headers, VerifyOptions options) { + return verify(rawBody.getBytes(StandardCharsets.UTF_8), lookup(headers), options); + } + + /** + * Verifies a delivery. + * + * @param rawBody the request body exactly as received + * @param headers the request headers; values may be strings or lists of strings + * @param options the secrets, tolerance and Simple opt-in + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when no secret or an empty one is given + */ + public static WebhookEvent verify(byte[] rawBody, Map headers, VerifyOptions options) { + return verify(rawBody, lookup(headers), options); + } + + /** + * Verifies a delivery with one secret, reading headers through a function such as {@code + * request::getHeader} (Servlet) or {@code headers::getFirst} (Spring). + * + * @param rawBody the request body exactly as received + * @param headers returns a header's value by name, or {@code null} + * @param secret the endpoint's webhook secret + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when the secret is empty + */ + public static WebhookEvent verify( + byte[] rawBody, Function headers, String secret) { + return verify(rawBody, headers, VerifyOptions.of(secret)); + } + + /** + * Verifies a delivery, reading headers through a function such as {@code request::getHeader}. + * + * @param rawBody the request body exactly as received + * @param headers returns a header's value by name, or {@code null} + * @param options the secrets, tolerance and Simple opt-in + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when no secret or an empty one is given + */ + public static WebhookEvent verify( + byte[] rawBody, Function headers, VerifyOptions options) { + List secrets = secrets(options); + ObjectNode payload = parse(rawBody); + checkTimestamp(payload, headers, options); + requireAnySignature(headers); + for (String secret : secrets) { + String expected = hmac(secret, rawBody); + if (matches(expected, headers, SIGNATURE) || matches(expected, headers, SIGNATURE_PREVIOUS)) { + return WebhookEvent.of(payload, VerifiedBy.SIGNATURE); + } + } + return verifyCanonicalOrSimple(payload, headers, secrets, options.allowSimple()); + } + + /** + * Verifies a delivery whose body the framework already parsed. Only {@code X-Signature-V2} can be + * checked this way; prefer {@link #verify} with the raw body. + * + * @param payload the parsed JSON body + * @param headers the request headers; values may be strings or lists of strings + * @param secret the endpoint's webhook secret + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when the secret is empty + */ + public static WebhookEvent verifyParsed(JsonNode payload, Map headers, String secret) { + return verifyParsed(payload, lookup(headers), VerifyOptions.of(secret)); + } + + /** + * Verifies a delivery whose body the framework parsed into a map (for example Spring's + * {@code @RequestBody Map}). Only {@code X-Signature-V2} can be checked this way. + * + * @param payload the parsed JSON body + * @param headers the request headers; values may be strings or lists of strings + * @param secret the endpoint's webhook secret + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when the secret is empty + */ + public static WebhookEvent verifyParsed( + Map payload, Map headers, String secret) { + return verifyParsed(Json.toNode(payload), lookup(headers), VerifyOptions.of(secret)); + } + + /** + * Verifies a delivery whose body the framework already parsed. Only {@code X-Signature-V2} can be + * checked this way; {@link VerifyOptions.Builder#allowSimple} applies to {@link #verify} only. + * + * @param payload the parsed JSON body + * @param headers the request headers; values may be strings or lists of strings + * @param options the secrets and tolerance + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when no secret or an empty one is given + */ + public static WebhookEvent verifyParsed( + JsonNode payload, Map headers, VerifyOptions options) { + return verifyParsed(payload, lookup(headers), options); + } + + /** + * Verifies a delivery whose body the framework already parsed, reading headers through a + * function. Only {@code X-Signature-V2} can be checked this way; {@link + * VerifyOptions.Builder#allowSimple} applies to {@link #verify} only. + * + * @param payload the parsed JSON body + * @param headers returns a header's value by name, or {@code null} + * @param options the secrets and tolerance + * @return the typed event + * @throws WebhookVerificationException when the delivery is not authentic or not fresh + * @throws ConfigurationException when no secret or an empty one is given + */ + public static WebhookEvent verifyParsed( + JsonNode payload, Function headers, VerifyOptions options) { + List secrets = secrets(options); + if (!payload.isObject()) { + throw new WebhookVerificationException( + Reason.INVALID_PAYLOAD, "The body is not a JSON object"); + } + ObjectNode object = ((ObjectNode) payload).deepCopy(); + checkTimestamp(object, headers, options); + requireAnySignature(headers); + return verifyCanonicalOrSimple(object, headers, secrets, false); + } + + /** + * The canonical JSON of a body: what {@code X-Signature-V2} signs (DESIGN 9.2). + * + * @param rawBody the request body + * @return the canonical JSON + * @throws WebhookVerificationException with {@code invalid_payload} when the body is not JSON + * Didit could have sent + */ + public static String canonicalJson(String rawBody) { + return canonical(parse(rawBody.getBytes(StandardCharsets.UTF_8))); + } + + /** + * The canonical JSON of a parsed body. + * + * @param payload the parsed body + * @return the canonical JSON + * @throws WebhookVerificationException with {@code invalid_payload} for NaN, infinite numbers or + * lone surrogates + */ + public static String canonicalJson(JsonNode payload) { + return canonical(payload); + } + + /** + * Parses a payload into a typed event without verifying it, for payloads that were verified + * elsewhere or for tests. {@link WebhookEvent#verifiedBy()} is {@link VerifiedBy#NONE}. + * + * @param payload the JSON body + * @return the typed event + * @throws WebhookVerificationException with {@code invalid_payload} when it is not an object + */ + public static WebhookEvent parseEvent(JsonNode payload) { + if (!payload.isObject()) { + throw new WebhookVerificationException( + Reason.INVALID_PAYLOAD, "The body is not a JSON object"); + } + return WebhookEvent.of(((ObjectNode) payload).deepCopy(), VerifiedBy.NONE); + } + + // -- steps ------------------------------------------------------------------- + + private static WebhookEvent verifyCanonicalOrSimple( + ObjectNode payload, + Function headers, + List secrets, + boolean allowSimple) { + boolean anyV2 = present(headers, SIGNATURE_V2) || present(headers, SIGNATURE_V2_PREVIOUS); + if (anyV2) { + byte[] canonical = canonical(payload).getBytes(StandardCharsets.UTF_8); + for (String secret : secrets) { + String expected = hmac(secret, canonical); + if (matches(expected, headers, SIGNATURE_V2) + || matches(expected, headers, SIGNATURE_V2_PREVIOUS)) { + return WebhookEvent.of(payload, VerifiedBy.SIGNATURE_V2); + } + } + } + if (allowSimple) { + byte[] simple = simpleString(payload).getBytes(StandardCharsets.UTF_8); + for (String secret : secrets) { + String expected = hmac(secret, simple); + if (matches(expected, headers, SIGNATURE_SIMPLE) + || matches(expected, headers, SIGNATURE_SIMPLE_PREVIOUS)) { + return WebhookEvent.of(payload, VerifiedBy.SIGNATURE_SIMPLE); + } + } + } + throw new WebhookVerificationException( + Reason.INVALID_SIGNATURE, "No webhook signature matched the secret"); + } + + private static List secrets(VerifyOptions options) { + List secrets = options.secrets(); + if (secrets.isEmpty()) { + throw new ConfigurationException("A webhook secret is required"); + } + for (String secret : secrets) { + if (secret.trim().isEmpty()) { + throw new ConfigurationException("A webhook secret must not be empty"); + } + } + return secrets; + } + + static ObjectNode parse(byte[] rawBody) { + try { + StandardCharsets.UTF_8 + .newDecoder() + .onMalformedInput(CodingErrorAction.REPORT) + .onUnmappableCharacter(CodingErrorAction.REPORT) + .decode(ByteBuffer.wrap(rawBody)); + } catch (CharacterCodingException e) { + throw new WebhookVerificationException(Reason.INVALID_PAYLOAD, "The body is not UTF-8"); + } + JsonNode node; + try (JsonParser parser = STRICT.createParser(rawBody)) { + node = STRICT.readTree(parser); + if (parser.nextToken() != null) { + throw new WebhookVerificationException(Reason.INVALID_PAYLOAD, "Trailing data after JSON"); + } + } catch (IOException e) { + throw new WebhookVerificationException(Reason.INVALID_PAYLOAD, "The body is not valid JSON"); + } + if (node == null || !node.isObject()) { + throw new WebhookVerificationException( + Reason.INVALID_PAYLOAD, "The body is not a JSON object"); + } + return (ObjectNode) node; + } + + private static void checkTimestamp( + ObjectNode payload, Function headers, VerifyOptions options) { + JsonNode value = payload.get("timestamp"); + if (value == null || !value.isIntegralNumber()) { + throw new WebhookVerificationException( + Reason.MISSING_TIMESTAMP, "The body has no integer timestamp"); + } + BigInteger timestamp = value.bigIntegerValue(); + String header = header(headers, TIMESTAMP); + if (header != null) { + if (!DIGITS.matcher(header).matches() || !new BigInteger(header).equals(timestamp)) { + throw new WebhookVerificationException( + Reason.TIMESTAMP_MISMATCH, "X-Timestamp differs from the body's timestamp"); + } + } + BigInteger now = BigInteger.valueOf(options.clock().instant().getEpochSecond()); + BigInteger tolerance = BigInteger.valueOf(options.tolerance().toSeconds()); + if (now.subtract(timestamp).abs().compareTo(tolerance) > 0) { + throw new WebhookVerificationException( + Reason.TIMESTAMP_OUT_OF_TOLERANCE, + "The delivery timestamp is more than " + tolerance + " seconds from now"); + } + } + + private static void requireAnySignature(Function headers) { + for (String name : ALL_SIGNATURES) { + if (present(headers, name)) { + return; + } + } + throw new WebhookVerificationException( + Reason.MISSING_SIGNATURE, "The delivery has no signature header"); + } + + private static String canonical(JsonNode payload) { + try { + return CanonicalJson.write(payload); + } catch (CanonicalJson.InvalidValueException e) { + throw new WebhookVerificationException( + Reason.INVALID_PAYLOAD, String.valueOf(e.getMessage())); + } + } + + /** {@code "{timestamp}:{session_id}:{status}:{webhook_type}"} with Python's {@code str()}. */ + static String simpleString(ObjectNode payload) { + return pythonStr(payload.get("timestamp")) + + ":" + + pythonStr(payload.get("session_id")) + + ":" + + pythonStr(payload.get("status")) + + ":" + + pythonStr(payload.get("webhook_type")); + } + + static String pythonStr(@Nullable JsonNode value) { + if (value == null) { + return ""; + } + if (value.isTextual()) { + return value.textValue(); + } + return pythonRepr(value); + } + + private static String pythonRepr(JsonNode value) { + if (value.isNull()) { + return "None"; + } + if (value.isBoolean()) { + return value.booleanValue() ? "True" : "False"; + } + if (value.isIntegralNumber()) { + return value.bigIntegerValue().toString(); + } + if (value.isNumber()) { + BigDecimal decimal = value.decimalValue(); + return CanonicalJson.pythonRepr(Double.parseDouble(decimal.toString())); + } + if (value.isTextual()) { + String text = value.textValue(); + String quote = text.contains("'") && !text.contains("\"") ? "\"" : "'"; + return quote + text.replace("\\", "\\\\").replace(quote, "\\" + quote) + quote; + } + StringBuilder out = new StringBuilder(); + if (value.isArray()) { + out.append('['); + boolean first = true; + for (JsonNode item : value) { + out.append(first ? "" : ", ").append(pythonRepr(item)); + first = false; + } + return out.append(']').toString(); + } + out.append('{'); + boolean first = true; + for (Map.Entry entry : value.properties()) { + out.append(first ? "" : ", "); + out.append(pythonRepr(Json.nodes().textNode(entry.getKey()))); + out.append(": ").append(pythonRepr(entry.getValue())); + first = false; + } + return out.append('}').toString(); + } + + static String hmac(String secret, byte[] message) { + try { + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256")); + byte[] digest = mac.doFinal(message); + StringBuilder hex = new StringBuilder(64); + for (byte b : digest) { + hex.append(Character.forDigit((b >> 4) & 0xf, 16)).append(Character.forDigit(b & 0xf, 16)); + } + return hex.toString(); + } catch (NoSuchAlgorithmException | InvalidKeyException e) { + throw new IllegalStateException("HmacSHA256 is not available", e); + } + } + + private static boolean matches( + String expected, Function headers, String name) { + String provided = header(headers, name); + if (provided == null || !HEX64.matcher(provided).matches()) { + return false; + } + return MessageDigest.isEqual( + expected.getBytes(StandardCharsets.US_ASCII), provided.getBytes(StandardCharsets.US_ASCII)); + } + + private static boolean present(Function headers, String name) { + return header(headers, name) != null; + } + + /** A trimmed header value; empty values count as absent. */ + private static @Nullable String header(Function headers, String name) { + String value = headers.apply(name); + if (value == null) { + return null; + } + String trimmed = value.trim(); + return trimmed.isEmpty() ? null : trimmed; + } + + /** + * Header lookup over a map: names compare without case, the first matching entry wins, and a list + * value gives its first item. + */ + static Function lookup(Map headers) { + Objects.requireNonNull(headers, "headers"); + return name -> { + for (Map.Entry entry : headers.entrySet()) { + if (entry.getKey() != null && entry.getKey().equalsIgnoreCase(name)) { + return first(entry.getValue()); + } + } + return null; + }; + } + + private static @Nullable String first(@Nullable Object value) { + if (value == null) { + return null; + } + if (value instanceof String) { + return (String) value; + } + if (value instanceof Collection) { + for (Object item : (Collection) value) { + return item == null ? null : item.toString(); + } + return null; + } + if (value instanceof String[]) { + String[] array = (String[]) value; + return array.length == 0 ? null : array[0]; + } + return value.toString(); + } +} diff --git a/src/main/java/me/didit/webhooks/WorkflowComplianceChangedEvent.java b/src/main/java/me/didit/webhooks/WorkflowComplianceChangedEvent.java new file mode 100644 index 0000000..624055d --- /dev/null +++ b/src/main/java/me/didit/webhooks/WorkflowComplianceChangedEvent.java @@ -0,0 +1,24 @@ +package me.didit.webhooks; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Optional; +import me.didit.core.Conv; + +/** {@code workflow.compliance_changed}: a workflow's compliance status changed. */ +public final class WorkflowComplianceChangedEvent extends WebhookEvent { + /** The {@code webhook_type} of this event. */ + public static final String TYPE = "workflow.compliance_changed"; + + WorkflowComplianceChangedEvent(ObjectNode json, VerifiedBy verifiedBy) { + super(json, verifiedBy); + } + + /** + * The workflow. + * + * @return the workflow id + */ + public Optional workflowId() { + return optional("workflow_id", Conv.STRING); + } +} diff --git a/src/main/java/me/didit/webhooks/package-info.java b/src/main/java/me/didit/webhooks/package-info.java new file mode 100644 index 0000000..b08662b --- /dev/null +++ b/src/main/java/me/didit/webhooks/package-info.java @@ -0,0 +1,5 @@ +/** Webhook signature verification and typed webhook events (DESIGN 9). */ +@NullMarked +package me.didit.webhooks; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/me/didit/ContractTest.java b/src/test/java/me/didit/ContractTest.java new file mode 100644 index 0000000..0f0148e --- /dev/null +++ b/src/test/java/me/didit/ContractTest.java @@ -0,0 +1,180 @@ +package me.didit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.JsonNode; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; +import me.didit.testing.SpecExamples; +import org.junit.jupiter.api.Test; + +/** + * DESIGN 11: every {@code server: true} operation in {@code openapi/} has exactly one SDK method, + * and nothing else exists. Reads the spec and the overlay directly, without the generator. + */ +final class ContractTest { + private static final Set HTTP = Set.of("get", "post", "put", "patch", "delete"); + + /** {@code resource.method} of every server operation, from the spec plus the overlay. */ + static Set specOperations() { + JsonNode overlay = SpecExamples.document("overlay.json").get("operations"); + Set out = new TreeSet<>(); + for (String[] spec : new String[][] {{"verification.json", ""}, {"account.json", "account "}}) { + JsonNode doc = SpecExamples.document(spec[0]); + for (Map.Entry path : doc.get("paths").properties()) { + for (Map.Entry op : path.getValue().properties()) { + if (!HTTP.contains(op.getKey())) { + continue; + } + JsonNode sdk = op.getValue().get("x-didit-sdk"); + if (sdk == null) { + sdk = + overlay.get( + spec[1] + op.getKey().toUpperCase(java.util.Locale.ROOT) + " " + path.getKey()); + } + if (sdk == null) { + throw new AssertionError("No SDK naming for " + op.getKey() + " " + path.getKey()); + } + if (sdk.path("server").asBoolean()) { + out.add(sdk.get("resource").asText() + "." + sdk.get("method").asText()); + } + } + } + } + JsonNode deprecated = deprecatedOperations(); + deprecated.fieldNames().forEachRemaining(out::add); + return out; + } + + static JsonNode deprecatedOperations() { + java.nio.file.Path file = SpecExamples.repoRoot().resolve("openapi/deprecated-operations.json"); + if (!java.nio.file.Files.exists(file)) { + return me.didit.core.Json.nodes().objectNode(); + } + return SpecExamples.document("deprecated-operations.json").path("methods"); + } + + /** {@code resource.method} of every operation method reachable from {@link Didit}. */ + static Set sdkOperations() { + Set out = new TreeSet<>(); + walk(Didit.class, "", out, new TreeMap<>()); + return out; + } + + private static void walk( + Class type, String resource, Set out, Map> seen) { + for (Method m : type.getMethods()) { + if (Modifier.isStatic(m.getModifiers()) || m.getDeclaringClass() == Object.class) { + continue; + } + Class returns = m.getReturnType(); + if (m.getParameterCount() == 0 + && returns.getPackageName().equals("me.didit.resources") + && returns.getSimpleName().endsWith("Resource")) { + String child = (resource.isEmpty() ? "" : resource + ".") + snake(m.getName()); + if (seen.put(child, returns) == null) { + walk(returns, child, out, seen); + } + continue; + } + if (resource.isEmpty() + || !m.getDeclaringClass().getPackageName().equals("me.didit.resources") + || m.getName().endsWith("Async") + || m.getName().equals("withRawResponse")) { + continue; + } + out.add(resource + "." + snake(m.getName())); + } + } + + static String snake(String camel) { + StringBuilder out = new StringBuilder(); + for (char c : camel.replaceAll("_$", "").toCharArray()) { + if (Character.isUpperCase(c)) { + out.append('_').append(Character.toLowerCase(c)); + } else { + out.append(c); + } + } + return out.toString(); + } + + @Test + void everyServerOperationHasExactlyOneMethod() { + Set spec = specOperations(); + Set sdk = sdkOperations(); + Set missing = new TreeSet<>(spec); + missing.removeAll(sdk); + Set extra = new TreeSet<>(sdk); + extra.removeAll(spec); + assertEquals(Set.of(), missing, "operations without an SDK method"); + assertEquals(Set.of(), extra, "SDK methods without an operation"); + assertEquals(spec.size(), sdk.size()); + assertTrue(spec.size() >= 257, "248 server operations plus 9 account operations"); + } + + @Test + void deprecatedMethodsLeaveOnTime() { + JsonNode deprecated = deprecatedOperations(); + for (Map.Entry entry : deprecated.properties()) { + String removeIn = entry.getValue().path("remove_in").asText(""); + assertTrue( + compareVersions(me.didit.core.Version.VERSION, removeIn) < 0, + entry.getKey() + + " was due for removal in " + + removeIn + + ": delete it from openapi/deprecated-operations.json"); + } + assertTrue(compareVersions("0.1.0", "0.2.0") < 0); + assertTrue(compareVersions("1.10.0", "1.9.0") > 0); + assertEquals(0, compareVersions("1.0.0", "1.0.0")); + } + + static int compareVersions(String a, String b) { + String[] x = a.split("[.-]"); + String[] y = b.split("[.-]"); + for (int i = 0; i < Math.min(3, Math.min(x.length, y.length)); i++) { + int cmp = Integer.compare(Integer.parseInt(x[i]), Integer.parseInt(y[i])); + if (cmp != 0) { + return cmp; + } + } + return 0; + } + + @Test + void everyOperationHasSyncAsyncAndRawVariants() throws Exception { + Map> resources = new TreeMap<>(); + walk(Didit.class, "", new TreeSet<>(), resources); + for (Map.Entry> e : resources.entrySet()) { + Class type = e.getValue(); + Set names = new TreeSet<>(); + for (Method m : type.getDeclaredMethods()) { + if (Modifier.isPublic(m.getModifiers()) + && !m.getName().equals("withRawResponse") + && !m.getReturnType().getSimpleName().endsWith("Resource")) { + names.add(m.getName()); + } + } + for (String name : names) { + if (name.endsWith("Async")) { + continue; + } + assertTrue(names.contains(name + "Async"), e.getKey() + "." + name + "Async"); + Class raw = Class.forName(type.getName() + "$WithRawResponse"); + boolean hasRaw = false; + boolean hasRawAsync = false; + for (Method m : raw.getDeclaredMethods()) { + hasRaw |= m.getName().equals(name); + hasRawAsync |= m.getName().equals(name + "Async"); + } + assertTrue(hasRaw && hasRawAsync, e.getKey() + "." + name + " raw variants"); + } + } + } +} diff --git a/src/test/java/me/didit/DiditTest.java b/src/test/java/me/didit/DiditTest.java new file mode 100644 index 0000000..66ad6e0 --- /dev/null +++ b/src/test/java/me/didit/DiditTest.java @@ -0,0 +1,96 @@ +package me.didit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.net.http.HttpClient; +import java.time.Duration; +import java.util.Map; +import me.didit.core.ClientOptions; +import me.didit.errors.ConfigurationException; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import org.junit.jupiter.api.Test; + +final class DiditTest { + @Test + void builderSetsEveryOption() { + MockTransport transport = new MockTransport(); + Didit client = + Didit.builder() + .apiKey("k") + .accountToken("t") + .organizationId("o") + .applicationId("a") + .baseUrl("http://localhost:4010") + .accountBaseUrl("http://localhost:4011/auth/v2") + .timeout(Duration.ofSeconds(7)) + .maxRetries(1) + .defaultHeader("X-A", "1") + .debugLogging(false) + .environment(name -> null) + .transport(transport) + .build(); + ClientOptions o = client.options(); + assertEquals("k", o.apiKey().orElseThrow()); + assertEquals("t", o.accountToken().orElseThrow()); + assertEquals("o", o.organizationId().orElseThrow()); + assertEquals("a", o.applicationId().orElseThrow()); + assertEquals("http://localhost:4010", o.baseUrl().toString()); + assertEquals("http://localhost:4011/auth/v2", o.accountBaseUrl().toString()); + assertEquals(Duration.ofSeconds(7), o.timeout()); + assertEquals(1, o.maxRetries()); + assertEquals(Map.of("X-A", "1"), o.defaultHeaders()); + assertSame(transport, o.transport()); + assertFalse(client.toString().contains("k,")); + assertTrue(client.toString().contains("[REDACTED]")); + Didit other = + Didit.builder() + .httpClient(HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build()) + .build(); + assertTrue(other.options().transport() instanceof me.didit.core.JdkHttpTransport); + } + + @Test + void withOptionsDerivesAClientThatSharesTheTransport() { + MockTransport transport = new MockTransport(); + Didit client = transport.client(); + Didit slow = client.withOptions(o -> o.timeout(Duration.ofMinutes(2)).maxRetries(5)); + assertEquals(Duration.ofMinutes(2), slow.options().timeout()); + assertEquals(5, slow.options().maxRetries()); + assertEquals(Duration.ofSeconds(60), client.options().timeout()); + assertSame(client.options().transport(), slow.options().transport()); + assertEquals("test-api-key", slow.options().apiKey().orElseThrow()); + transport.respond(200, "{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + slow.workflows().list(); + RecordedRequest r = transport.only(); + assertEquals(Duration.ofMinutes(2), r.raw().timeout()); + } + + @Test + void constructors() { + Didit fromKey = new Didit("k"); + assertEquals("k", fromKey.options().apiKey().orElseThrow()); + Didit fromOptions = + new Didit(ClientOptions.builder().apiKey("x").environment(n -> null).build()); + assertEquals("x", fromOptions.options().apiKey().orElseThrow()); + // The no-argument constructor reads the environment; it never fails for a missing key. + Didit fromEnv = new Didit(); + assertTrue(fromEnv.options().baseUrl().toString().startsWith("https://")); + assertThrows( + ConfigurationException.class, () -> Didit.builder().baseUrl("http://example.com").build()); + } + + @Test + void applicationScopedCallsNeedBothIds() { + MockTransport transport = new MockTransport(); + Didit client = Didit.builder().apiKey("k").environment(n -> null).transport(transport).build(); + ConfigurationException e = + assertThrows(ConfigurationException.class, () -> client.cases().list()); + assertTrue(e.getMessage().contains("DIDIT_ORGANIZATION_ID")); + assertEquals(0, transport.requests().size()); + } +} diff --git a/src/test/java/me/didit/authentication/AuthenticationTest.java b/src/test/java/me/didit/authentication/AuthenticationTest.java new file mode 100644 index 0000000..9ceb59a --- /dev/null +++ b/src/test/java/me/didit/authentication/AuthenticationTest.java @@ -0,0 +1,1060 @@ +package me.didit.authentication; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.math.BigInteger; +import java.net.ConnectException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.interfaces.ECPublicKey; +import java.time.Clock; +import java.time.Duration; +import java.time.Instant; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.Base64; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import me.didit.core.Headers; +import me.didit.core.TransportResponse; +import me.didit.errors.ApiConnectionException; +import me.didit.errors.ApiTimeoutException; +import me.didit.errors.AuthenticationException; +import me.didit.errors.BadRequestException; +import me.didit.errors.ConfigurationException; +import me.didit.errors.TokenVerificationException; +import me.didit.errors.TokenVerificationException.Reason; +import org.junit.jupiter.api.Test; + +final class AuthenticationTest { + private final Instant now = Instant.parse("2026-11-01T10:00:00Z"); + private final MutableClock clock = new MutableClock(now); + private final StubIssuer issuer = new StubIssuer(); + + private Authentication auth() { + return Authentication.builder() + .issuer(StubIssuer.ISSUER) + .transport(issuer) + .clock(clock) + .build(); + } + + private Authentication authWithClient() { + return Authentication.builder() + .issuer(StubIssuer.ISSUER + "/") + .clientId(StubIssuer.APP_ID) + .transport(issuer) + .clock(clock) + .build(); + } + + private String access(ObjectNode claims) { + return issuer.sign(issuer.header("at+jwt"), claims); + } + + private Reason reject(Authentication auth, String token) { + return assertThrows(TokenVerificationException.class, () -> auth.verifyAccessToken(token)) + .reason(); + } + + static final class MutableClock extends Clock { + Instant instant; + + MutableClock(Instant instant) { + this.instant = instant; + } + + @Override + public ZoneOffset getZone() { + return ZoneOffset.UTC; + } + + @Override + public Clock withZone(java.time.ZoneId zone) { + return this; + } + + @Override + public Instant instant() { + return instant; + } + } + + @Test + void acceptsAValidAccessToken() { + AccessTokenClaims claims = authWithClient().verifyAccessToken(access(issuer.accessClaims(now))); + assertEquals(StubIssuer.ISSUER, claims.issuer()); + assertEquals("11111111-1111-4111-8111-111111111111", claims.subject()); + assertEquals(List.of(StubIssuer.APP_ID), claims.audience()); + assertEquals(StubIssuer.APP_ID, claims.clientId().orElseThrow()); + assertEquals("22222222-2222-4222-8222-222222222222", claims.sessionId().orElseThrow()); + assertEquals("jti-1", claims.tokenId().orElseThrow()); + assertEquals(now, claims.issuedAt()); + assertEquals(now.plusSeconds(300), claims.expiresAt()); + assertTrue(claims.notBefore().isEmpty()); + assertEquals("user-42", claims.vendorData().orElseThrow()); + assertEquals(List.of("passkey"), claims.authenticationMethods()); + assertEquals("org-1", claims.organization().orElseThrow().id().orElseThrow()); + assertEquals("admin", claims.organization().orElseThrow().role().orElseThrow()); + assertEquals("full_id", claims.verified().orElseThrow().level().orElseThrow()); + assertTrue(claims.verified().orElseThrow().over18().orElseThrow()); + assertTrue(claims.actor().isEmpty()); + assertTrue(claims.field("vendor_data").isPresent()); + assertTrue(claims._json().has("iss")); + // Each client fetches discovery and the keys once, then verifies from its cache. + authWithClient().verifyAccessToken(access(issuer.accessClaims(now))); + Authentication shared = auth(); + shared.verifyAccessToken(access(issuer.accessClaims(now))); + shared.verifyAccessToken(access(issuer.accessClaims(now))); + assertEquals(3, issuer.count("GET /.well-known/jwks.json")); + assertEquals(3, issuer.count("GET /.well-known/openid-configuration")); + } + + @Test + void readsAgentAndVerifiedClaims() { + ObjectNode claims = issuer.accessClaims(now); + ObjectNode act = claims.putObject("act"); + act.put("sub", "agent-1"); + act.put("agent", "Helper"); + act.putArray("scopes").add("read"); + ObjectNode verified = claims.putObject("verified"); + verified.put("level", "full_id"); + verified.put("over_21", false); + verified.put("given_name", "Ana"); + verified.put("family_name", "Ruiz"); + verified.put("birthdate", "1990-01-31"); + verified.put("nationality", "ESP"); + verified.put("country", "ESP"); + verified.put("document_verified", true); + verified.put("liveness", true); + claims.putArray("aud").add("other").add(StubIssuer.APP_ID); + claims.putNull("org"); + AccessTokenClaims c = auth().verifyAccessToken(access(claims), StubIssuer.APP_ID); + assertEquals("agent-1", c.actor().orElseThrow().subject().orElseThrow()); + assertEquals("Helper", c.actor().orElseThrow().agent().orElseThrow()); + assertEquals(List.of("read"), c.actor().orElseThrow().scopes()); + VerifiedClaims v = c.verified().orElseThrow(); + assertFalse(v.over21().orElseThrow()); + assertEquals("Ana", v.givenName().orElseThrow()); + assertEquals("Ruiz", v.familyName().orElseThrow()); + assertEquals("1990-01-31", v.birthdate().orElseThrow()); + assertEquals("ESP", v.nationality().orElseThrow()); + assertEquals("ESP", v.country().orElseThrow()); + assertTrue(v.documentVerified().orElseThrow()); + assertTrue(v.liveness().orElseThrow()); + assertTrue(c.organization().isEmpty()); + assertEquals(List.of("other", StubIssuer.APP_ID), c.audience()); + // toString() leaves identity data out, also inside nested objects. + String printed = c.toString(); + for (String personal : new String[] {"Ana", "Ruiz", "1990-01-31", "ESP", "user-42"}) { + assertFalse(printed.contains(personal), personal); + } + assertTrue(printed.contains("agent-1"), printed); + ObjectNode empty = issuer.accessClaims(now); + empty.putObject("verified"); + assertTrue(auth().verifyAccessToken(access(empty)).verified().isEmpty()); + } + + @Test + void rejectsOtherAlgorithms() { + ObjectNode claims = issuer.accessClaims(now); + for (String alg : new String[] {"none", "HS256", "RS256", "ES384", "es256"}) { + ObjectNode header = issuer.header("at+jwt"); + header.put("alg", alg); + assertEquals(Reason.UNSUPPORTED_ALGORITHM, reject(auth(), issuer.sign(header, claims)), alg); + } + ObjectNode noAlg = issuer.header("at+jwt"); + noAlg.remove("alg"); + assertEquals(Reason.UNSUPPORTED_ALGORITHM, reject(auth(), issuer.sign(noAlg, claims))); + // alg none with an empty signature never reaches the key lookup. + String b64header = + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString( + "{\"alg\":\"none\",\"typ\":\"at+jwt\"}".getBytes(StandardCharsets.UTF_8)); + String b64claims = + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString(claims.toString().getBytes(StandardCharsets.UTF_8)); + assertEquals(Reason.MALFORMED, reject(auth(), b64header + "." + b64claims + ".")); + assertEquals(0, issuer.count("GET /.well-known/jwks.json")); + } + + @Test + void checksTheTokenType() { + ObjectNode claims = issuer.accessClaims(now); + assertEquals(Reason.INVALID_TYPE, reject(auth(), issuer.sign(issuer.header("JWT"), claims))); + ObjectNode noTyp = issuer.header("at+jwt"); + noTyp.remove("typ"); + assertEquals(Reason.INVALID_TYPE, reject(auth(), issuer.sign(noTyp, claims))); + assertEquals( + StubIssuer.ISSUER, + auth() + .verifyAccessToken(issuer.sign(issuer.header("application/AT+JWT"), claims)) + .issuer()); + // An access token is not an ID token. + TokenVerificationException e = + assertThrows( + TokenVerificationException.class, + () -> authWithClient().verifyIdToken(access(claims), null)); + assertEquals(Reason.INVALID_TYPE, e.reason()); + } + + @Test + void checksIssuerAudienceAndTimes() { + ObjectNode wrongIssuer = issuer.accessClaims(now); + wrongIssuer.put("iss", "https://evil.auth.didit.me"); + assertEquals(Reason.INVALID_ISSUER, reject(auth(), access(wrongIssuer))); + ObjectNode slash = issuer.accessClaims(now); + slash.put("iss", StubIssuer.ISSUER + "/"); + assertEquals(Reason.INVALID_ISSUER, reject(auth(), access(slash))); + + ObjectNode otherAudience = issuer.accessClaims(now); + otherAudience.put("aud", "another-app"); + assertEquals(Reason.INVALID_AUDIENCE, reject(authWithClient(), access(otherAudience))); + assertEquals( + "another-app", + auth().verifyAccessToken(access(otherAudience)).audience().get(0), + "no audience check without an expected audience"); + assertEquals( + Reason.INVALID_AUDIENCE, + assertThrows( + TokenVerificationException.class, + () -> auth().verifyAccessToken(access(otherAudience), "mine")) + .reason()); + + ObjectNode expired = issuer.accessClaims(now.minusSeconds(400)); + assertEquals(Reason.EXPIRED, reject(auth(), access(expired))); + ObjectNode withinLeeway = issuer.accessClaims(now.minusSeconds(330)); + assertEquals(StubIssuer.ISSUER, auth().verifyAccessToken(access(withinLeeway)).issuer()); + + ObjectNode future = issuer.accessClaims(now); + future.put("nbf", now.getEpochSecond() + 120); + assertEquals(Reason.NOT_YET_VALID, reject(auth(), access(future))); + ObjectNode nbfOk = issuer.accessClaims(now); + nbfOk.put("nbf", now.getEpochSecond() + 30); + assertEquals( + now.plusSeconds(30), auth().verifyAccessToken(access(nbfOk)).notBefore().orElseThrow()); + ObjectNode nbfString = issuer.accessClaims(now); + nbfString.put("nbf", "soon"); + assertEquals(Reason.MALFORMED, reject(auth(), access(nbfString))); + + ObjectNode issuedLater = issuer.accessClaims(now.plusSeconds(120)); + assertEquals(Reason.INVALID_ISSUED_AT, reject(auth(), access(issuedLater))); + + for (String claim : new String[] {"exp", "iat", "sub"}) { + ObjectNode missing = issuer.accessClaims(now); + missing.remove(claim); + assertEquals(Reason.MISSING_CLAIM, reject(auth(), access(missing)), claim); + } + ObjectNode expString = issuer.accessClaims(now); + expString.put("exp", "later"); + assertEquals(Reason.MISSING_CLAIM, reject(auth(), access(expString))); + } + + @Test + void rejectsUnknownKeysAndForgedSignatures() { + ObjectNode claims = issuer.accessClaims(now); + ObjectNode header = issuer.header("at+jwt"); + header.put("kid", "k_unknown"); + Authentication auth = auth(); + assertEquals(Reason.UNKNOWN_KEY, reject(auth, issuer.sign(header, claims))); + // A second unknown kid within a minute does not refetch the keys. + assertEquals(Reason.UNKNOWN_KEY, reject(auth, issuer.sign(header, claims))); + assertEquals(1, issuer.count("GET /.well-known/jwks.json")); + // After a minute, a new key published by the issuer is picked up. + clock.instant = now.plusSeconds(61); + issuer.routes.put( + "GET /.well-known/jwks.json", + r -> { + ObjectNode doc = issuer.jwks(); + doc.withArray("keys") + .add(StubIssuer.jwk("k_unknown", (ECPublicKey) issuer.keys.getPublic())); + return StubIssuer.json(200, doc, "max-age=300"); + }); + assertEquals( + StubIssuer.ISSUER, + auth.verifyAccessToken(issuer.sign(header, issuer.accessClaims(clock.instant))).issuer()); + assertEquals(2, issuer.count("GET /.well-known/jwks.json")); + + // Another key under the known kid. + String forged = StubIssuer.sign(issuer.header("at+jwt"), claims, issuer.otherKeys); + assertEquals(Reason.INVALID_SIGNATURE, reject(auth(), forged)); + // A tampered payload. + String token = access(claims); + String[] parts = token.split("\\."); + ObjectNode tampered = claims.deepCopy(); + tampered.put("sub", "someone-else"); + String forgedPayload = + parts[0] + + "." + + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString(tampered.toString().getBytes(StandardCharsets.UTF_8)) + + "." + + parts[2]; + assertEquals(Reason.INVALID_SIGNATURE, reject(auth(), forgedPayload)); + // A truncated signature. + assertEquals( + Reason.INVALID_SIGNATURE, + reject(auth(), parts[0] + "." + parts[1] + "." + parts[2].substring(0, 40))); + // A DER signature from the right key: JWS needs the 64-byte r || s form. + assertEquals(Reason.INVALID_SIGNATURE, reject(auth(), derSigned(parts[0] + "." + parts[1]))); + // r or s outside [1, n-1], which unpatched JDKs (CVE-2022-21449) accepted for r = s = 0. + BigInteger n = ((ECPublicKey) issuer.keys.getPublic()).getParams().getOrder(); + byte[] signature = Base64.getUrlDecoder().decode(parts[2]); + byte[] s = java.util.Arrays.copyOfRange(signature, 32, 64); + for (byte[] forgedSignature : + new byte[][] { + new byte[64], + concat(new byte[32], s), + concat(fixed(n), s), + concat(fixed(n.add(BigInteger.ONE)), s) + }) { + assertEquals( + Reason.INVALID_SIGNATURE, + reject( + auth(), + parts[0] + + "." + + parts[1] + + "." + + Base64.getUrlEncoder().withoutPadding().encodeToString(forgedSignature))); + } + } + + private static byte[] fixed(BigInteger value) { + byte[] raw = value.toByteArray(); + byte[] out = new byte[32]; + int copy = Math.min(raw.length, 32); + System.arraycopy(raw, raw.length - copy, out, 32 - copy, copy); + return out; + } + + private static byte[] concat(byte[] a, byte[] b) { + byte[] out = java.util.Arrays.copyOf(a, a.length + b.length); + System.arraycopy(b, 0, out, a.length, b.length); + return out; + } + + private String derSigned(String input) { + try { + java.security.Signature signer = java.security.Signature.getInstance("SHA256withECDSA"); + signer.initSign(issuer.keys.getPrivate()); + signer.update(input.getBytes(StandardCharsets.US_ASCII)); + return input + "." + Base64.getUrlEncoder().withoutPadding().encodeToString(signer.sign()); + } catch (java.security.GeneralSecurityException e) { + throw new IllegalStateException(e); + } + } + + @Test + void rejectsMalformedTokens() { + String token = access(issuer.accessClaims(now)); + String[] parts = token.split("\\."); + Base64.Encoder b64 = Base64.getUrlEncoder().withoutPadding(); + for (String bad : + new String[] { + "", + "abc", + parts[0] + "." + parts[1], + token + ".x", + parts[0] + ".%%%." + parts[2], + b64.encodeToString("not json".getBytes(StandardCharsets.UTF_8)) + + "." + + parts[1] + + "." + + parts[2], + b64.encodeToString( + "{\"alg\":\"ES256\",\"alg\":\"ES256\",\"typ\":\"at+jwt\",\"kid\":\"k\"}" + .getBytes(StandardCharsets.UTF_8)) + + "." + + parts[1] + + "." + + parts[2], + "a".repeat(16385) + }) { + assertEquals( + Reason.MALFORMED, reject(auth(), bad), bad.length() > 60 ? bad.substring(0, 60) : bad); + } + ObjectNode crit = issuer.header("at+jwt"); + crit.putArray("crit").add("exp"); + assertEquals(Reason.MALFORMED, reject(auth(), issuer.sign(crit, issuer.accessClaims(now)))); + ObjectNode noKid = issuer.header("at+jwt"); + noKid.remove("kid"); + assertEquals(Reason.MALFORMED, reject(auth(), issuer.sign(noKid, issuer.accessClaims(now)))); + // A payload that is not an object, correctly signed. + String arrayPayload = signRaw(issuer.header("at+jwt").toString(), "[1]"); + assertEquals(Reason.MALFORMED, reject(auth(), arrayPayload)); + // A signature part whose length leaves a remainder of 1 is not base64url at all; the async + // variant reports it through the future, never by throwing. + long fetches = issuer.count("GET /.well-known/jwks.json"); + for (String signature : new String[] {"A", parts[2].substring(0, 85)}) { + String bad = parts[0] + "." + parts[1] + "." + signature; + assertEquals(1, signature.length() % 4); + assertEquals(Reason.MALFORMED, reject(auth(), bad)); + CompletableFuture future = auth().verifyAccessTokenAsync(bad, null); + assertTrue(future.isCompletedExceptionally()); + java.util.concurrent.ExecutionException e = + assertThrows(java.util.concurrent.ExecutionException.class, future::get); + assertEquals(Reason.MALFORMED, ((TokenVerificationException) e.getCause()).reason()); + } + assertEquals(fetches, issuer.count("GET /.well-known/jwks.json")); + } + + @Test + void verifiesIdTokens() { + ObjectNode claims = issuer.accessClaims(now); + claims.remove("client_id"); + claims.put("auth_time", now.getEpochSecond() - 10); + claims.put("nonce", "nonce-1"); + claims.put("email", "ana@example.com"); + claims.put("email_verified", true); + claims.put("name", "Ana"); + claims.put("phone_number", "+34600000000"); + String token = issuer.sign(issuer.header("JWT"), claims); + IdTokenClaims id = authWithClient().verifyIdToken(token, "nonce-1"); + assertEquals("nonce-1", id.nonce().orElseThrow()); + assertEquals(now.minusSeconds(10), id.authTime().orElseThrow()); + assertEquals("ana@example.com", id.email().orElseThrow()); + assertTrue(id.emailVerified()); + assertEquals("Ana", id.name().orElseThrow()); + assertEquals("+34600000000", id.phoneNumber().orElseThrow()); + assertFalse(id.toString().contains("ana@example.com")); + assertEquals( + Reason.INVALID_NONCE, + assertThrows( + TokenVerificationException.class, + () -> authWithClient().verifyIdToken(token, "other")) + .reason()); + // A refreshed ID token has no nonce: pass null. + ObjectNode refreshed = claims.deepCopy(); + refreshed.remove("nonce"); + String refreshedToken = issuer.sign(issuer.header("JWT"), refreshed); + assertTrue(authWithClient().verifyIdToken(refreshedToken, null).nonce().isEmpty()); + assertEquals( + Reason.INVALID_NONCE, + assertThrows( + TokenVerificationException.class, + () -> authWithClient().verifyIdToken(refreshedToken, "nonce-1")) + .reason()); + // Without an expected nonce, a token that carries one is refused (no silent opt-out). + assertEquals( + Reason.INVALID_NONCE, + assertThrows( + TokenVerificationException.class, () -> authWithClient().verifyIdToken(token, null)) + .reason()); + // typ may be absent on an ID token. + ObjectNode noTyp = issuer.header("JWT"); + noTyp.remove("typ"); + assertEquals( + "Ana", + auth() + .verifyIdToken(issuer.sign(noTyp, claims), "nonce-1", StubIssuer.APP_ID) + .name() + .orElseThrow()); + // The audience is required. + assertThrows(ConfigurationException.class, () -> auth().verifyIdToken(token, "nonce-1")); + ObjectNode noEmail = claims.deepCopy(); + noEmail.remove("email_verified"); + assertFalse( + authWithClient() + .verifyIdToken(issuer.sign(issuer.header("JWT"), noEmail), "nonce-1") + .emailVerified()); + } + + @Test + void discoveryRules() { + issuer.discovery.put("issuer", "https://other.auth.didit.me"); + assertThrows( + ConfigurationException.class, + () -> auth().verifyAccessToken(access(issuer.accessClaims(now)))); + + StubIssuer second = new StubIssuer(); + second.discovery.put("token_endpoint", "https://evil.example.com/token/"); + Authentication a = + Authentication.builder().issuer(StubIssuer.ISSUER).transport(second).clock(clock).build(); + assertThrows(ConfigurationException.class, () -> a.exchangeCode("c", "v", "https://app/cb")); + + StubIssuer third = new StubIssuer(); + third.discovery.put("jwks_uri", "http://acme.auth.didit.me/keys"); + Authentication b = + Authentication.builder().issuer(StubIssuer.ISSUER).transport(third).clock(clock).build(); + assertThrows( + ConfigurationException.class, () -> b.verifyAccessToken(access(third.accessClaims(now)))); + + StubIssuer fourth = new StubIssuer(); + fourth.discovery.remove("token_endpoint"); + fourth.discovery.remove("jwks_uri"); + fourth.routes.put("POST /token/", r -> StubIssuer.json(200, "{\"access_token\":\"a\"}")); + Authentication c = + Authentication.builder().issuer(StubIssuer.ISSUER).transport(fourth).clock(clock).build(); + assertEquals("a", c.exchangeCode("code", "verifier", "https://app/cb").accessToken()); + assertEquals( + StubIssuer.ISSUER, + c.verifyAccessToken(fourth.sign(fourth.header("at+jwt"), fourth.accessClaims(now))) + .issuer()); + // Discovery was fetched once and cached for both calls. + assertEquals(1, fourth.count("GET /.well-known/openid-configuration")); + + // A loopback issuer may use http for its keys, whatever the case of the scheme. + StubIssuer local = new StubIssuer(); + String upper = "HTTP://localhost:8000"; + local.discovery.put("issuer", upper); + local.discovery.put("token_endpoint", "http://localhost:8000/token/"); + local.discovery.put("jwks_uri", "http://localhost:8000/.well-known/jwks.json"); + Authentication e = Authentication.builder().issuer(upper).transport(local).clock(clock).build(); + ObjectNode localClaims = local.accessClaims(now); + localClaims.put("iss", upper); + assertEquals( + upper, e.verifyAccessToken(local.sign(local.header("at+jwt"), localClaims)).issuer()); + + StubIssuer fifth = new StubIssuer(); + fifth.discovery.remove("issuer"); + Authentication d = + Authentication.builder().issuer(StubIssuer.ISSUER).transport(fifth).clock(clock).build(); + assertThrows(me.didit.errors.UnexpectedResponseException.class, () -> d.refresh("r")); + } + + @Test + void cacheLifetimes() { + assertEquals(Duration.ofMinutes(5), Authentication.cacheLifetime(Headers.empty())); + assertEquals( + Duration.ofSeconds(600), + Authentication.cacheLifetime(headers("Cache-Control", "public, max-age=600"))); + assertEquals( + Duration.ofSeconds(500), + Authentication.cacheLifetime(headers("Cache-Control", "max-age=600", "Age", "100"))); + assertEquals( + Duration.ofMinutes(1), Authentication.cacheLifetime(headers("Cache-Control", "no-store"))); + assertEquals( + Duration.ofMinutes(1), Authentication.cacheLifetime(headers("Cache-Control", "max-age=5"))); + assertEquals( + Duration.ofHours(24), + Authentication.cacheLifetime(headers("Cache-Control", "max-age=999999"))); + assertEquals( + Duration.ofMinutes(5), + Authentication.cacheLifetime(headers("Cache-Control", "max-age=abc", "Age", "x"))); + } + + @Test + void keysExpireAndInvalidKeysAreSkipped() { + Authentication auth = auth(); + auth.verifyAccessToken(access(issuer.accessClaims(now))); + clock.instant = now.plusSeconds(301); + auth.verifyAccessToken(access(issuer.accessClaims(clock.instant))); + assertEquals(2, issuer.count("GET /.well-known/jwks.json")); + ObjectNode doc = issuer.jwks(); + ObjectNode badPoint = StubIssuer.jwk("bad", (ECPublicKey) issuer.keys.getPublic()); + badPoint.put("y", badPoint.get("x").asText()); + doc.withArray("keys").add(badPoint); + ObjectNode rsa = doc.withArray("keys").addObject(); + rsa.put("kty", "RSA"); + rsa.put("kid", "rsa"); + ObjectNode enc = StubIssuer.jwk("enc", (ECPublicKey) issuer.keys.getPublic()); + enc.put("use", "enc"); + doc.withArray("keys").add(enc); + ObjectNode shortX = StubIssuer.jwk("short", (ECPublicKey) issuer.keys.getPublic()); + shortX.put("x", "AAAA"); + doc.withArray("keys").add(shortX); + ObjectNode p384 = doc.withArray("keys").addObject(); + p384.put("kty", "EC"); + p384.put("crv", "P-384"); + p384.put("kid", "p384"); + p384.put("x", Base64.getUrlEncoder().withoutPadding().encodeToString(new byte[48])); + p384.put("y", Base64.getUrlEncoder().withoutPadding().encodeToString(new byte[48])); + ObjectNode noCurve = StubIssuer.jwk("no-curve", (ECPublicKey) issuer.keys.getPublic()); + noCurve.remove("crv"); + doc.withArray("keys").add(noCurve); + Map keys = Authentication.parseKeys(doc); + assertEquals(Set.of(issuer.kid), keys.keySet()); + assertThrows( + me.didit.errors.UnexpectedResponseException.class, + () -> Authentication.parseKeys(StubIssuer.parse("{}"))); + } + + @Test + void concurrentCallsShareOneFetch() throws Exception { + CompletableFuture keySet = new CompletableFuture<>(); + issuer.held.put("GET /.well-known/jwks.json", keySet); + Authentication auth = auth(); + String token = access(issuer.accessClaims(now)); + List> waiting = new ArrayList<>(); + for (int i = 0; i < 5; i++) { + waiting.add(auth.verifyAccessTokenAsync(token, null)); + } + // A token with an unknown key id joins the same fetch instead of starting another. + ObjectNode unknown = issuer.header("at+jwt"); + unknown.put("kid", "k_other"); + CompletableFuture other = + auth.verifyAccessTokenAsync(issuer.sign(unknown, issuer.accessClaims(now)), null); + assertEquals(1, issuer.count("GET /.well-known/openid-configuration")); + assertEquals(1, issuer.count("GET /.well-known/jwks.json")); + assertFalse(waiting.get(0).isDone()); + issuer.held.clear(); + keySet.complete(StubIssuer.json(200, issuer.jwks(), "max-age=300")); + for (CompletableFuture f : waiting) { + assertEquals(StubIssuer.ISSUER, f.get().issuer()); + } + ExecutionException e = assertThrows(ExecutionException.class, other::get); + assertEquals(Reason.UNKNOWN_KEY, ((TokenVerificationException) e.getCause()).reason()); + assertEquals(1, issuer.count("GET /.well-known/jwks.json")); + + // Two token calls wait on one discovery request. + StubIssuer second = new StubIssuer(); + CompletableFuture discovery = new CompletableFuture<>(); + second.held.put("GET /.well-known/openid-configuration", discovery); + second.routes.put("POST /token/", r -> StubIssuer.json(200, "{\"access_token\":\"a\"}")); + Authentication a = + Authentication.builder().issuer(StubIssuer.ISSUER).transport(second).clock(clock).build(); + CompletableFuture one = a.refreshAsync("r1"); + CompletableFuture two = a.refreshAsync("r2"); + assertEquals(1, second.count("GET /.well-known/openid-configuration")); + second.held.clear(); + discovery.complete(StubIssuer.json(200, second.discovery, "max-age=300")); + assertEquals("a", one.get().accessToken()); + assertEquals("a", two.get().accessToken()); + assertEquals(2, second.count("POST /token/")); + } + + @Test + void aFailedKeyFetchIsNotRepeatedForFiveSeconds() { + issuer.routes.put( + "GET /.well-known/jwks.json", r -> StubIssuer.json(503, "{\"detail\":\"down\"}")); + Authentication auth = auth(); + String token = access(issuer.accessClaims(now)); + ObjectNode unknown = issuer.header("at+jwt"); + unknown.put("kid", "k_random"); + String randomKid = issuer.sign(unknown, issuer.accessClaims(now)); + assertThrows( + me.didit.errors.InternalServerException.class, () -> auth.verifyAccessToken(token)); + // During the backoff, neither a known nor a random key id reaches the issuer. + clock.instant = now.plusSeconds(4); + assertThrows( + me.didit.errors.InternalServerException.class, () -> auth.verifyAccessToken(token)); + assertThrows( + me.didit.errors.InternalServerException.class, () -> auth.verifyAccessToken(randomKid)); + assertEquals(1, issuer.count("GET /.well-known/jwks.json")); + // Once it has passed, the next verification fetches again and succeeds. + clock.instant = now.plus(Authentication.FAILED_FETCH_BACKOFF); + issuer.routes.put( + "GET /.well-known/jwks.json", r -> StubIssuer.json(200, issuer.jwks(), "max-age=300")); + assertEquals(StubIssuer.ISSUER, auth.verifyAccessToken(token).issuer()); + assertEquals(2, issuer.count("GET /.well-known/jwks.json")); + + // Expired keys that cannot be refreshed follow the same rule. + Instant later = clock.instant.plusSeconds(301); + clock.instant = later; + issuer.routes.put( + "GET /.well-known/jwks.json", r -> StubIssuer.json(503, "{\"detail\":\"down\"}")); + String fresh = access(issuer.accessClaims(later)); + assertThrows( + me.didit.errors.InternalServerException.class, () -> auth.verifyAccessToken(fresh)); + assertThrows( + me.didit.errors.InternalServerException.class, () -> auth.verifyAccessToken(fresh)); + assertEquals(3, issuer.count("GET /.well-known/jwks.json")); + + // A discovery outage counts as a failed key fetch too. + StubIssuer down = new StubIssuer(); + down.routes.put( + "GET /.well-known/openid-configuration", r -> StubIssuer.json(502, "{\"detail\":\"x\"}")); + Authentication b = + Authentication.builder().issuer(StubIssuer.ISSUER).transport(down).clock(clock).build(); + String other = down.sign(down.header("at+jwt"), down.accessClaims(later)); + assertThrows(me.didit.errors.InternalServerException.class, () -> b.verifyAccessToken(other)); + assertThrows(me.didit.errors.InternalServerException.class, () -> b.verifyAccessToken(other)); + assertEquals(1, down.count("GET /.well-known/openid-configuration")); + } + + @Test + void exchangesCodesAndRefreshes() { + issuer.routes.put( + "POST /token/", + r -> + StubIssuer.json( + 200, + "{\"access_token\":\"at-1\",\"id_token\":\"id-1\",\"refresh_token\":\"rt-1\"," + + "\"token_type\":\"Bearer\",\"expires_in\":300,\"session_id\":\"s-1\"}")); + TokenResponse tokens = + authWithClient().exchangeCode("code-1", "verifier-1", "https://app.example.com/cb"); + assertEquals("at-1", tokens.accessToken()); + assertEquals("id-1", tokens.idToken().orElseThrow()); + assertEquals("rt-1", tokens.refreshToken().orElseThrow()); + assertEquals("Bearer", tokens.tokenType().orElseThrow()); + assertEquals(300L, tokens.expiresIn().orElseThrow()); + assertEquals("s-1", tokens.sessionId().orElseThrow()); + assertFalse(tokens.toString().contains("at-1")); + Map form = form(issuer.last("POST /token/").body()); + assertEquals("authorization_code", form.get("grant_type")); + assertEquals("code-1", form.get("code")); + assertEquals("verifier-1", form.get("code_verifier")); + assertEquals("https://app.example.com/cb", form.get("redirect_uri")); + assertEquals(StubIssuer.APP_ID, form.get("client_id")); + assertEquals( + "application/x-www-form-urlencoded", + issuer.last("POST /token/").headers().get("Content-Type").get(0)); + + auth().refresh("rt-1"); + Map refresh = form(issuer.last("POST /token/").body()); + assertEquals("refresh_token", refresh.get("grant_type")); + assertEquals("rt-1", refresh.get("refresh_token")); + assertNull(refresh.get("client_id")); + + issuer.routes.put("POST /token/", r -> StubIssuer.json(400, "{\"error\":\"invalid_grant\"}")); + BadRequestException e = + assertThrows(BadRequestException.class, () -> auth().refresh("rt-used")); + assertTrue(e.getMessage().contains("invalid_grant"), e.getMessage()); + assertFalse(e.getMessage().contains("rt-used")); + issuer.routes.put( + "POST /token/", + r -> StubIssuer.json(400, "{\"error\":\"mfa_required\",\"error_description\":\"MFA\"}")); + assertTrue( + assertThrows(BadRequestException.class, () -> auth().refresh("r")) + .getMessage() + .contains("mfa_required: MFA")); + // Token requests are never retried: resending a refresh token would revoke the session. + long sent = issuer.count("POST /token/"); + issuer.routes.put("POST /token/", r -> StubIssuer.json(500, "oops")); + assertThrows(me.didit.errors.InternalServerException.class, () -> auth().refresh("r")); + issuer.routes.put("POST /token/", r -> StubIssuer.json(503, "{}")); + assertThrows( + me.didit.errors.InternalServerException.class, + () -> auth().exchangeCode("c", "v", "https://app.example.com/cb")); + issuer.held.put( + "POST /token/", CompletableFuture.failedFuture(new ConnectException("connection reset"))); + assertThrows(ApiConnectionException.class, () -> auth().refresh("r")); + assertEquals(sent + 3, issuer.count("POST /token/")); + } + + @Test + void sessionsAndStepUps() { + issuer.routes.put( + "GET /session/", + r -> + StubIssuer.json( + 200, + "{\"sub\":\"u-1\",\"sid\":\"s-1\",\"application_id\":\"app\",\"vendor_data\":\"v\"," + + "\"amr\":[\"password\"],\"mfa_verified\":true,\"email\":\"e@example.com\"," + + "\"email_verified\":true,\"phone\":\"+1\",\"verified\":null,\"verified_identity\":null," + + "\"expires_at\":\"2026-11-02T10:00:00Z\",\"post_logout_redirect_uri\":\"https://app/\"," + + "\"organizations\":[{\"organization_id\":\"o-1\",\"organization__name\":\"Acme\"," + + "\"role\":\"admin\",\"custom_role\":{\"key\":\"ops\",\"permissions\":[]}}]}")); + AuthenticationSession session = auth().getSession("at-1"); + assertEquals("Bearer at-1", issuer.last("GET /session/").headers().get("Authorization").get(0)); + assertEquals("u-1", session.subject().orElseThrow()); + assertEquals("s-1", session.sessionId().orElseThrow()); + assertEquals("app", session.applicationId().orElseThrow()); + assertEquals("v", session.vendorData().orElseThrow()); + assertEquals(List.of("password"), session.authenticationMethods()); + assertTrue(session.mfaVerified()); + assertEquals("e@example.com", session.email().orElseThrow()); + assertTrue(session.emailVerified()); + assertEquals("+1", session.phone().orElseThrow()); + assertTrue(session.verified().isEmpty()); + assertTrue(session.verifiedIdentity().isEmpty()); + assertEquals(2026, session.expiresAt().orElseThrow().getYear()); + assertEquals("https://app/", session.postLogoutRedirectUri().orElseThrow()); + AuthenticationSession.Organization org = session.organizations().get(0); + assertEquals("o-1", org.organizationId().orElseThrow()); + assertEquals("Acme", org.organizationName().orElseThrow()); + assertEquals("admin", org.role().orElseThrow()); + assertEquals("ops", org.customRole().orElseThrow().get("key").asText()); + + issuer.routes.put("GET /session/", r -> StubIssuer.json(401, "{\"detail\":\"invalid_token\"}")); + assertThrows(AuthenticationException.class, () -> auth().getSession("expired")); + + issuer.routes.put( + "DELETE /session/", + r -> new me.didit.core.TransportResponse(204, Headers.empty(), new byte[0])); + auth().revokeSession("at-1"); + assertEquals(1, issuer.count("DELETE /session/")); + // Not retried on a 5xx either. + issuer.routes.put("DELETE /session/", r -> StubIssuer.json(503, "{\"detail\":\"busy\"}")); + assertThrows(me.didit.errors.InternalServerException.class, () -> auth().revokeSession("at-1")); + assertEquals(2, issuer.count("DELETE /session/")); + + issuer.routes.put("POST /step-up/", r -> StubIssuer.json(200, "{\"required\":false}")); + StepUp notNeeded = + auth() + .createStepUp( + "at-1", StepUpParams.builder("contact").returnTo("https://app/back").build()); + assertFalse(notNeeded.required()); + issuer.routes.put( + "POST /step-up/", + r -> + StubIssuer.json( + 201, + "{\"id\":\"33333333-3333-4333-8333-333333333333\",\"rule\":\"payout\",\"method\":\"liveness\"," + + "\"status\":\"pending\",\"level\":null,\"amount\":\"250.00\",\"currency\":\"EUR\"," + + "\"created_at\":\"2026-11-01T10:00:00Z\",\"completed_at\":null," + + "\"expires_at\":\"2026-11-01T10:30:00Z\",\"required\":true," + + "\"verification_url\":\"https://acme.auth.didit.me/step-up/x\",\"expires_in\":1800}")); + StepUp stepUp = + auth() + .createStepUp( + "at-1", + StepUpParams.builder("payout") + .amount(new java.math.BigDecimal("250.00")) + .currency("EUR") + .returnTo("https://app/back") + .build()); + assertEquals( + "{\"action\":\"payout\",\"amount\":\"250.00\",\"currency\":\"EUR\",\"return_to\":\"https://app/back\"}", + new String(issuer.last("POST /step-up/").body(), StandardCharsets.UTF_8)); + assertTrue(stepUp.required()); + assertFalse(stepUp.isApproved()); + assertEquals("33333333-3333-4333-8333-333333333333", stepUp.id().orElseThrow()); + assertEquals("payout", stepUp.rule().orElseThrow()); + assertEquals("liveness", stepUp.method().orElseThrow()); + assertEquals("pending", stepUp.status().orElseThrow()); + assertTrue(stepUp.level().isEmpty()); + assertEquals("250.00", stepUp.amount().orElseThrow()); + assertEquals("EUR", stepUp.currency().orElseThrow()); + assertEquals(1800L, stepUp.expiresIn().orElseThrow()); + assertTrue(stepUp.verificationUrl().isPresent()); + assertTrue(stepUp.createdAt().isPresent()); + assertTrue(stepUp.completedAt().isEmpty()); + assertTrue(stepUp.expiresAt().isPresent()); + + issuer.routes.put( + "GET /step-up/33333333-3333-4333-8333-333333333333/", + r -> + StubIssuer.json( + 200, "{\"id\":\"33333333-3333-4333-8333-333333333333\",\"status\":\"approved\"}")); + assertTrue(auth().retrieveStepUp("at-1", "33333333-3333-4333-8333-333333333333").isApproved()); + for (String bad : new String[] {"", ".", ".."}) { + assertThrows(ConfigurationException.class, () -> auth().retrieveStepUp("at-1", bad)); + } + assertThrows( + IllegalArgumentException.class, () -> StepUpParams.builder("payout").amount("12,5")); + assertEquals( + 404, + assertThrows( + me.didit.errors.NotFoundException.class, () -> auth().retrieveStepUp("at-1", "a/b")) + .statusCode()); + assertTrue( + issuer.requests.stream().anyMatch(r -> r.uri().getRawPath().equals("/step-up/a%2Fb/"))); + // Never sends the API key or an Origin header. + for (me.didit.core.TransportRequest r : issuer.requests) { + assertFalse(r.headers().containsKey("x-api-key")); + assertFalse(r.headers().containsKey("Origin")); + assertTrue(r.headers().get("User-Agent").get(0).startsWith("didit-java/")); + } + } + + @Test + void asyncVariants() throws Exception { + issuer.routes.put("POST /token/", r -> StubIssuer.json(200, "{\"access_token\":\"a\"}")); + issuer.routes.put("GET /session/", r -> StubIssuer.json(200, "{\"sub\":\"u\"}")); + issuer.routes.put( + "DELETE /session/", + r -> new me.didit.core.TransportResponse(204, Headers.empty(), new byte[0])); + issuer.routes.put("POST /step-up/", r -> StubIssuer.json(200, "{\"required\":false}")); + issuer.routes.put("GET /step-up/x/", r -> StubIssuer.json(200, "{\"status\":\"declined\"}")); + Authentication a = authWithClient(); + assertEquals("a", a.exchangeCodeAsync("c", "v", "r").get().accessToken()); + assertEquals("a", a.refreshAsync("r").get().accessToken()); + assertEquals("u", a.getSessionAsync("t").get().subject().orElseThrow()); + a.revokeSessionAsync("t").get(); + assertFalse(a.createStepUpAsync("t", StepUpParams.builder("bank").build()).get().required()); + assertFalse(a.retrieveStepUpAsync("t", "x").get().isApproved()); + assertEquals( + StubIssuer.ISSUER, + a.verifyAccessTokenAsync(access(issuer.accessClaims(now)), null).get().issuer()); + } + + @Test + void connectionFailures() { + Authentication refused = + Authentication.builder() + .issuer(StubIssuer.ISSUER) + .transport(r -> CompletableFuture.failedFuture(new ConnectException("refused"))) + .build(); + assertThrows(ApiConnectionException.class, () -> refused.getSession("t")); + Authentication slow = + Authentication.builder() + .issuer(StubIssuer.ISSUER) + .timeout(Duration.ofMillis(50)) + .transport(r -> new CompletableFuture<>()) + .build(); + assertThrows(ApiTimeoutException.class, () -> slow.getSession("t")); + Authentication broken = + Authentication.builder() + .issuer(StubIssuer.ISSUER) + .transport( + r -> { + throw new IllegalStateException("bug"); + }) + .build(); + assertThrows(ApiConnectionException.class, () -> broken.refresh("r")); + Authentication notJson = + Authentication.builder() + .issuer(StubIssuer.ISSUER) + .transport(r -> CompletableFuture.completedFuture(StubIssuer.json(200, "[1]"))) + .build(); + assertThrows(me.didit.errors.UnexpectedResponseException.class, () -> notJson.getSession("t")); + Authentication failingRead = + Authentication.builder() + .issuer(StubIssuer.ISSUER) + .transport( + r -> + CompletableFuture.completedFuture( + new me.didit.core.TransportResponse( + 200, + Headers.empty(), + new java.io.InputStream() { + @Override + public int read() throws IOException { + throw new IOException("reset"); + } + }))) + .build(); + assertThrows(ApiConnectionException.class, () -> failingRead.getSession("t")); + } + + @Test + void helpers() throws Exception { + Pkce pkce = Authentication.createPkce(); + assertEquals(43, pkce.verifier().length()); + assertEquals("S256", pkce.method()); + byte[] digest = + MessageDigest.getInstance("SHA-256") + .digest(pkce.verifier().getBytes(StandardCharsets.US_ASCII)); + assertEquals(Base64.getUrlEncoder().withoutPadding().encodeToString(digest), pkce.challenge()); + assertFalse(pkce.toString().contains(pkce.verifier())); + Set seen = new HashSet<>(); + for (int i = 0; i < 20; i++) { + String state = Authentication.createState(); + String nonce = Authentication.createNonce(); + assertEquals(43, state.length()); + assertTrue(state.matches("[A-Za-z0-9_-]+")); + assertTrue(seen.add(state)); + assertTrue(seen.add(nonce)); + } + } + + @Test + void publishableKeysAndIssuers() { + String live = + "pk_live_" + + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString("https://acme.auth.didit.me/".getBytes(StandardCharsets.UTF_8)); + PublishableKey key = PublishableKey.parse(" " + live + " "); + assertEquals("https://acme.auth.didit.me", key.issuer()); + assertTrue(key.isLive()); + assertTrue(key.toString().contains("acme")); + assertEquals("https://acme.auth.didit.me", Authentication.fromPublishableKey(live).issuer()); + String test = + "pk_test_" + + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString("http://localhost:8000".getBytes(StandardCharsets.UTF_8)); + assertFalse(PublishableKey.parse(test).isLive()); + String liveHttp = + "pk_live_" + + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString("http://localhost:8000".getBytes(StandardCharsets.UTF_8)); + assertThrows(ConfigurationException.class, () -> PublishableKey.parse(liveHttp)); + for (String bad : + new String[] { + "sk_live_abc", + "pk_live_", + "pk_live_a", + "pk_live_ab+c", + "pk_test_" + + Base64.getUrlEncoder() + .withoutPadding() + .encodeToString(new byte[] {(byte) 0xff, (byte) 0xfe}) + }) { + assertThrows(ConfigurationException.class, () -> PublishableKey.parse(bad), bad); + } + assertEquals( + "https://acme.auth.didit.me", + Authentication.create("https://acme.auth.didit.me//").issuer()); + assertEquals( + "http://app.localhost:8000", Authentication.create("http://app.localhost:8000").issuer()); + assertEquals("http://127.0.0.1:8000", Authentication.create("http://127.0.0.1:8000").issuer()); + for (String bad : + new String[] { + "http://acme.auth.didit.me", + "ftp://acme.auth.didit.me", + "https://user@acme.auth.didit.me", + "https://acme.auth.didit.me?x=1", + "https://acme.auth.didit.me#f", + "https://acme .auth.didit.me", + "not a url", + "acme.auth.didit.me" + }) { + assertThrows(ConfigurationException.class, () -> Authentication.create(bad), bad); + } + assertThrows(ConfigurationException.class, () -> Authentication.builder().build()); + assertThrows(ConfigurationException.class, () -> Authentication.builder().clientId("")); + assertThrows( + ConfigurationException.class, + () -> Authentication.builder().leeway(Duration.ofSeconds(-1))); + assertThrows( + ConfigurationException.class, () -> Authentication.builder().timeout(Duration.ZERO)); + assertTrue(Authentication.create("https://acme.auth.didit.me").toString().contains("acme")); + assertEquals( + "https://acme.auth.didit.me", + Authentication.builder() + .issuer("https://acme.auth.didit.me") + .httpClient( + java.net.http.HttpClient.newBuilder() + .followRedirects(java.net.http.HttpClient.Redirect.NEVER) + .build()) + .leeway(Duration.ZERO) + .build() + .issuer()); + } + + private String signRaw(String header, String payload) { + Base64.Encoder b64 = Base64.getUrlEncoder().withoutPadding(); + String input = + b64.encodeToString(header.getBytes(StandardCharsets.UTF_8)) + + "." + + b64.encodeToString(payload.getBytes(StandardCharsets.UTF_8)); + try { + java.security.Signature signer = + java.security.Signature.getInstance("SHA256withECDSAinP1363Format"); + signer.initSign(issuer.keys.getPrivate()); + signer.update(input.getBytes(StandardCharsets.US_ASCII)); + return input + "." + b64.encodeToString(signer.sign()); + } catch (java.security.GeneralSecurityException e) { + throw new IllegalStateException(e); + } + } + + private static Headers headers(String... pairs) { + Map> map = new LinkedHashMap<>(); + for (int i = 0; i < pairs.length; i += 2) { + map.put(pairs[i], List.of(pairs[i + 1])); + } + return Headers.of(map); + } + + private static Map form(byte[] body) { + Map out = new LinkedHashMap<>(); + for (String pair : new String(body, StandardCharsets.UTF_8).split("&")) { + String[] kv = pair.split("=", 2); + out.put( + URLDecoder.decode(kv[0], StandardCharsets.UTF_8), + URLDecoder.decode(kv[1], StandardCharsets.UTF_8)); + } + return out; + } +} diff --git a/src/test/java/me/didit/authentication/StubIssuer.java b/src/test/java/me/didit/authentication/StubIssuer.java new file mode 100644 index 0000000..f051390 --- /dev/null +++ b/src/test/java/me/didit/authentication/StubIssuer.java @@ -0,0 +1,195 @@ +package me.didit.authentication; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.Signature; +import java.security.interfaces.ECPublicKey; +import java.security.spec.ECGenParameterSpec; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Base64; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import me.didit.core.Headers; +import me.didit.core.HttpTransport; +import me.didit.core.Json; +import me.didit.core.TransportRequest; +import me.didit.core.TransportResponse; +import me.didit.testing.TestJson; + +/** + * A stubbed Didit Authentication issuer: discovery, JWKS with a key pair generated at test time, + * and scripted runtime responses. No key material is ever stored in the repository. + */ +final class StubIssuer implements HttpTransport { + static final String ISSUER = "https://acme.auth.didit.me"; + static final String APP_ID = "00000000-0000-4000-8000-0000000000a2"; + + final KeyPair keys = generate(); + final KeyPair otherKeys = generate(); + final String kid = "k_test_current"; + final List requests = new ArrayList<>(); + final Map> routes = new LinkedHashMap<>(); + + /** Routes whose response is held until the test completes the future. */ + final Map> held = new LinkedHashMap<>(); + + String cacheControl = "public, max-age=300"; + ObjectNode discovery; + + StubIssuer() { + discovery = Json.nodes().objectNode(); + discovery.put("issuer", ISSUER); + discovery.put("token_endpoint", ISSUER + "/token/"); + discovery.put("jwks_uri", ISSUER + "/.well-known/jwks.json"); + routes.put("GET /.well-known/openid-configuration", r -> json(200, discovery, cacheControl)); + routes.put("GET /.well-known/jwks.json", r -> json(200, jwks(), cacheControl)); + } + + static KeyPair generate() { + try { + KeyPairGenerator generator = KeyPairGenerator.getInstance("EC"); + generator.initialize(new ECGenParameterSpec("secp256r1")); + return generator.generateKeyPair(); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + ObjectNode jwks() { + ObjectNode doc = Json.nodes().objectNode(); + doc.putArray("keys").add(jwk(kid, (ECPublicKey) keys.getPublic())); + return doc; + } + + static ObjectNode jwk(String kid, ECPublicKey key) { + ObjectNode jwk = Json.nodes().objectNode(); + jwk.put("kty", "EC"); + jwk.put("crv", "P-256"); + jwk.put("kid", kid); + jwk.put("use", "sig"); + jwk.put("alg", "ES256"); + jwk.put("x", coordinate(key.getW().getAffineX())); + jwk.put("y", coordinate(key.getW().getAffineY())); + return jwk; + } + + static String coordinate(BigInteger value) { + byte[] raw = value.toByteArray(); + byte[] out = new byte[32]; + int copy = Math.min(raw.length, 32); + System.arraycopy(raw, raw.length - copy, out, 32 - copy, copy); + return Base64.getUrlEncoder().withoutPadding().encodeToString(out); + } + + static TransportResponse json(int status, ObjectNode body, String cacheControl) { + Map> h = new LinkedHashMap<>(); + h.put("Content-Type", List.of("application/json")); + h.put("Cache-Control", List.of(cacheControl)); + return new TransportResponse( + status, Headers.of(h), body.toString().getBytes(StandardCharsets.UTF_8)); + } + + static TransportResponse json(int status, String body) { + return new TransportResponse( + status, + Headers.of(Map.of("Content-Type", List.of("application/json"))), + body.getBytes(StandardCharsets.UTF_8)); + } + + long count(String route) { + return requests.stream() + .filter(r -> route.equals(r.method() + " " + r.uri().getPath())) + .count(); + } + + TransportRequest last(String route) { + TransportRequest found = null; + for (TransportRequest r : requests) { + if (route.equals(r.method() + " " + r.uri().getPath())) { + found = r; + } + } + if (found == null) { + throw new AssertionError("No request " + route); + } + return found; + } + + @Override + public synchronized CompletableFuture send(TransportRequest request) { + requests.add(request); + String route = request.method() + " " + request.uri().getPath(); + CompletableFuture pending = held.get(route); + if (pending != null) { + return pending; + } + Function handler = routes.get(route); + if (handler == null) { + return CompletableFuture.completedFuture(json(404, "{\"detail\":\"not found\"}")); + } + return CompletableFuture.completedFuture(handler.apply(request)); + } + + // -- tokens -------------------------------------------------------------------- + + ObjectNode header(String typ) { + ObjectNode header = Json.nodes().objectNode(); + header.put("alg", "ES256"); + header.put("typ", typ); + header.put("kid", kid); + return header; + } + + ObjectNode accessClaims(Instant now) { + ObjectNode claims = Json.nodes().objectNode(); + claims.put("iss", ISSUER); + claims.put("aud", APP_ID); + claims.put("client_id", APP_ID); + claims.put("sub", "11111111-1111-4111-8111-111111111111"); + claims.put("sid", "22222222-2222-4222-8222-222222222222"); + claims.put("jti", "jti-1"); + claims.put("iat", now.getEpochSecond()); + claims.put("exp", now.getEpochSecond() + 300); + claims.put("vendor_data", "user-42"); + claims.putArray("amr").add("passkey"); + ObjectNode org = claims.putObject("org"); + org.put("id", "org-1"); + org.put("role", "admin"); + ObjectNode verified = claims.putObject("verified"); + verified.put("level", "full_id"); + verified.put("over_18", true); + claims.putNull("act"); + return claims; + } + + String sign(ObjectNode header, ObjectNode claims) { + return sign(header, claims, keys); + } + + static String sign(ObjectNode header, ObjectNode claims, KeyPair pair) { + Base64.Encoder b64 = Base64.getUrlEncoder().withoutPadding(); + String input = + b64.encodeToString(header.toString().getBytes(StandardCharsets.UTF_8)) + + "." + + b64.encodeToString(claims.toString().getBytes(StandardCharsets.UTF_8)); + try { + Signature signer = Signature.getInstance("SHA256withECDSAinP1363Format"); + signer.initSign(pair.getPrivate()); + signer.update(input.getBytes(StandardCharsets.US_ASCII)); + return input + "." + b64.encodeToString(signer.sign()); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + static ObjectNode parse(String json) { + return (ObjectNode) TestJson.parse(json); + } +} diff --git a/src/test/java/me/didit/core/ApiClientTest.java b/src/test/java/me/didit/core/ApiClientTest.java new file mode 100644 index 0000000..d97153c --- /dev/null +++ b/src/test/java/me/didit/core/ApiClientTest.java @@ -0,0 +1,759 @@ +package me.didit.core; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.IOException; +import java.net.ConnectException; +import java.net.URI; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpTimeoutException; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import me.didit.errors.ApiConnectionException; +import me.didit.errors.ApiStatusException; +import me.didit.errors.ApiTimeoutException; +import me.didit.errors.AuthenticationException; +import me.didit.errors.BadRequestException; +import me.didit.errors.ConfigurationException; +import me.didit.errors.ConflictException; +import me.didit.errors.InternalServerException; +import me.didit.errors.NotFoundException; +import me.didit.errors.PermissionDeniedException; +import me.didit.errors.RateLimitException; +import me.didit.errors.UnexpectedResponseException; +import me.didit.errors.UnprocessableEntityException; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.TestJson; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +final class ApiClientTest { + private final MockTransport transport = new MockTransport(); + private final List delays = new ArrayList<>(); + + private ClientOptions.Builder options() { + return ClientOptions.builder() + .apiKey("test-api-key") + .organizationId("org-1") + .applicationId("app-1") + .environment(name -> null) + .transport(transport) + .scheduler( + delay -> { + delays.add(delay); + Executor now = Runnable::run; + return now; + }); + } + + private ApiClient client() { + return new ApiClient(options().build()); + } + + private static final ResponseHandler JSON = Responses.jsonNode(); + + private static ApiRequest get(String path) { + return ApiRequest.builder("GET", path).build(); + } + + @Test + void sendsTheStandardHeaders() { + transport.respond(200, "{\"ok\":true}"); + RawResponse raw = client().execute(get("/v3/x/"), RequestOptions.none(), JSON); + RecordedRequest r = transport.only(); + assertEquals("test-api-key", r.header("x-api-key")); + assertEquals("application/json", r.header("Accept")); + assertTrue( + r.header("User-Agent").matches("didit-java/\\d+\\.\\d+\\.\\d+.* \\(Java [^;]+; [^)]+\\)"), + r.header("User-Agent")); + assertEquals("java/" + Version.VERSION, r.header("X-Didit-Client")); + assertNull(r.header("Content-Type")); + assertEquals("https://verification.didit.me/v3/x/", r.uri().toString()); + assertEquals(200, raw.statusCode()); + assertTrue(raw.data().get("ok").asBoolean()); + assertTrue(raw.toString().contains("200")); + } + + @Test + void requestOptionsOverrideTheClient() { + transport.respond(200, "{}"); + ApiClient client = + new ApiClient(options().defaultHeader("X-Team", "a").defaultHeader("X-Other", "1").build()); + client.execute( + ApiRequest.builder( + "POST", "/v3/organization/{organization_id}/application/{application_id}/x/") + .applicationScoped() + .build(), + RequestOptions.builder() + .apiKey("other-key") + .organizationId("org-2") + .applicationId("app-2") + .header("x-team", "b") + .idempotencyKey("idem-1") + .queryParam("debug", "1") + .timeout(Duration.ofSeconds(5)) + .maxRetries(0) + .build(), + JSON); + RecordedRequest r = transport.only(); + assertEquals("other-key", r.header("x-api-key")); + assertEquals("/v3/organization/org-2/application/app-2/x/", r.path()); + assertEquals("b", r.header("X-Team")); + assertEquals("1", r.header("X-Other")); + assertEquals("idem-1", r.header("Idempotency-Key")); + assertEquals(Map.of("debug", List.of("1")), r.query()); + assertEquals(Duration.ofSeconds(5), r.raw().timeout()); + } + + @Test + void configurationErrorsHappenBeforeSending() { + ApiClient noKey = new ApiClient(options().environment(n -> null).build().toBuilder().build()); + ClientOptions withoutKey = + ClientOptions.builder().environment(name -> null).transport(transport).build(); + ConfigurationException e = + assertThrows( + ConfigurationException.class, + () -> new ApiClient(withoutKey).execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertTrue(e.getMessage().contains("DIDIT_API_KEY")); + assertThrows( + ConfigurationException.class, + () -> + new ApiClient(withoutKey) + .execute( + ApiRequest.builder( + "GET", + "/v3/organization/{organization_id}/application/{application_id}/x/") + .auth(ApiRequest.Auth.NONE) + .applicationScoped() + .build(), + RequestOptions.none(), + JSON)); + assertThrows( + ConfigurationException.class, + () -> + new ApiClient(withoutKey) + .execute( + ApiRequest.builder("GET", "/x/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .build(), + RequestOptions.none(), + JSON)); + for (String bad : new String[] {"", ".", ".."}) { + assertThrows( + ConfigurationException.class, + () -> + noKey.execute( + ApiRequest.builder("GET", "/v3/session/{id}/").pathParam("id", bad).build(), + RequestOptions.none(), + JSON)); + } + assertThrows( + ConfigurationException.class, + () -> + noKey.execute( + ApiRequest.builder("GET", "/v3/session/{id}/").build(), + RequestOptions.none(), + JSON)); + assertEquals(0, transport.requests().size()); + } + + @Test + void pathParametersAreEncodedAsOneSegment() { + transport.respond(200, "{}"); + client() + .execute( + ApiRequest.builder("GET", "/v3/session/{id}/x/").pathParam("id", "a/b c?รฉ").build(), + RequestOptions.none(), + JSON); + assertEquals("/v3/session/a%2Fb%20c%3F%C3%A9/x/", transport.only().uri().getRawPath()); + } + + @Test + void queryAndHeaderFieldsComeFromTheParameters() { + transport.respond(200, "{}"); + Pet params = + Pet.builder() + .name("Rex") + .age(3) + .tags(List.of("a", "b")) + .nickname(null) + .extra(Map.of("k", 1.5)) + .build(); + client() + .execute( + ApiRequest.builder("PATCH", "/v3/pets/") + .params(params) + .queryFields("tags", "nickname") + .queryField("years", "age") + .headerField("X-Pet-Name", "name") + .body(ApiRequest.BodyEncoding.JSON) + .build(), + RequestOptions.none(), + JSON); + RecordedRequest r = transport.only(); + assertEquals(Map.of("tags", List.of("a", "b"), "years", List.of("3")), r.query()); + assertEquals("Rex", r.header("X-Pet-Name")); + assertEquals("application/json", r.header("Content-Type")); + TestJson.assertJsonEquals("{\"extra\":{\"k\":1.5}}", r.body()); + } + + @Test + void multipartBodies() { + transport.respond(200, "{}").respond(200, "{}"); + Pet params = + Pet.builder() + .name("Rex") + .age(3) + .tags(List.of("a", "b")) + .nickname(null) + .extra(Map.of("k", List.of(Map.of("x", true)))) + .kind(Pet.Kind.DOG) + .photo(FileUpload.of(new byte[] {1, 2, 3}, "rex.jpg")) + .build(); + ApiRequest request = + ApiRequest.builder("POST", "/v3/pets/") + .params(params) + .body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART) + .build(); + client().execute(request, RequestOptions.none(), JSON); + RecordedRequest r = transport.requests().get(0); + assertTrue(r.header("Content-Type").startsWith("multipart/form-data; boundary=didit-")); + assertEquals( + Map.of( + "name", List.of("Rex"), + "age", List.of("3"), + "tags", List.of("a", "b"), + "extra", List.of("{\"k\":[{\"x\":true}]}"), + "kind", List.of("dog")), + r.multipartFields()); + assertEquals(Map.of("photo", List.of("rex.jpg")), r.multipartFiles()); + RecordedRequest.Part photo = + r.parts().stream().filter(p -> p.fileName != null).findFirst().orElseThrow(); + assertEquals("image/jpeg", photo.contentType); + // Without a file, the same operation sends JSON. + client() + .execute( + ApiRequest.builder("POST", "/v3/pets/") + .params(Pet.builder().name("Rex").build()) + .body(ApiRequest.BodyEncoding.JSON_OR_MULTIPART) + .build(), + RequestOptions.none(), + JSON); + assertEquals("application/json", transport.requests().get(1).header("Content-Type")); + } + + @Test + void accountOperationsUseTheAccountTokenAndNeverTheApiKey() { + transport.respond(200, "[]"); + ApiClient client = new ApiClient(options().accountToken("acct-1").build()); + client.execute( + ApiRequest.builder("GET", "/organizations/me/") + .account() + .auth(ApiRequest.Auth.ACCOUNT_TOKEN) + .build(), + RequestOptions.none(), + JSON); + RecordedRequest r = transport.only(); + assertEquals("https://apx.didit.me/auth/v2/organizations/me/", r.uri().toString()); + assertEquals("Bearer acct-1", r.header("Authorization")); + assertNull(r.header("x-api-key")); + transport.respond(200, "{}"); + client.execute( + ApiRequest.builder("POST", "/programmatic/login/") + .account() + .auth(ApiRequest.Auth.NONE) + .build(), + RequestOptions.builder().accountToken("ignored").build(), + JSON); + RecordedRequest login = transport.requests().get(1); + assertNull(login.header("Authorization")); + assertNull(login.header("x-api-key")); + } + + @ParameterizedTest + @CsvSource({ + "400,BadRequestException", + "401,AuthenticationException", + "403,PermissionDeniedException", + "404,NotFoundException", + "409,ConflictException", + "422,UnprocessableEntityException", + "429,RateLimitException", + "500,InternalServerException", + "503,InternalServerException", + "418,ApiStatusException" + }) + void statusErrors(int status, String type) { + for (int i = 0; i < 3; i++) { + transport.respond( + status, + Map.of("Content-Type", "application/json", "X-Request-Id", "req-9"), + "{\"detail\":\"Nope\"}"); + } + ApiStatusException e = + assertThrows( + ApiStatusException.class, + () -> + client() + .execute( + ApiRequest.builder("POST", "/v3/x/").build(), RequestOptions.none(), JSON)); + assertEquals(type, e.getClass().getSimpleName()); + assertEquals(status, e.statusCode()); + assertEquals("Nope", e.body().orElseThrow().get("detail").asText()); + assertEquals("req-9", e.requestId().orElseThrow()); + assertEquals("req-9", e.headers().requestId().orElseThrow()); + assertTrue(e.getMessage().contains("POST /v3/x/")); + assertTrue(e.getMessage().contains("Nope")); + assertTrue(e.getMessage().contains("req-9")); + assertFalse(e.getMessage().contains("test-api-key")); + } + + @Test + void errorBodiesThatAreNotJson() { + transport.respond(404, Map.of("Content-Type", "text/html"), "

" + "x".repeat(400) + "

"); + NotFoundException e = + assertThrows( + NotFoundException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertTrue(e.body().orElseThrow().isTextual()); + assertTrue(e.getMessage().endsWith("...")); + transport.respond(400, Map.of(), ""); + BadRequestException empty = + assertThrows( + BadRequestException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertTrue(empty.body().isEmpty()); + assertTrue(empty.requestId().isEmpty()); + transport.respond(422, "{\"field\":[\"bad\"]}"); + UnprocessableEntityException fields = + assertThrows( + UnprocessableEntityException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertTrue(fields.getMessage().contains("field")); + } + + @Test + void retriesIdempotentRequestsOnServerErrors() { + transport.respond(503, "{}").respond(502, "{}").respond(200, "{\"ok\":1}"); + RawResponse r = client().execute(get("/v3/x/"), RequestOptions.none(), JSON); + assertEquals(200, r.statusCode()); + assertEquals(3, transport.requests().size()); + assertEquals(2, delays.size()); + assertTrue(delays.get(0).toMillis() <= 500); + assertTrue(delays.get(1).toMillis() <= 1000); + } + + @Test + void givesUpAfterMaxRetries() { + for (int i = 0; i < 3; i++) { + transport.respond(500, "{}"); + } + assertThrows( + InternalServerException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertEquals(3, transport.requests().size()); + } + + @Test + void neverRetriesPostOrPatchAfterTheRequestMayHaveArrived() { + transport.respond(503, "{}"); + assertThrows( + InternalServerException.class, + () -> + client() + .execute( + ApiRequest.builder("POST", "/v3/x/").build(), RequestOptions.none(), JSON)); + assertEquals(1, transport.requests().size()); + transport.respond(408, "{}"); + assertThrows( + ApiStatusException.class, + () -> + client() + .execute( + ApiRequest.builder("PATCH", "/v3/x/").build(), RequestOptions.none(), JSON)); + assertEquals(2, transport.requests().size()); + transport.fail(new IOException("connection reset")); + ApiConnectionException e = + assertThrows( + ApiConnectionException.class, + () -> + client() + .execute( + ApiRequest.builder("POST", "/v3/x/").build(), RequestOptions.none(), JSON)); + assertTrue(e.getMessage().contains("connection reset")); + assertEquals(3, transport.requests().size()); + transport.fail(new HttpTimeoutException("read timed out")); + assertThrows( + ApiTimeoutException.class, + () -> + client() + .execute( + ApiRequest.builder("POST", "/v3/x/").build(), RequestOptions.none(), JSON)); + assertEquals(4, transport.requests().size()); + } + + @Test + void retriesPostOnRateLimitsAndConnectionsThatNeverOpened() { + transport + .respond(429, Map.of("Retry-After", "2"), "{}") + .fail(new ConnectException("refused")) + .respond(201, "{}"); + RawResponse r = + client().execute(ApiRequest.builder("POST", "/v3/x/").build(), RequestOptions.none(), JSON); + assertEquals(201, r.statusCode()); + assertEquals(3, transport.requests().size()); + assertEquals(Duration.ofSeconds(2), delays.get(0)); + transport.fail(new HttpConnectTimeoutException("connect timed out")).respond(200, "{}"); + client().execute(ApiRequest.builder("PATCH", "/v3/x/").build(), RequestOptions.none(), JSON); + assertEquals(5, transport.requests().size()); + } + + @Test + void retriesGetOnConnectionErrorsAndTimeouts() { + transport + .fail(new IOException("reset")) + .fail(new HttpTimeoutException("slow")) + .respond(200, "{}"); + client().execute(get("/v3/x/"), RequestOptions.none(), JSON); + assertEquals(3, transport.requests().size()); + for (int i = 0; i < 3; i++) { + transport.fail(new HttpTimeoutException("slow")); + } + assertThrows( + ApiTimeoutException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + transport.fail(new HttpConnectTimeoutException("connect")); + ApiConnectionException e = + assertThrows( + ApiConnectionException.class, + () -> + client() + .execute(get("/v3/x/"), RequestOptions.builder().maxRetries(0).build(), JSON)); + assertFalse(e instanceof ApiTimeoutException); + } + + @Test + void aTransportBugIsNotRetried() { + transport.answer( + r -> { + throw new IllegalStateException("bug"); + }); + ApiConnectionException e = + assertThrows( + ApiConnectionException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertInstanceOf(IllegalStateException.class, e.getCause()); + assertEquals(1, transport.requests().size()); + } + + @Test + void timesOutWhenNoResponseArrives() { + transport.answer(r -> new CompletableFuture<>()); + ApiTimeoutException e = + assertThrows( + ApiTimeoutException.class, + () -> + client() + .execute( + ApiRequest.builder("POST", "/v3/x/").build(), + RequestOptions.builder().timeout(Duration.ofMillis(50)).build(), + JSON)); + assertTrue(e.getMessage().contains("50 ms")); + } + + @Test + void retryAfterParsing() { + ZonedDateTime now = ZonedDateTime.parse("2026-11-01T10:00:00Z"); + assertEquals( + Optional.of(Duration.ofMillis(1500)), ApiClient.RetryPolicy.parseRetryAfter("1.5", now)); + assertEquals( + Optional.of(Duration.ofSeconds(30)), + ApiClient.RetryPolicy.parseRetryAfter( + now.plusSeconds(30).format(DateTimeFormatter.RFC_1123_DATE_TIME), now)); + assertEquals( + Optional.of(Duration.ZERO), + ApiClient.RetryPolicy.parseRetryAfter( + now.minusSeconds(30).format(DateTimeFormatter.RFC_1123_DATE_TIME), now)); + assertEquals(Optional.empty(), ApiClient.RetryPolicy.parseRetryAfter("soon", now)); + assertEquals(Optional.empty(), ApiClient.RetryPolicy.parseRetryAfter("-1", now)); + assertEquals(Optional.empty(), ApiClient.RetryPolicy.parseRetryAfter("NaN", now)); + assertEquals( + Duration.ofSeconds(60), ApiClient.RetryPolicy.delay(0, Optional.of("3600"), 0.5, now)); + assertEquals( + Duration.ofMillis(250), ApiClient.RetryPolicy.delay(0, Optional.empty(), 0.5, now)); + assertEquals( + Duration.ofMillis(500), ApiClient.RetryPolicy.delay(1, Optional.of("x"), 0.5, now)); + assertEquals( + Duration.ofSeconds(8), ApiClient.RetryPolicy.delay(10, Optional.empty(), 1.0, now)); + assertTrue(ApiClient.RetryPolicy.retryableStatus(429, false)); + assertFalse(ApiClient.RetryPolicy.retryableStatus(500, false)); + assertTrue(ApiClient.RetryPolicy.retryableStatus(408, true)); + assertFalse(ApiClient.RetryPolicy.retryableStatus(404, true)); + assertTrue( + ApiClient.RetryPolicy.failedBeforeSending( + new IOException(new java.net.UnknownHostException("x")))); + assertFalse(ApiClient.RetryPolicy.failedBeforeSending(new IOException("reset"))); + } + + @Test + void unexpectedSuccessBodies() { + transport.respond(200, Map.of("Content-Type", "text/html"), ""); + assertThrows( + UnexpectedResponseException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), Responses.json(Conv.STRING))); + transport.respond(200, Map.of(), ""); + assertThrows( + UnexpectedResponseException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), Responses.json(Conv.STRING))); + transport.respond(200, Map.of(), "{bad json"); + assertThrows( + UnexpectedResponseException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + transport.respond(200, "[1]"); + assertThrows( + UnexpectedResponseException.class, + () -> + client() + .execute( + get("/v3/x/"), + RequestOptions.none(), + Responses.json(Conv.model(Pet::fromJson)))); + transport.respond(204, Map.of(), ""); + assertNull( + client() + .execute( + ApiRequest.builder("DELETE", "/v3/x/").build(), + RequestOptions.none(), + Responses.none()) + .data()); + } + + @Test + void typedAndStatusDependentBodies() { + transport.respond(200, "{\"name\":\"Rex\",\"age\":\"4\"}"); + Pet pet = + client() + .execute( + get("/v3/pet/"), RequestOptions.none(), Responses.json(Conv.model(Pet::fromJson))) + .data(); + assertEquals("Rex", pet.name()); + assertEquals(4L, pet.age().orElseThrow()); + transport.respond(202, "{\"job\":1}"); + Pet.Outcome outcome = + client() + .execute( + get("/v3/pet/"), + RequestOptions.none(), + Responses.byStatus(Pet.Outcome::fromResponse)) + .data(); + assertEquals(202, outcome.statusCode()); + assertEquals(1, outcome._json().get("job").asInt()); + assertTrue(outcome.toString().contains("202")); + assertTrue(outcome.equals(Pet.Outcome.fromResponse(202, TestJson.parse("{\"job\":1}")))); + assertFalse(outcome.equals(Pet.Outcome.fromResponse(200, TestJson.parse("{\"job\":1}")))); + assertEquals( + outcome.hashCode(), + Pet.Outcome.fromResponse(202, TestJson.parse("{\"job\":1}")).hashCode()); + } + + @Test + void binaryResponsesStream() throws Exception { + transport.respondBinary(200, "application/pdf", "%PDF-1.7".getBytes(StandardCharsets.UTF_8)); + BinaryResponse pdf = + client() + .execute( + ApiRequest.builder("GET", "/v3/session/{id}/generate-pdf/") + .pathParam("id", "s") + .accept("application/pdf") + .build(), + RequestOptions.none(), + Responses.binary()) + .data(); + assertEquals("application/pdf, application/json", transport.only().header("Accept")); + assertTrue(transport.only().raw().streamResponse()); + assertEquals("application/pdf", pdf.contentType().orElseThrow()); + assertEquals("%PDF-1.7", new String(pdf.bytes(), StandardCharsets.UTF_8)); + assertThrows(IllegalStateException.class, pdf::bytes); + assertTrue(pdf.toString().contains("application/pdf")); + + BinaryResponse file = + BinaryResponse.of( + MockTransport.headers( + Map.of("Content-Disposition", "attachment; filename=\"report.pdf\"")), + new byte[] {1, 2}); + assertEquals("report.pdf", file.fileName().orElseThrow()); + java.nio.file.Path target = java.nio.file.Files.createTempFile("didit", ".pdf"); + try { + assertEquals(2, file.writeTo(target)); + assertEquals(2, java.nio.file.Files.size(target)); + } finally { + java.nio.file.Files.delete(target); + } + BinaryResponse stream = BinaryResponse.of(Headers.empty(), new byte[] {7}); + try (java.io.InputStream in = stream.stream()) { + assertEquals(7, in.read()); + } + stream.close(); + assertTrue(BinaryResponse.of(Headers.empty(), new byte[0]).fileName().isEmpty()); + assertTrue( + BinaryResponse.of( + MockTransport.headers(Map.of("Content-Disposition", "inline; filename=")), + new byte[0]) + .fileName() + .isEmpty()); + assertEquals( + "a.csv", + BinaryResponse.of( + MockTransport.headers(Map.of("Content-Disposition", "attachment; FILENAME=a.csv")), + new byte[0]) + .fileName() + .orElseThrow()); + } + + @Test + void asyncExecutionAndCancellation() throws Exception { + transport.respond(200, "{\"a\":1}"); + CompletableFuture> f = + client().executeAsync(get("/v3/x/"), RequestOptions.none(), JSON); + assertEquals(1, f.get().data().get("a").asInt()); + CompletableFuture never = new CompletableFuture<>(); + transport.answer(r -> never); + CompletableFuture> pending = + client().executeAsync(get("/v3/x/"), RequestOptions.none(), JSON); + pending.cancel(true); + assertTrue(never.isCancelled()); + CompletableFuture> failed = + new ApiClient(ClientOptions.builder().environment(n -> null).transport(transport).build()) + .executeAsync(get("/v3/x/"), RequestOptions.none(), JSON); + ExecutionException e = assertThrows(ExecutionException.class, failed::get); + assertInstanceOf(ConfigurationException.class, e.getCause()); + } + + @Test + void awaitHandlesInterruptsAndCheckedFailures() { + CompletableFuture never = new CompletableFuture<>(); + Thread.currentThread().interrupt(); + assertThrows(ApiConnectionException.class, () -> ApiClient.await(never)); + assertTrue(Thread.interrupted()); + assertTrue(never.isCancelled()); + CompletableFuture checked = CompletableFuture.failedFuture(new Exception("checked")); + assertEquals( + "Request failed", + assertThrows(me.didit.errors.DiditException.class, () -> ApiClient.await(checked)) + .getMessage()); + CompletableFuture error = CompletableFuture.failedFuture(new AssertionError("boom")); + assertThrows(AssertionError.class, () -> ApiClient.await(error)); + } + + @Test + void debugLoggingNeverFails() { + transport.respond(503, "{}").respond(200, "{}").respond(404, "{}").fail(new IOException("x")); + ApiClient client = new ApiClient(options().debugLogging(true).build()); + assertTrue(client.options().debugLogging()); + client.execute(get("/v3/x/"), RequestOptions.none(), JSON); + assertThrows( + NotFoundException.class, () -> client.execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertThrows( + ApiConnectionException.class, + () -> + client.execute( + ApiRequest.builder("POST", "/v3/x/").build(), RequestOptions.none(), JSON)); + } + + @Test + void handlerFailuresSurfaceAsTheirOwnErrors() { + transport.respond(200, "{}"); + ResponseHandler broken = + response -> { + throw new UnexpectedResponseException("bad shape"); + }; + assertThrows( + UnexpectedResponseException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), broken)); + transport.answer( + r -> + CompletableFuture.completedFuture( + new TransportResponse( + 200, + Headers.empty(), + new java.io.InputStream() { + @Override + public int read() throws IOException { + throw new IOException("reset while reading"); + } + }))); + assertThrows( + ApiConnectionException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + } + + @Test + void errorBodyReadFailuresStillRaiseTheStatusError() { + transport.answer( + r -> + CompletableFuture.completedFuture( + new TransportResponse( + 400, + Headers.empty(), + new java.io.InputStream() { + @Override + public int read() throws IOException { + throw new IOException("reset"); + } + }))); + BadRequestException e = + assertThrows( + BadRequestException.class, + () -> client().execute(get("/v3/x/"), RequestOptions.none(), JSON)); + assertTrue(e.body().isEmpty()); + } + + @Test + void unusedConstructorsOfStatusExceptions() { + Headers h = Headers.empty(); + assertEquals(403, new PermissionDeniedException("m", null, h).statusCode()); + assertEquals(409, new ConflictException("m", null, h).statusCode()); + assertEquals(429, new RateLimitException("m", null, h).statusCode()); + assertEquals(401, new AuthenticationException("m", null, h).statusCode()); + assertTrue(new ApiStatusException("m", 418, TestJson.parse("{\"a\":1}"), h).body().isPresent()); + } + + @Test + void origins() { + URI base = URI.create("https://verification.didit.me"); + assertEquals( + "https://verification.didit.me/v3/sessions/?offset=10", + ApiClient.Paths.sameOrigin( + base, URI.create("http://verification.didit.me/v3/sessions/?offset=10")) + .toString()); + assertEquals( + "https://verification.didit.me/v3/x/?a=1", + ApiClient.Paths.sameOrigin(base, URI.create("/v3/x/?a=1")).toString()); + assertThrows( + UnexpectedResponseException.class, + () -> ApiClient.Paths.sameOrigin(base, URI.create("https://evil.example.com/v3/"))); + assertThrows( + UnexpectedResponseException.class, + () -> + ApiClient.Paths.sameOrigin(base, URI.create("https://verification.didit.me:8443/v3/"))); + assertEquals("", ApiClient.Paths.queryString(List.of())); + } +} diff --git a/src/test/java/me/didit/core/ClientOptionsTest.java b/src/test/java/me/didit/core/ClientOptionsTest.java new file mode 100644 index 0000000..8932f2f --- /dev/null +++ b/src/test/java/me/didit/core/ClientOptionsTest.java @@ -0,0 +1,179 @@ +package me.didit.core; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.net.http.HttpClient; +import java.time.Duration; +import java.util.Map; +import me.didit.errors.ConfigurationException; +import org.junit.jupiter.api.Test; + +final class ClientOptionsTest { + @Test + void defaults() { + ClientOptions o = ClientOptions.builder().environment(name -> null).build(); + assertTrue(o.apiKey().isEmpty()); + assertTrue(o.accountToken().isEmpty()); + assertEquals("https://verification.didit.me", o.baseUrl().toString()); + assertEquals("https://apx.didit.me/auth/v2", o.accountBaseUrl().toString()); + assertEquals(Duration.ofSeconds(60), o.timeout()); + assertEquals(2, o.maxRetries()); + assertTrue(o.organizationId().isEmpty()); + assertTrue(o.applicationId().isEmpty()); + assertFalse(o.debugLogging()); + assertTrue(o.transport() instanceof JdkHttpTransport); + assertTrue(o.defaultHeaders().isEmpty()); + } + + @Test + void environmentFallbacks() { + Map env = + Map.of( + "DIDIT_API_KEY", " key-from-env ", + "DIDIT_ORGANIZATION_ID", "org-env", + "DIDIT_APPLICATION_ID", "app-env", + "DIDIT_LOG", "DEBUG", + "DIDIT_ACCOUNT_TOKEN", "never-read"); + ClientOptions o = ClientOptions.builder().environment(env::get).build(); + assertEquals("key-from-env", o.apiKey().orElseThrow()); + assertEquals("org-env", o.organizationId().orElseThrow()); + assertEquals("app-env", o.applicationId().orElseThrow()); + assertTrue(o.debugLogging()); + assertTrue(o.accountToken().isEmpty(), "the account token has no environment fallback"); + ClientOptions explicit = + ClientOptions.builder() + .environment(env::get) + .apiKey("explicit") + .organizationId("org") + .applicationId("app") + .debugLogging(false) + .build(); + assertEquals("explicit", explicit.apiKey().orElseThrow()); + assertEquals("org", explicit.organizationId().orElseThrow()); + assertFalse(explicit.debugLogging()); + ClientOptions blank = ClientOptions.builder().environment(name -> " ").apiKey(" ").build(); + assertTrue(blank.apiKey().isEmpty()); + } + + @Test + void baseUrlRules() { + assertEquals( + "http://localhost:4010", + ClientOptions.builder() + .environment(n -> null) + .baseUrl("http://localhost:4010/") + .build() + .baseUrl() + .toString()); + assertEquals( + "http://127.0.0.1:4010/prefix", + ClientOptions.builder() + .environment(n -> null) + .baseUrl("http://127.0.0.1:4010/prefix") + .build() + .baseUrl() + .toString()); + assertEquals( + "http://[::1]:4010", + ClientOptions.builder() + .environment(n -> null) + .accountBaseUrl("http://[::1]:4010") + .build() + .accountBaseUrl() + .toString()); + for (String bad : + new String[] { + "http://verification.didit.me", + "ftp://verification.didit.me", + "verification.didit.me", + "https://verification.didit.me?x=1", + "https://verification.didit.me#x", + "https://exa mple.com", + "http://10.0.0.1" + }) { + assertThrows( + ConfigurationException.class, + () -> ClientOptions.builder().environment(n -> null).baseUrl(bad).build(), + bad); + } + } + + @Test + void validation() { + assertThrows(IllegalArgumentException.class, () -> ClientOptions.builder().maxRetries(-1)); + assertThrows( + IllegalArgumentException.class, () -> ClientOptions.builder().timeout(Duration.ZERO)); + assertThrows( + IllegalArgumentException.class, + () -> ClientOptions.builder().timeout(Duration.ofSeconds(-1))); + assertThrows(IllegalArgumentException.class, () -> RequestOptions.builder().maxRetries(-1)); + assertThrows( + IllegalArgumentException.class, () -> RequestOptions.builder().timeout(Duration.ZERO)); + HttpClient redirecting = + HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build(); + assertThrows( + IllegalArgumentException.class, + () -> ClientOptions.builder().httpClient(redirecting).build()); + } + + @Test + void toBuilderKeepsEverythingAndToStringRedacts() { + HttpTransport transport = r -> new java.util.concurrent.CompletableFuture<>(); + ClientOptions o = + ClientOptions.builder() + .environment(n -> null) + .apiKey("secret-key") + .accountToken("secret-token") + .organizationId("org") + .applicationId("app") + .timeout(Duration.ofSeconds(5)) + .maxRetries(4) + .defaultHeader("X-A", "1") + .transport(transport) + .debugLogging(true) + .build(); + ClientOptions copy = o.toBuilder().build(); + assertEquals("secret-key", copy.apiKey().orElseThrow()); + assertEquals("secret-token", copy.accountToken().orElseThrow()); + assertEquals(Duration.ofSeconds(5), copy.timeout()); + assertEquals(4, copy.maxRetries()); + assertEquals(Map.of("X-A", "1"), copy.defaultHeaders()); + assertSame(transport, copy.transport()); + assertTrue(copy.debugLogging()); + assertFalse(o.toString().contains("secret-key")); + assertFalse(o.toString().contains("secret-token")); + assertTrue(o.toString().contains("[REDACTED]")); + assertTrue( + ClientOptions.builder().environment(n -> null).build().toString().contains("apiKey=unset")); + HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build(); + assertTrue( + ClientOptions.builder().environment(n -> null).httpClient(client).build().transport() + instanceof JdkHttpTransport); + assertTrue( + ClientOptions.builder() + .environment(n -> null) + .timeout(Duration.ofSeconds(5)) + .build() + .transport() + instanceof JdkHttpTransport); + RequestOptions ro = RequestOptions.builder().apiKey("hidden").header("X", "1").build(); + assertFalse(ro.toString().contains("hidden")); + assertTrue(RequestOptions.none().headers().isEmpty()); + assertTrue(RequestOptions.none().queryParams().isEmpty()); + assertTrue(RequestOptions.none().idempotencyKey().isEmpty()); + } + + @Test + void loopbackDetection() { + assertTrue(ClientOptions.isLoopback("localhost")); + assertTrue(ClientOptions.isLoopback("127.0.0.1")); + assertTrue(ClientOptions.isLoopback("[::1]")); + assertFalse(ClientOptions.isLoopback("example.com")); + assertFalse(ClientOptions.isLoopback("10.1.1.1")); + assertFalse(ClientOptions.isLoopback("999.1.1.1")); + } +} diff --git a/src/test/java/me/didit/core/JdkHttpTransportTest.java b/src/test/java/me/didit/core/JdkHttpTransportTest.java new file mode 100644 index 0000000..c36450b --- /dev/null +++ b/src/test/java/me/didit/core/JdkHttpTransportTest.java @@ -0,0 +1,158 @@ +package me.didit.core; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.JsonNode; +import com.sun.net.httpserver.HttpServer; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.http.HttpClient; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.concurrent.atomic.AtomicReference; +import me.didit.Didit; +import me.didit.errors.ApiConnectionException; +import me.didit.errors.ApiStatusException; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** The default transport against a loopback HTTP server (no external network). */ +final class JdkHttpTransportTest { + private HttpServer server; + private final AtomicReference lastKey = new AtomicReference<>(); + private final AtomicReference lastBody = new AtomicReference<>(); + + @BeforeEach + void start() throws Exception { + server = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); + server.createContext( + "/v3/echo/", + exchange -> { + lastKey.set(exchange.getRequestHeaders().getFirst("x-api-key")); + lastBody.set( + new String(exchange.getRequestBody().readAllBytes(), StandardCharsets.UTF_8)); + byte[] body = "{\"ok\":true}".getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().add("Content-Type", "application/json"); + exchange.getResponseHeaders().add("X-Request-Id", "req-local"); + exchange.sendResponseHeaders(200, body.length); + try (OutputStream out = exchange.getResponseBody()) { + out.write(body); + } + }); + server.createContext( + "/v3/redirect/", + exchange -> { + exchange.getResponseHeaders().add("Location", "https://evil.example.com/"); + exchange.sendResponseHeaders(302, -1); + exchange.close(); + }); + server.createContext( + "/v3/pdf/", + exchange -> { + byte[] body = "%PDF-1.7 report".getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().add("Content-Type", "application/pdf"); + exchange.sendResponseHeaders(200, body.length); + try (OutputStream out = exchange.getResponseBody()) { + out.write(body); + } + }); + server.start(); + } + + @AfterEach + void stop() { + server.stop(0); + } + + private ApiClient client() { + return new ApiClient( + ClientOptions.builder() + .apiKey("local-key") + .environment(n -> null) + .baseUrl("http://127.0.0.1:" + server.getAddress().getPort()) + .timeout(Duration.ofSeconds(5)) + .build()); + } + + @Test + void sendsAndReceives() { + RawResponse r = + client() + .execute( + ApiRequest.builder("POST", "/v3/echo/") + .params(Pet.builder().name("Rex").build()) + .body(ApiRequest.BodyEncoding.JSON) + .build(), + RequestOptions.none(), + Responses.jsonNode()); + assertEquals(200, r.statusCode()); + assertEquals("req-local", r.requestId().orElseThrow()); + assertEquals("local-key", lastKey.get()); + assertEquals("{\"name\":\"Rex\"}", lastBody.get()); + } + + @Test + void streamsBinaryBodies() { + BinaryResponse pdf = + client() + .execute( + ApiRequest.builder("GET", "/v3/pdf/").accept("application/pdf").build(), + RequestOptions.none(), + Responses.binary()) + .data(); + assertEquals("%PDF-1.7 report", new String(pdf.bytes(), StandardCharsets.UTF_8)); + } + + @Test + void neverFollowsRedirects() { + ApiStatusException e = + assertThrows( + ApiStatusException.class, + () -> + client() + .execute( + ApiRequest.builder("GET", "/v3/redirect/").build(), + RequestOptions.none(), + Responses.jsonNode())); + assertEquals(302, e.statusCode()); + } + + @Test + void connectionRefused() throws Exception { + int port = server.getAddress().getPort(); + server.stop(0); + ApiClient client = + new ApiClient( + ClientOptions.builder() + .apiKey("k") + .environment(n -> null) + .baseUrl("http://127.0.0.1:" + port) + .maxRetries(0) + .build()); + assertThrows( + ApiConnectionException.class, + () -> + client.execute( + ApiRequest.builder("GET", "/v3/echo/").build(), + RequestOptions.none(), + Responses.jsonNode())); + start(); + } + + @Test + void acceptsACustomHttpClient() { + HttpClient http = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build(); + Didit didit = + Didit.builder() + .apiKey("k") + .environment(n -> null) + .baseUrl("http://127.0.0.1:" + server.getAddress().getPort()) + .httpClient(http) + .build(); + assertTrue(didit.options().transport() instanceof JdkHttpTransport); + } +} diff --git a/src/test/java/me/didit/core/ModelTest.java b/src/test/java/me/didit/core/ModelTest.java new file mode 100644 index 0000000..33ff1ce --- /dev/null +++ b/src/test/java/me/didit/core/ModelTest.java @@ -0,0 +1,339 @@ +package me.didit.core; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.ByteArrayInputStream; +import java.io.UncheckedIOException; +import java.math.BigInteger; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import me.didit.errors.UnexpectedResponseException; +import me.didit.testing.TestJson; +import org.junit.jupiter.api.Test; + +final class ModelTest { + @Test + void buildersMakeImmutableValues() { + Pet.Builder builder = Pet.builder().name("Rex").age(3).nickname(null).kind(Pet.Kind.DOG); + Pet pet = builder.build(); + builder.name("Changed"); + assertEquals("Rex", pet.name()); + assertTrue(pet.nickname().isEmpty()); + assertTrue(pet._json().has("nickname"), "explicit null is kept"); + assertTrue(pet._json().get("nickname").isNull()); + assertEquals(Pet.Kind.DOG, pet.kind().orElseThrow()); + Pet copy = pet.toBuilder().age(4).build(); + assertEquals(3L, pet.age().orElseThrow()); + assertEquals(4L, copy.age().orElseThrow()); + assertNotEquals(pet, copy); + assertEquals(pet, pet.toBuilder().build()); + assertEquals(pet.hashCode(), pet.toBuilder().build().hashCode()); + assertFalse(pet.equals(null)); + assertFalse(pet.equals("Rex")); + // _json returns a copy. + pet._json().put("name", "Mutated"); + assertEquals("Rex", pet.name()); + } + + @Test + void requiredFields() { + IllegalStateException e = + assertThrows(IllegalStateException.class, () -> Pet.builder().build()); + assertTrue(e.getMessage().contains("name")); + assertThrows(IllegalStateException.class, () -> Pet.builder().name("Rex").buildWithPhoto()); + assertThrows(NullPointerException.class, () -> Pet.builder().name(null)); + UnexpectedResponseException missing = + assertThrows( + UnexpectedResponseException.class, () -> Pet.fromJson(TestJson.parse("{}")).name()); + assertTrue(missing.getMessage().contains("'name' is missing")); + UnexpectedResponseException nul = + assertThrows( + UnexpectedResponseException.class, + () -> Pet.fromJson(TestJson.parse("{\"name\":null}")).name()); + assertTrue(nul.getMessage().contains("is null")); + UnexpectedResponseException wrong = + assertThrows( + UnexpectedResponseException.class, + () -> Pet.fromJson(TestJson.parse("{\"age\":\"old\"}")).age()); + assertTrue(wrong.getMessage().contains("Field 'age'")); + assertThrows(UnexpectedResponseException.class, () -> Pet.fromJson(TestJson.parse("[]"))); + } + + @Test + void unknownFieldsArePreserved() { + Pet pet = Pet.fromJson(TestJson.parse("{\"name\":\"Rex\",\"color\":\"brown\",\"extra\":1}")); + assertEquals(Map.of("color", TestJson.parse("\"brown\"")), pet._additionalProperties()); + Pet withMore = pet.toBuilder().putAdditionalProperty("weight", 12.5).remove("color").build(); + assertEquals(12.5, withMore._json().get("weight").asDouble()); + assertFalse(withMore._json().has("color")); + } + + @Test + void toStringRedactsSecrets() { + Pet pet = + Pet.builder() + .name("Rex") + .apiToken("secret-value") + .extra(Map.of("password", "p", "list", List.of(Map.of("session_token", "t")))) + .build(); + String text = pet.toString(); + assertTrue(text.startsWith("Pet{"), text); + assertFalse(text.contains("secret-value")); + assertFalse(text.contains("\"p\"")); + assertFalse(text.contains("\"t\"")); + assertTrue(text.contains("[REDACTED]")); + Pet withFile = Pet.builder().name("Rex").photo(FileUpload.of(new byte[] {1}, "a.png")).build(); + assertTrue(withFile.toString().contains("files=[photo]")); + } + + @Test + void files() throws Exception { + Path tmp = Files.createTempFile("didit", ".png"); + try { + Files.write(tmp, new byte[] {9, 8}); + Pet pet = + Pet.builder() + .name("Rex") + .photo(tmp) + .photos(List.of(FileUpload.of(new byte[] {1}, "b.webp"))) + .build(); + FileUpload photo = pet.photo().orElseThrow(); + assertEquals(tmp.getFileName().toString(), photo.fileName()); + assertEquals("image/png", photo.contentType()); + assertEquals(2, photo.read().length); + assertEquals("image/webp", pet.photos().orElseThrow().get(0).contentType()); + assertEquals(pet, pet.toBuilder().build()); + } finally { + Files.delete(tmp); + } + FileUpload stream = + FileUpload.of(new ByteArrayInputStream(new byte[] {1, 2, 3}), "doc.pdf", null); + assertEquals(3, stream.read().length); + assertEquals(3, stream.read().length, "a stream is read once and reused for retries"); + assertEquals("application/pdf", stream.contentType()); + assertEquals("text/plain", stream.withContentType("text/plain").contentType()); + assertEquals("x.csv", stream.withFileName("x.csv").fileName()); + assertEquals("text/csv", FileUpload.of(new byte[0], "a.csv").contentType()); + assertEquals("image/jpeg", FileUpload.of(new byte[0], "a.JPEG").contentType()); + assertEquals("image/heic", FileUpload.of(new byte[0], "a.heic").contentType()); + assertEquals("application/octet-stream", FileUpload.of(new byte[0], "blob").contentType()); + assertEquals("image/gif", FileUpload.of(new byte[0], "a.gif").contentType()); + assertTrue(FileUpload.of(new byte[0], "a.bin", "x/y").toString().contains("x/y")); + assertThrows( + UncheckedIOException.class, () -> FileUpload.of(Path.of("does-not-exist.jpg")).read()); + assertEquals("file", FileUpload.of(Path.of("/")).fileName()); + Pet empty = Pet.builder().name("a").build(); + assertTrue(empty.photo().isEmpty()); + assertTrue(empty.photos().isEmpty()); + } + + @Test + void openEnums() { + assertSame(Pet.Kind.CAT, Pet.Kind.of("cat")); + Pet.Kind fish = Pet.Kind.of("fish"); + assertFalse(fish.isKnown()); + assertTrue(Pet.Kind.CAT.isKnown()); + assertEquals("fish", fish.value()); + assertEquals("fish", fish.toString()); + assertEquals(fish, Pet.Kind.of("fish")); + assertEquals(fish.hashCode(), Pet.Kind.of("fish").hashCode()); + assertNotEquals(fish, Pet.Kind.CAT); + assertFalse(fish.equals(null)); + assertEquals(fish, Pet.fromJson(TestJson.parse("{\"kind\":\"fish\"}")).kind().orElseThrow()); + } + + @Test + void unions() { + Pet.PetOrName a = + Pet.PetOrName.fromJson(TestJson.parse("{\"name\":\"Rex\",\"session_token\":\"s\"}")); + assertTrue(a.isPet()); + assertEquals( + a, Pet.PetOrName.fromJson(TestJson.parse("{\"name\":\"Rex\",\"session_token\":\"s\"}"))); + assertEquals(a.hashCode(), Pet.PetOrName.fromJson(a._json()).hashCode()); + assertFalse(a.equals(null)); + assertFalse(a.toString().contains("\"s\"")); + Pet.PetOrName b = Pet.PetOrName.fromJson(TestJson.parse("\"Rex\"")); + assertFalse(b.isPet()); + assertNotEquals(a, b); + } + + @Test + void converters() { + assertEquals("1", Conv.STRING.read(TestJson.parse("1"))); + assertEquals("true", Conv.STRING.read(TestJson.parse("true"))); + assertThrows(UnexpectedResponseException.class, () -> Conv.STRING.read(TestJson.parse("{}"))); + assertEquals(5L, Conv.LONG.read(TestJson.parse("\"5\""))); + assertEquals(5L, Conv.LONG.read(TestJson.parse("5.0"))); + assertThrows(UnexpectedResponseException.class, () -> Conv.LONG.read(TestJson.parse("5.5"))); + assertThrows( + UnexpectedResponseException.class, + () -> Conv.LONG.read(TestJson.parse("99999999999999999999"))); + assertThrows(UnexpectedResponseException.class, () -> Conv.LONG.read(TestJson.parse("\"x\""))); + assertThrows(UnexpectedResponseException.class, () -> Conv.LONG.read(TestJson.parse("[]"))); + assertEquals(1.25, Conv.DOUBLE.read(TestJson.parse("\"1.25\""))); + assertThrows(IllegalArgumentException.class, () -> Conv.DOUBLE.write(Double.NaN)); + assertThrows(IllegalArgumentException.class, () -> Conv.DOUBLE.write(Double.POSITIVE_INFINITY)); + assertEquals(2.5, Conv.DOUBLE.write(2.5).asDouble()); + assertTrue(Conv.BOOLEAN.read(TestJson.parse("\"true\""))); + assertThrows( + UnexpectedResponseException.class, () -> Conv.BOOLEAN.read(TestJson.parse("\"yes\""))); + assertEquals( + OffsetDateTime.of(2026, 11, 1, 10, 0, 0, 0, ZoneOffset.UTC), + Conv.DATE_TIME.read(TestJson.parse("\"2026-11-01T10:00:00Z\""))); + assertEquals( + OffsetDateTime.of(2026, 11, 1, 10, 0, 0, 0, ZoneOffset.ofHours(2)), + Conv.DATE_TIME.read(TestJson.parse("\"2026-11-01T10:00:00+02:00\""))); + assertEquals( + OffsetDateTime.of(2026, 11, 1, 10, 0, 0, 0, ZoneOffset.UTC), + Conv.DATE_TIME.read(TestJson.parse("\"2026-11-01T10:00:00\""))); + assertEquals( + OffsetDateTime.of(2026, 11, 1, 10, 0, 0, 0, ZoneOffset.UTC), + Conv.DATE_TIME.read(TestJson.parse("\"2026-11-01 10:00:00\""))); + assertEquals( + OffsetDateTime.of(2026, 11, 1, 0, 0, 0, 0, ZoneOffset.UTC), + Conv.DATE_TIME.read(TestJson.parse("\"2026-11-01\""))); + assertEquals( + OffsetDateTime.of(1970, 1, 1, 0, 0, 10, 0, ZoneOffset.UTC), + Conv.DATE_TIME.read(TestJson.parse("10"))); + assertThrows( + UnexpectedResponseException.class, + () -> Conv.DATE_TIME.read(TestJson.parse("\"tomorrow\""))); + assertThrows( + UnexpectedResponseException.class, () -> Conv.DATE_TIME.read(TestJson.parse("true"))); + assertEquals( + "2026-11-01T10:15:30Z", + Conv.DATE_TIME + .write(OffsetDateTime.of(2026, 11, 1, 10, 15, 30, 0, ZoneOffset.UTC)) + .asText()); + assertEquals( + "2026-11-01T10:00:00Z", + Conv.DATE_TIME.write(OffsetDateTime.of(2026, 11, 1, 10, 0, 0, 0, ZoneOffset.UTC)).asText()); + assertEquals( + LocalDate.of(2026, 11, 1), Conv.DATE.read(TestJson.parse("\"2026-11-01T23:00:00Z\""))); + assertThrows( + UnexpectedResponseException.class, () -> Conv.DATE.read(TestJson.parse("\"11/01/2026\""))); + assertThrows(UnexpectedResponseException.class, () -> Conv.DATE.read(TestJson.parse("1"))); + assertEquals("2026-11-01", Conv.DATE.write(LocalDate.of(2026, 11, 1)).asText()); + assertEquals(TestJson.parse("{\"a\":[1]}"), Conv.ANY.write(TestJson.parse("{\"a\":[1]}"))); + Map object = Conv.OBJECT.read(TestJson.parse("{\"a\":1,\"b\":\"x\"}")); + assertEquals(1, object.get("a").asInt()); + assertThrows(UnexpectedResponseException.class, () -> Conv.OBJECT.read(TestJson.parse("[]"))); + assertEquals(2, Conv.OBJECT.write(object).size()); + UnexpectedResponseException item = + assertThrows( + UnexpectedResponseException.class, + () -> Conv.list(Conv.LONG).read(TestJson.parse("[1,\"x\"]"))); + assertTrue(item.getMessage().contains("item 1")); + assertThrows( + UnexpectedResponseException.class, + () -> Conv.list(Conv.LONG).read(TestJson.parse("[1,null]"))); + assertThrows( + UnexpectedResponseException.class, () -> Conv.list(Conv.LONG).read(TestJson.parse("{}"))); + assertEquals(Map.of("a", 1L), Conv.map(Conv.LONG).read(TestJson.parse("{\"a\":1,\"b\":null}"))); + assertThrows( + UnexpectedResponseException.class, + () -> Conv.map(Conv.LONG).read(TestJson.parse("{\"a\":\"x\"}"))); + assertThrows( + UnexpectedResponseException.class, () -> Conv.map(Conv.LONG).read(TestJson.parse("[]"))); + assertEquals("{\"a\":1}", Conv.map(Conv.LONG).write(Map.of("a", 1L)).toString()); + assertThrows( + UnexpectedResponseException.class, + () -> Conv.model(Pet::fromJson).read(TestJson.parse("1"))); + assertEquals( + "Rex", + Conv.model(Pet::fromJson).write(Pet.builder().name("Rex").build()).get("name").asText()); + assertEquals( + "\"x\"", + Conv.union(Pet.PetOrName::fromJson) + .write(Pet.PetOrName.fromJson(TestJson.parse("\"x\""))) + .toString()); + assertThrows( + UnexpectedResponseException.class, + () -> Conv.enumeration(Pet.Kind::of).read(TestJson.parse("1"))); + assertEquals("\"cat\"", Conv.enumeration(Pet.Kind::of).write(Pet.Kind.CAT).toString()); + } + + @Test + void jsonHelpers() { + Map map = new LinkedHashMap<>(); + map.put("model", Pet.builder().name("Rex").build()); + map.put("union", Pet.PetOrName.fromJson(TestJson.parse("\"x\""))); + map.put("enum", Pet.Kind.DOG); + map.put("when", OffsetDateTime.of(2026, 1, 2, 3, 4, 0, 0, ZoneOffset.UTC)); + map.put("day", LocalDate.of(2026, 1, 2)); + map.put("time", java.time.LocalTime.of(3, 4)); + map.put("optional", Optional.of(1)); + map.put("empty", Optional.empty()); + map.put("list", List.of(1, "a")); + map.put("big", new BigInteger("123456789012345678901234567890")); + map.put("null", null); + map.put("status", Pet.Outcome.fromResponse(200, TestJson.parse("{\"ok\":true}"))); + JsonNode node = Json.toNode(map); + assertEquals( + "{\"model\":{\"name\":\"Rex\"},\"union\":\"x\",\"enum\":\"dog\",\"when\":\"2026-01-02T03:04:00Z\"," + + "\"day\":\"2026-01-02\",\"time\":\"03:04\",\"optional\":1,\"empty\":null,\"list\":[1,\"a\"]," + + "\"big\":123456789012345678901234567890,\"null\":null,\"status\":{\"ok\":true}}", + Json.write(node)); + assertThrows(UnexpectedResponseException.class, () -> Json.parse("{")); + assertThrows(UnexpectedResponseException.class, () -> Json.parse(new byte[] {'['})); + assertEquals( + "12345678901234567890.10", + Json.parse("12345678901234567890.10").decimalValue().toPlainString()); + assertTrue(Json.hasValue(TestJson.parse("{\"t\":\"a\"}"), "t", "a")); + assertFalse(Json.hasValue(TestJson.parse("[1]"), "t", "a")); + assertTrue(Json.hasFields(TestJson.parse("{\"a\":1,\"b\":2}"), "a", "b")); + assertFalse(Json.hasFields(TestJson.parse("{\"a\":1}"), "a", "b")); + assertFalse(Json.hasFields(TestJson.parse("1"), "a")); + assertTrue(Json.hasAnyField(TestJson.parse("{\"a\":1}"), "x", "a")); + assertFalse(Json.hasAnyField(TestJson.parse("{\"a\":1}"), "x")); + assertFalse(Json.hasAnyField(TestJson.parse("1"), "x")); + assertEquals(2, Json.nodes().arrayNode().add(1).add(2).size()); + } + + @Test + void headers() { + Map> raw = new LinkedHashMap<>(); + raw.put(null, List.of("HTTP/1.1 200")); + raw.put("x-request-id", List.of("")); + raw.put("Request-Id", List.of("r-2")); + raw.put("x-api-key", List.of("k")); + raw.put("Set-Cookie", List.of("c")); + raw.put("X-Signature", List.of("s")); + raw.put("Content-Type", List.of("application/json")); + Headers h = Headers.of(raw); + assertEquals("r-2", h.requestId().orElseThrow()); + assertEquals("application/json", h.firstValue("content-type").orElseThrow()); + assertEquals(List.of(), h.allValues("missing")); + assertTrue(h.firstValue("missing").isEmpty()); + String text = h.toString(); + assertFalse(text.contains("=k")); + assertFalse(text.contains("=c")); + assertFalse(text.contains("=s,") || text.endsWith("=s}")); + assertTrue(text.contains("application/json")); + assertEquals(h, Headers.of(raw)); + assertEquals(h.hashCode(), Headers.of(raw).hashCode()); + assertFalse(h.equals("x")); + assertTrue(Headers.empty().requestId().isEmpty()); + assertEquals(7, h.map().size() + 1); + assertTrue(MockTransportHeaders.amzn().requestId().isPresent()); + } + + static final class MockTransportHeaders { + static Headers amzn() { + return Headers.of(Map.of("X-Amzn-Requestid", List.of("aws-1"))); + } + } +} diff --git a/src/test/java/me/didit/core/PageTest.java b/src/test/java/me/didit/core/PageTest.java new file mode 100644 index 0000000..b5a8595 --- /dev/null +++ b/src/test/java/me/didit/core/PageTest.java @@ -0,0 +1,128 @@ +package me.didit.core; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.concurrent.ExecutionException; +import java.util.stream.Collectors; +import me.didit.errors.UnexpectedResponseException; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import org.junit.jupiter.api.Test; + +final class PageTest { + private final MockTransport transport = new MockTransport(); + + private Page first(String body) { + transport.respond(200, body); + ApiClient client = + new ApiClient( + ClientOptions.builder() + .apiKey("k") + .environment(n -> null) + .transport(transport) + .build()); + return client + .execute( + ApiRequest.builder("GET", "/v3/pets/") + .params(Pet.builder().name("ignored").build()) + .queryFields("name") + .build(), + RequestOptions.none(), + Responses.page(Conv.model(Pet::fromJson))) + .data(); + } + + private static String page(String next, String... names) { + String results = + java.util.Arrays.stream(names) + .map(n -> "{\"name\":\"" + n + "\"}") + .collect(Collectors.joining(",")); + return "{\"count\":3,\"next\":" + + next + + ",\"previous\":null,\"results\":[" + + results + + "],\"total\":9}"; + } + + @Test + void iteratesEveryPage() { + Page page = + first(page("\"https://verification.didit.me/v3/pets/?limit=2&offset=2\"", "a", "b")); + transport.respond(200, page("null", "c")); + assertEquals(2, page.results().size()); + assertEquals(3L, page.count().orElseThrow()); + assertTrue(page.previous().isEmpty()); + assertTrue(page.hasNextPage()); + assertEquals(9, page._json().get("total").asInt()); + List names = new ArrayList<>(); + for (Pet pet : page) { + names.add(pet.name()); + } + assertEquals(List.of("a", "b", "c"), names); + RecordedRequest second = transport.requests().get(1); + assertEquals("/v3/pets/", second.path()); + assertEquals("2", second.query().get("offset").get(0)); + assertEquals("k", second.header("x-api-key")); + assertTrue(page.toString().contains("results=2")); + } + + @Test + void streamsAndAsync() throws Exception { + Page page = first(page("\"/v3/pets/?offset=2\"", "a", "b")); + transport.respond(200, page("null", "c")); + assertEquals( + List.of("a", "b", "c"), + page.autoPager().stream().map(Pet::name).collect(Collectors.toList())); + transport.respond(200, page("null", "c")); + List names = new ArrayList<>(); + page.forEachAsync(p -> names.add(p.name())).get(); + assertEquals(List.of("a", "b", "c"), names); + } + + @Test + void lastPage() { + Page page = first(page("null", "a")); + assertFalse(page.hasNextPage()); + assertThrows(NoSuchElementException.class, page::nextPage); + assertFalse(first(page("\"\"", "a")).hasNextPage()); + java.util.Iterator it = page.iterator(); + it.next(); + assertFalse(it.hasNext()); + assertThrows(NoSuchElementException.class, it::next); + assertTrue(first("{\"results\":null}").results().isEmpty()); + } + + @Test + void refusesLinksToOtherOriginsAndLoops() { + Page evil = first(page("\"https://evil.example.com/v3/pets/?offset=2\"", "a")); + UnexpectedResponseException e = assertThrows(UnexpectedResponseException.class, evil::nextPage); + assertTrue(e.getMessage().contains("evil.example.com")); + assertEquals(1, transport.requests().size(), "nothing is sent to another origin"); + + Page loop = first(page("\"https://verification.didit.me/v3/pets/?name=ignored\"", "a")); + assertThrows(UnexpectedResponseException.class, loop::nextPage); + + Page twoStep = first(page("\"/v3/pets/?offset=2\"", "a")); + transport.respond(200, page("\"/v3/pets/?offset=2\"", "b")); + Page second = twoStep.nextPage(); + assertThrows(UnexpectedResponseException.class, second::nextPage); + + Page badUrl = first(page("\"http://[bad\"", "a")); + assertThrows(UnexpectedResponseException.class, badUrl::nextPage); + } + + @Test + void pagesThatAreNotObjects() throws Exception { + assertThrows(UnexpectedResponseException.class, () -> first("[1]")); + Page page = first(page("\"/v3/pets/?offset=1\"", "a")); + transport.respond(200, "[]"); + ExecutionException e = assertThrows(ExecutionException.class, () -> page.nextPageAsync().get()); + assertTrue(e.getCause() instanceof UnexpectedResponseException); + } +} diff --git a/src/test/java/me/didit/core/Pet.java b/src/test/java/me/didit/core/Pet.java new file mode 100644 index 0000000..3f3bbe7 --- /dev/null +++ b/src/test/java/me/didit/core/Pet.java @@ -0,0 +1,182 @@ +package me.didit.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.file.Path; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import org.jspecify.annotations.Nullable; + +/** A hand-written model shaped like the generated ones, for core tests. */ +final class Pet extends JsonModel { + private static final Set KNOWN_FIELDS = + Set.of("name", "nickname", "age", "born_at", "tags", "kind", "photo", "api_token", "extra"); + + private Pet(ObjectNode json, Map> files) { + super(json, files); + } + + static Pet fromJson(JsonNode json) { + return new Pet(Json.copyObject(json), Map.of()); + } + + static Builder builder() { + return new Builder(); + } + + Builder toBuilder() { + return new Builder(this); + } + + String name() { + return Json.required(json, "name", Conv.STRING); + } + + Optional nickname() { + return Json.optional(json, "nickname", Conv.STRING); + } + + Optional age() { + return Json.optional(json, "age", Conv.LONG); + } + + Optional bornAt() { + return Json.optional(json, "born_at", Conv.DATE_TIME); + } + + Optional> tags() { + return Json.optional(json, "tags", Conv.list(Conv.STRING)); + } + + Optional kind() { + return Json.optional(json, "kind", Conv.enumeration(Kind::of)); + } + + Optional photo() { + return file("photo"); + } + + Optional> photos() { + return fileList("photos"); + } + + @Override + protected Set knownFields() { + return KNOWN_FIELDS; + } + + static final class Builder extends JsonModel.BaseBuilder { + private Builder() {} + + private Builder(Pet from) { + super(from); + } + + Builder name(String name) { + return set("name", Conv.STRING, name); + } + + Builder nickname(@Nullable String nickname) { + return setNullable("nickname", Conv.STRING, nickname); + } + + Builder age(long age) { + return set("age", Conv.LONG, age); + } + + Builder bornAt(OffsetDateTime bornAt) { + return set("born_at", Conv.DATE_TIME, bornAt); + } + + Builder tags(List tags) { + return set("tags", Conv.list(Conv.STRING), tags); + } + + Builder kind(Kind kind) { + return set("kind", Conv.enumeration(Kind::of), kind); + } + + Builder extra(@Nullable Object extra) { + return setAny("extra", extra); + } + + Builder apiToken(String token) { + return set("api_token", Conv.STRING, token); + } + + Builder photo(FileUpload photo) { + return setFile("photo", photo); + } + + Builder photo(Path photo) { + return setFile("photo", FileUpload.of(photo)); + } + + Builder photos(List photos) { + return setFiles("photos", photos); + } + + Pet build() { + require("name", false); + return new Pet(buildJson(), buildFiles()); + } + + Pet buildWithPhoto() { + requireFile("photo"); + return build(); + } + + @Override + protected Builder self() { + return this; + } + } + + static final class Kind extends StringEnum { + static final Kind CAT = new Kind("cat"); + static final Kind DOG = new Kind("dog"); + private static final List KNOWN_VALUES = List.of(CAT, DOG); + + private Kind(String value) { + super(value); + } + + static Kind of(String value) { + return StringEnum.lookup(KNOWN_VALUES, value, Kind::new); + } + + @Override + public boolean isKnown() { + return KNOWN_VALUES.contains(this); + } + } + + /** A union: a pet or a plain name. */ + static final class PetOrName extends JsonUnion { + private PetOrName(JsonNode json) { + super(json); + } + + static PetOrName fromJson(JsonNode json) { + return new PetOrName(json.deepCopy()); + } + + boolean isPet() { + return json.isObject(); + } + } + + /** A status union. */ + static final class Outcome extends MultiStatusResponse { + private Outcome(int status, JsonNode json) { + super(status, json); + } + + static Outcome fromResponse(int status, JsonNode json) { + return new Outcome(status, json.deepCopy()); + } + } +} diff --git a/src/test/java/me/didit/live/LiveSmokeTest.java b/src/test/java/me/didit/live/LiveSmokeTest.java new file mode 100644 index 0000000..18ed2f9 --- /dev/null +++ b/src/test/java/me/didit/live/LiveSmokeTest.java @@ -0,0 +1,68 @@ +package me.didit.live; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +import me.didit.Didit; +import me.didit.core.Page; +import me.didit.errors.NotFoundException; +import me.didit.types.SessionsCreateParams; +import me.didit.types.SessionsCreateResponse; +import me.didit.types.WorkflowListItem; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; + +/** + * Smoke tests against a sandbox application (DESIGN 11). They run only with {@code ./gradlew + * liveTest} and {@code DIDIT_SANDBOX_API_KEY}; they create nothing beyond sandbox sessions. + */ +@Tag("live") +final class LiveSmokeTest { + private Didit client; + + @BeforeEach + void setUp() { + String key = System.getenv("DIDIT_SANDBOX_API_KEY"); + assumeTrue(key != null && !key.isEmpty(), "DIDIT_SANDBOX_API_KEY is not set"); + Didit.Builder builder = Didit.builder().apiKey(key); + String baseUrl = System.getenv("DIDIT_SANDBOX_BASE_URL"); + if (baseUrl != null && !baseUrl.isEmpty()) { + builder.baseUrl(baseUrl); + } + client = builder.build(); + } + + @Test + void listsWorkflows() { + Page page = client.workflows().list(); + assertFalse(page.results().size() < 0); + } + + @Test + void createsASandboxSessionAndReadsIt() { + String workflowId = System.getenv("DIDIT_SANDBOX_WORKFLOW_ID"); + assumeTrue(workflowId != null && !workflowId.isEmpty(), "DIDIT_SANDBOX_WORKFLOW_ID is not set"); + SessionsCreateResponse session = + client + .sessions() + .create( + SessionsCreateParams.builder() + .workflowId(workflowId) + .vendorData("didit-java-smoke-test") + .build()); + assertEquals(workflowId, session.workflowId()); + assertEquals( + session.sessionId(), + client.sessions().retrieveDecision(session.sessionId()).sessionId().orElseThrow()); + } + + @Test + void unknownSessionIsNotFound() { + Executable call = + () -> client.sessions().retrieveDecision("00000000-0000-4000-8000-000000000000"); + org.junit.jupiter.api.Assertions.assertThrows(NotFoundException.class, call); + } +} diff --git a/src/test/java/me/didit/resources/AccountApplicationsResourceTest.java b/src/test/java/me/didit/resources/AccountApplicationsResourceTest.java new file mode 100644 index 0000000..896fd73 --- /dev/null +++ b/src/test/java/me/didit/resources/AccountApplicationsResourceTest.java @@ -0,0 +1,95 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.ApplicationCreateRequest; +import me.didit.types.ApplicationUpdateRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code account.applications}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class AccountApplicationsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + JsonNode example = TestJson.parse("{\"ok\":true}"); + transport.respondJson(200, example); + var result = client.account().applications().list("00000000-0000-4000-8000-00000000c91f"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/organizations/me/00000000-0000-4000-8000-00000000c91f/applications/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("Bearer test-account-token", request.header("Authorization")); + assertEquals(null, request.header("x-api-key")); + assertEquals("https://apx.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result); + } + + @Test + void create() { + ApplicationCreateRequest params = ApplicationCreateRequest.builder().name("value-name").websiteUrl("value-website-url").redirectUris(List.of("value-redirect-uris")).termsUrl("value-terms-url").privacyUrl("value-privacy-url").description("value-description").build(); + JsonNode example = SpecExamples.response("account.json", "POST", "/organizations/me/{org_id}/applications/", "201"); + transport.respondJson(201, example); + var result = client.account().applications().create("00000000-0000-4000-8000-00000000e154", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/organizations/me/00000000-0000-4000-8000-00000000e154/applications/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("Bearer test-account-token", request.header("Authorization")); + assertEquals(null, request.header("x-api-key")); + assertEquals("https://apx.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"website_url\":\"value-website-url\",\"redirect_uris\":[\"value-redirect-uris\"],\"terms_url\":\"value-terms-url\",\"privacy_url\":\"value-privacy-url\",\"description\":\"value-description\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("account.json", "GET", "/organizations/me/{org_id}/applications/{app_id}/", "200"); + transport.respondJson(200, example); + var result = client.account().applications().retrieve("00000000-0000-4000-8000-0000000100a7", "00000000-0000-4000-8000-00000000ffe5"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/organizations/me/00000000-0000-4000-8000-0000000100a7/applications/00000000-0000-4000-8000-00000000ffe5/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("Bearer test-account-token", request.header("Authorization")); + assertEquals(null, request.header("x-api-key")); + assertEquals("https://apx.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + ApplicationUpdateRequest params = ApplicationUpdateRequest.builder().name("value-name").websiteUrl("value-website-url").redirectUris(List.of("value-redirect-uris")).termsUrl("value-terms-url").privacyUrl("value-privacy-url").description("value-description").build(); + JsonNode example = SpecExamples.response("account.json", "PATCH", "/organizations/me/{org_id}/applications/{app_id}/", "200"); + transport.respondJson(200, example); + var result = client.account().applications().update("00000000-0000-4000-8000-00000000e29a", "00000000-0000-4000-8000-00000000e1e6", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/organizations/me/00000000-0000-4000-8000-00000000e29a/applications/00000000-0000-4000-8000-00000000e1e6/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("Bearer test-account-token", request.header("Authorization")); + assertEquals(null, request.header("x-api-key")); + assertEquals("https://apx.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"website_url\":\"value-website-url\",\"redirect_uris\":[\"value-redirect-uris\"],\"terms_url\":\"value-terms-url\",\"privacy_url\":\"value-privacy-url\",\"description\":\"value-description\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/AccountOrganizationsResourceTest.java b/src/test/java/me/didit/resources/AccountOrganizationsResourceTest.java new file mode 100644 index 0000000..ae66d63 --- /dev/null +++ b/src/test/java/me/didit/resources/AccountOrganizationsResourceTest.java @@ -0,0 +1,41 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code account.organizations}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class AccountOrganizationsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + JsonNode example = SpecExamples.response("account.json", "GET", "/organizations/me/", "200"); + transport.respondJson(200, example); + var result = client.account().organizations().list(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/organizations/me/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("Bearer test-account-token", request.header("Authorization")); + assertEquals(null, request.header("x-api-key")); + assertEquals("https://apx.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/AccountResourceTest.java b/src/test/java/me/didit/resources/AccountResourceTest.java new file mode 100644 index 0000000..445a6b5 --- /dev/null +++ b/src/test/java/me/didit/resources/AccountResourceTest.java @@ -0,0 +1,95 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.AccountResendOtpParams; +import me.didit.types.LoginRequest; +import me.didit.types.RegisterRequest; +import me.didit.types.VerifyEmailRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code account}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class AccountResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void register() { + RegisterRequest params = RegisterRequest.builder().email("user@example.com").password("value-password").build(); + JsonNode example = SpecExamples.response("account.json", "POST", "/programmatic/register/", "201"); + transport.respondJson(201, example); + var result = client.account().register(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/programmatic/register/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals(null, request.header("x-api-key")); + assertEquals(null, request.header("Authorization")); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"password\":\"value-password\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void verifyEmail() { + VerifyEmailRequest params = VerifyEmailRequest.builder().email("user@example.com").code("value-code").build(); + JsonNode example = SpecExamples.response("account.json", "POST", "/programmatic/verify-email/", "200"); + transport.respondJson(200, example); + var result = client.account().verifyEmail(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/programmatic/verify-email/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals(null, request.header("x-api-key")); + assertEquals(null, request.header("Authorization")); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"code\":\"value-code\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void login() { + LoginRequest params = LoginRequest.builder().email("user@example.com").password("value-password").build(); + JsonNode example = SpecExamples.response("account.json", "POST", "/programmatic/login/", "200"); + transport.respondJson(200, example); + var result = client.account().login(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/programmatic/login/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals(null, request.header("x-api-key")); + assertEquals(null, request.header("Authorization")); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"password\":\"value-password\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void resendOtp() { + AccountResendOtpParams params = AccountResendOtpParams.builder().email("user@example.com").password("value-password").build(); + JsonNode example = SpecExamples.response("account.json", "POST", "/programmatic/resend-otp/", "200"); + transport.respondJson(200, example); + var result = client.account().resendOtp(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/programmatic/resend-otp/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals(null, request.header("x-api-key")); + assertEquals(null, request.header("Authorization")); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"password\":\"value-password\"}", request.body()); + TestJson.assertJsonEquals(example, result); + } +} diff --git a/src/test/java/me/didit/resources/AgeEstimationResourceTest.java b/src/test/java/me/didit/resources/AgeEstimationResourceTest.java new file mode 100644 index 0000000..da63e7c --- /dev/null +++ b/src/test/java/me/didit/resources/AgeEstimationResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.AgeEstimationEstimateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code age_estimation}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class AgeEstimationResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void estimate() { + AgeEstimationEstimateParams params = AgeEstimationEstimateParams.builder().userImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "user_image.pdf", "application/pdf")).faceLivenessScoreDeclineThreshold(1.5).ageEstimationDeclineThreshold(1L).rotateImage(true).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/age-estimation/", "200"); + transport.respondJson(200, example); + var result = client.ageEstimation().estimate(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/age-estimation/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("face_liveness_score_decline_threshold", List.of("1.5")), Map.entry("age_estimation_decline_threshold", List.of("1")), Map.entry("rotate_image", List.of("true")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("user_image", List.of("user_image.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/AmlMonitoringResourceTest.java b/src/test/java/me/didit/resources/AmlMonitoringResourceTest.java new file mode 100644 index 0000000..e66b370 --- /dev/null +++ b/src/test/java/me/didit/resources/AmlMonitoringResourceTest.java @@ -0,0 +1,40 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code aml_monitoring}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class AmlMonitoringResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void retrieveJob() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.amlMonitoring().retrieveJob("00000000-0000-4000-8000-00000000e357"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/aml-monitoring/jobs/00000000-0000-4000-8000-00000000e357/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/AmlResourceTest.java b/src/test/java/me/didit/resources/AmlResourceTest.java new file mode 100644 index 0000000..d415675 --- /dev/null +++ b/src/test/java/me/didit/resources/AmlResourceTest.java @@ -0,0 +1,46 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.core.RequestOptions; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.AmlScreenParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code aml}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class AmlResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void screen() { + AmlScreenParams params = AmlScreenParams.builder().fullName("value-full-name").entityType(AmlScreenParams.EntityType.PERSON).dateOfBirth(LocalDate.parse("2026-11-01")).nationality("value-nationality").documentNumber("value-document-number").amlScoreApproveThreshold(1.5).amlScoreReviewThreshold(1.5).amlNameWeight(1L).amlDobWeight(1L).amlCountryWeight(1L).amlMatchScoreThreshold(1L).includeAdverseMedia(true).includeOngoingMonitoring(true).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/aml/", "200"); + transport.respondJson(200, example); + var result = client.aml().screen(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/aml/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"full_name\":\"value-full-name\",\"entity_type\":\"person\",\"date_of_birth\":\"2026-11-01\",\"nationality\":\"value-nationality\",\"document_number\":\"value-document-number\",\"aml_score_approve_threshold\":1.5,\"aml_score_review_threshold\":1.5,\"aml_name_weight\":1,\"aml_dob_weight\":1,\"aml_country_weight\":1,\"aml_match_score_threshold\":1,\"include_adverse_media\":true,\"include_ongoing_monitoring\":true,\"save_api_request\":true,\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/BillingResourceTest.java b/src/test/java/me/didit/resources/BillingResourceTest.java new file mode 100644 index 0000000..c8cbbf9 --- /dev/null +++ b/src/test/java/me/didit/resources/BillingResourceTest.java @@ -0,0 +1,58 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.BillingTopUpParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code billing}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class BillingResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void retrieveBalance() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/billing/balance/", "200"); + transport.respondJson(200, example); + var result = client.billing().retrieveBalance(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/billing/balance/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void topUp() { + BillingTopUpParams params = BillingTopUpParams.builder().amountInDollars(1.5).successUrl("https://example.com/callback").cancelUrl("https://example.com/callback").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/billing/top-up/", "200"); + transport.respondJson(200, example); + var result = client.billing().topUp(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/billing/top-up/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"amount_in_dollars\":1.5,\"success_url\":\"https://example.com/callback\",\"cancel_url\":\"https://example.com/callback\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/BiometricTemplatesResourceTest.java b/src/test/java/me/didit/resources/BiometricTemplatesResourceTest.java new file mode 100644 index 0000000..65648c6 --- /dev/null +++ b/src/test/java/me/didit/resources/BiometricTemplatesResourceTest.java @@ -0,0 +1,112 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.BiometricTemplatesBatchDeleteParams; +import me.didit.types.BiometricTemplatesCountParams; +import me.didit.types.BiometricTemplatesListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code biometric_templates}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class BiometricTemplatesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + BiometricTemplatesListParams params = BiometricTemplatesListParams.builder().vendorData("value-vendor-data").vendorUserUuid("00000000-0000-4000-8000-000000003947").status(BiometricTemplatesListParams.Status.PENDING).sourceType(BiometricTemplatesListParams.SourceType.SESSION_DELETE).retainedFrom(OffsetDateTime.parse("2026-11-01T10:15:30Z")).retainedTo(OffsetDateTime.parse("2026-11-01T10:15:30Z")).ordering(BiometricTemplatesListParams.Ordering.RETAINED_AT).limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/biometric-templates/", "200"); + transport.respondJson(200, example); + var result = client.biometricTemplates().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/biometric-templates/", request.path()); + assertEquals(Map.ofEntries(Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("vendor_user_uuid", List.of("00000000-0000-4000-8000-000000003947")), Map.entry("status", List.of("pending")), Map.entry("source_type", List.of("session_delete")), Map.entry("retained_from", List.of("2026-11-01T10:15:30Z")), Map.entry("retained_to", List.of("2026-11-01T10:15:30Z")), Map.entry("ordering", List.of("retained_at")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void count() { + BiometricTemplatesCountParams params = BiometricTemplatesCountParams.builder().vendorData("value-vendor-data").vendorUserUuid("00000000-0000-4000-8000-000000003947").status(BiometricTemplatesCountParams.Status.PENDING).sourceType(BiometricTemplatesCountParams.SourceType.SESSION_DELETE).retainedFrom(OffsetDateTime.parse("2026-11-01T10:15:30Z")).retainedTo(OffsetDateTime.parse("2026-11-01T10:15:30Z")).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/biometric-templates/count/", "200"); + transport.respondJson(200, example); + var result = client.biometricTemplates().count(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/biometric-templates/count/", request.path()); + assertEquals(Map.ofEntries(Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("vendor_user_uuid", List.of("00000000-0000-4000-8000-000000003947")), Map.entry("status", List.of("pending")), Map.entry("source_type", List.of("session_delete")), Map.entry("retained_from", List.of("2026-11-01T10:15:30Z")), Map.entry("retained_to", List.of("2026-11-01T10:15:30Z"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/biometric-templates/{template_uuid}/", "200"); + transport.respondJson(200, example); + var result = client.biometricTemplates().retrieve("00000000-0000-4000-8000-0000000164b9"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/biometric-templates/00000000-0000-4000-8000-0000000164b9/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + JsonNode example = SpecExamples.response("verification.json", "DELETE", "/v3/biometric-templates/{template_uuid}/", "200"); + transport.respondJson(200, example); + var result = client.biometricTemplates().delete("00000000-0000-4000-8000-000000014054"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/biometric-templates/00000000-0000-4000-8000-000000014054/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void batchDelete() { + BiometricTemplatesBatchDeleteParams params = BiometricTemplatesBatchDeleteParams.builder().templateUuids(List.of("00000000-0000-4000-8000-000000002c35")).deleteAll(true).vendorData("value-vendor-data").vendorUserUuid("00000000-0000-4000-8000-000000003947").status(BiometricTemplatesBatchDeleteParams.Status.PENDING).sourceType(BiometricTemplatesBatchDeleteParams.SourceType.SESSION_DELETE).retainedFrom(OffsetDateTime.parse("2026-11-01T10:15:30Z")).retainedTo(OffsetDateTime.parse("2026-11-01T10:15:30Z")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/biometric-templates/delete/", "200"); + transport.respondJson(200, example); + var result = client.biometricTemplates().batchDelete(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/biometric-templates/delete/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"template_uuids\":[\"00000000-0000-4000-8000-000000002c35\"],\"delete_all\":true,\"vendor_data\":\"value-vendor-data\",\"vendor_user_uuid\":\"00000000-0000-4000-8000-000000003947\",\"status\":\"pending\",\"source_type\":\"session_delete\",\"retained_from\":\"2026-11-01T10:15:30Z\",\"retained_to\":\"2026-11-01T10:15:30Z\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/BusinessSessionsResourceTest.java b/src/test/java/me/didit/resources/BusinessSessionsResourceTest.java new file mode 100644 index 0000000..0df5d8d --- /dev/null +++ b/src/test/java/me/didit/resources/BusinessSessionsResourceTest.java @@ -0,0 +1,40 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code business_sessions}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class BusinessSessionsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void listNetworks() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.businessSessions().listNetworks("00000000-0000-4000-8000-0000000217b0"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/business-sessions/00000000-0000-4000-8000-0000000217b0/networks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/BusinessesResourceTest.java b/src/test/java/me/didit/resources/BusinessesResourceTest.java new file mode 100644 index 0000000..be32178 --- /dev/null +++ b/src/test/java/me/didit/resources/BusinessesResourceTest.java @@ -0,0 +1,237 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.BusinessesBatchDeleteParams; +import me.didit.types.BusinessesCreateParams; +import me.didit.types.BusinessesListParams; +import me.didit.types.BusinessesSetAmlMonitoringParams; +import me.didit.types.BusinessesSetOngoingMonitoringParams; +import me.didit.types.BusinessesSetSessionOngoingMonitoringParams; +import me.didit.types.BusinessesUpdateParams; +import me.didit.types.BusinessesUpdateStatusParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code businesses}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class BusinessesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + BusinessesListParams params = BusinessesListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/businesses/", "200"); + transport.respondJson(200, example); + var result = client.businesses().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/businesses/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/businesses/{vendor_data}/", "200"); + transport.respondJson(200, example); + var result = client.businesses().retrieve("00000000-0000-4000-8000-00000000bee9"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/businesses/00000000-0000-4000-8000-00000000bee9/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + BusinessesUpdateParams params = BusinessesUpdateParams.builder().displayName("value-display-name").legalName("value-legal-name").registrationNumber("value-registration-number").countryCode("value-country-code").status(BusinessesUpdateParams.Status.ACTIVE).metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/businesses/{vendor_data}/", "200"); + transport.respondJson(200, example); + var result = client.businesses().update("00000000-0000-4000-8000-00000000a594", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/businesses/00000000-0000-4000-8000-00000000a594/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"display_name\":\"value-display-name\",\"legal_name\":\"value-legal-name\",\"registration_number\":\"value-registration-number\",\"country_code\":\"value-country-code\",\"status\":\"ACTIVE\",\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateStatus() { + BusinessesUpdateStatusParams params = BusinessesUpdateStatusParams.builder().status(BusinessesUpdateStatusParams.Status.ACTIVE).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/businesses/{vendor_data}/update-status/", "200"); + transport.respondJson(200, example); + var result = client.businesses().updateStatus("00000000-0000-4000-8000-0000000104c4", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/businesses/00000000-0000-4000-8000-0000000104c4/update-status/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"status\":\"ACTIVE\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void batchDelete() { + BusinessesBatchDeleteParams params = BusinessesBatchDeleteParams.builder().vendorDataList(List.of("value-vendor-data-list")).diditInternalIdList(List.of("00000000-0000-4000-8000-0000000068ce")).deleteAll(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/businesses/delete/", "200"); + transport.respondJson(200, example); + var result = client.businesses().batchDelete(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/businesses/delete/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"vendor_data_list\":[\"value-vendor-data-list\"],\"didit_internal_id_list\":[\"00000000-0000-4000-8000-0000000068ce\"],\"delete_all\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void setAmlMonitoring() { + BusinessesSetAmlMonitoringParams params = BusinessesSetAmlMonitoringParams.builder().isEnabled(true).estimateOnly(true).vendorDataList(List.of("value-vendor-data-list")).diditInternalIdList(List.of("00000000-0000-4000-8000-0000000068ce")).build(); + JsonNode example = TestJson.parse("{\"already_enabled\":1,\"balance_sufficient\":true,\"estimated_annual_monitoring_cost_usd\":1.5,\"estimated_screening_cost_usd\":1.5,\"needing_screening\":1,\"skipped_blocked\":1,\"skipped_no_identity_data\":1,\"unmatched\":[],\"users_total\":1,\"with_existing_aml\":1}"); + transport.respondJson(200, example); + var result = client.businesses().setAmlMonitoring(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/businesses/aml-monitoring/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_enabled\":true,\"estimate_only\":true,\"vendor_data_list\":[\"value-vendor-data-list\"],\"didit_internal_id_list\":[\"00000000-0000-4000-8000-0000000068ce\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void create() { + BusinessesCreateParams params = BusinessesCreateParams.builder().vendorData("value-vendor-data").displayName("value-display-name").legalName("value-legal-name").registrationNumber("value-registration-number").countryCode("value-country-code").status(BusinessesCreateParams.Status.ACTIVE).metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/businesses/create/", "201"); + transport.respondJson(201, example); + var result = client.businesses().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/businesses/create/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"display_name\":\"value-display-name\",\"legal_name\":\"value-legal-name\",\"registration_number\":\"value-registration-number\",\"country_code\":\"value-country-code\",\"status\":\"ACTIVE\",\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void setOngoingMonitoring() { + BusinessesSetOngoingMonitoringParams params = BusinessesSetOngoingMonitoringParams.builder().isEnabled(true).estimateOnly(true).updateAll(true).filterSearch("value-filter-search").filterStatus(List.of("value-filter-status")).filterCountry("value-filter-country").filterDateFrom(LocalDate.parse("2026-11-01")).filterDateTo(LocalDate.parse("2026-11-01")).diditInternalIdList(List.of("00000000-0000-4000-8000-0000000068ce")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.businesses().setOngoingMonitoring(params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/vendor-businesses/toggle-ongoing-monitoring/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_enabled\":true,\"estimate_only\":true,\"update_all\":true,\"filter_search\":\"value-filter-search\",\"filter_status\":[\"value-filter-status\"],\"filter_country\":\"value-filter-country\",\"filter_date_from\":\"2026-11-01\",\"filter_date_to\":\"2026-11-01\",\"didit_internal_id_list\":[\"00000000-0000-4000-8000-0000000068ce\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void retrieveOngoingMonitoringJob() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.businesses().retrieveOngoingMonitoringJob("00000000-0000-4000-8000-00000001e392"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/vendor-businesses/toggle-ongoing-monitoring/00000000-0000-4000-8000-00000001e392/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void setSessionOngoingMonitoring() { + BusinessesSetSessionOngoingMonitoringParams params = BusinessesSetSessionOngoingMonitoringParams.builder().isEnabled(true).estimateOnly(true).updateAll(true).filterSearch("value-filter-search").filterStatus(List.of("value-filter-status")).filterCountry("value-filter-country").filterDateFrom(LocalDate.parse("2026-11-01")).filterDateTo(LocalDate.parse("2026-11-01")).sessionNumbers(List.of("value-session-numbers")).toggleAll(true).filterWorkflowId("value-filter-workflow-id").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.businesses().setSessionOngoingMonitoring(params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/businesses/toggle-ongoing-monitoring/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_enabled\":true,\"estimate_only\":true,\"update_all\":true,\"filter_search\":\"value-filter-search\",\"filter_status\":[\"value-filter-status\"],\"filter_country\":\"value-filter-country\",\"filter_date_from\":\"2026-11-01\",\"filter_date_to\":\"2026-11-01\",\"session_numbers\":[\"value-session-numbers\"],\"toggle_all\":true,\"filter_workflow_id\":\"value-filter-workflow-id\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void retrieveSessionOngoingMonitoringJob() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.businesses().retrieveSessionOngoingMonitoringJob("00000000-0000-4000-8000-000000029309"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/businesses/toggle-ongoing-monitoring/00000000-0000-4000-8000-000000029309/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listNetworks() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.businesses().listNetworks("00000000-0000-4000-8000-00000001a190"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/businesses/00000000-0000-4000-8000-00000001a190/networks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesBlueprintsResourceTest.java b/src/test/java/me/didit/resources/CasesBlueprintsResourceTest.java new file mode 100644 index 0000000..28d149c --- /dev/null +++ b/src/test/java/me/didit/resources/CasesBlueprintsResourceTest.java @@ -0,0 +1,229 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CaseContentConfig; +import me.didit.types.CasePublicationPolicyDraftPreconditionRequest; +import me.didit.types.CasePublicationPolicyDraftWriteRequest; +import me.didit.types.CasesBlueprintsCreateParams; +import me.didit.types.CasesBlueprintsInstallPresetsParams; +import me.didit.types.CasesBlueprintsListHistoryParams; +import me.didit.types.CasesBlueprintsListParams; +import me.didit.types.CasesBlueprintsUpdateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.blueprints}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesBlueprintsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + CasesBlueprintsListParams params = CasesBlueprintsListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CasesBlueprintsCreateParams params = CasesBlueprintsCreateParams.builder().name("value-name").description("value-description").assigneePool(List.of("00000000-0000-4000-8000-0000000025f2")).assignmentMethod(CasesBlueprintsCreateParams.AssignmentMethod.MANUAL).maxActiveCases(1L).escalationEnabled(true).escalationBlueprint("00000000-0000-4000-8000-0000000058a9").transferEnabled(true).fourEyesCheckerBlueprint("00000000-0000-4000-8000-000000009dc3").requireResolutionNote(true).contentConfig(CaseContentConfig.builder().checklist(CaseContentConfig.Checklist.builder().enabled(true).optional(true).build()).amlControl(CaseContentConfig.AmlControl.builder().enabled(true).financial(true).build()).build()).isActive(true).defaultDeadlineHours(1L).publish(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().blueprints().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"description\":\"value-description\",\"assignee_pool\":[\"00000000-0000-4000-8000-0000000025f2\"],\"assignment_method\":\"MANUAL\",\"max_active_cases\":1,\"escalation_enabled\":true,\"escalation_blueprint\":\"00000000-0000-4000-8000-0000000058a9\",\"transfer_enabled\":true,\"four_eyes_checker_blueprint\":\"00000000-0000-4000-8000-000000009dc3\",\"require_resolution_note\":true,\"content_config\":{\"checklist\":{\"enabled\":true,\"optional\":true},\"aml_control\":{\"enabled\":true,\"financial\":true}},\"is_active\":true,\"default_deadline_hours\":1,\"publish\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().retrieve("00000000-0000-4000-8000-000000014565"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-000000014565/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + CasesBlueprintsUpdateParams params = CasesBlueprintsUpdateParams.builder().name("value-name").description("value-description").assigneePool(List.of("00000000-0000-4000-8000-0000000025f2")).assignmentMethod(CasesBlueprintsUpdateParams.AssignmentMethod.MANUAL).maxActiveCases(1L).escalationEnabled(true).escalationBlueprint("00000000-0000-4000-8000-0000000058a9").transferEnabled(true).fourEyesCheckerBlueprint("00000000-0000-4000-8000-000000009dc3").requireResolutionNote(true).contentConfig(CaseContentConfig.builder().checklist(CaseContentConfig.Checklist.builder().enabled(true).optional(true).build()).amlControl(CaseContentConfig.AmlControl.builder().enabled(true).financial(true).build()).build()).isActive(true).defaultDeadlineHours(1L).expectedVersion(1L).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().update("00000000-0000-4000-8000-0000000123f6", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-0000000123f6/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"description\":\"value-description\",\"assignee_pool\":[\"00000000-0000-4000-8000-0000000025f2\"],\"assignment_method\":\"MANUAL\",\"max_active_cases\":1,\"escalation_enabled\":true,\"escalation_blueprint\":\"00000000-0000-4000-8000-0000000058a9\",\"transfer_enabled\":true,\"four_eyes_checker_blueprint\":\"00000000-0000-4000-8000-000000009dc3\",\"require_resolution_note\":true,\"content_config\":{\"checklist\":{\"enabled\":true,\"optional\":true},\"aml_control\":{\"enabled\":true,\"financial\":true}},\"is_active\":true,\"default_deadline_hours\":1,\"expected_version\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.cases().blueprints().delete("00000000-0000-4000-8000-0000000122e7"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-0000000122e7/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } + + @Test + void listPresets() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().listPresets(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/presets/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void installPresets() { + CasesBlueprintsInstallPresetsParams params = CasesBlueprintsInstallPresetsParams.builder().presetKeys(List.of("value-preset-keys")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().installPresets(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/presets/install/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"preset_keys\":[\"value-preset-keys\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void publish() { + CasePublicationPolicyDraftPreconditionRequest params = CasePublicationPolicyDraftPreconditionRequest.builder().expectedVersion(1L).expectedRevision("00000000-0000-4000-8000-000000004071").build(); + JsonNode example = TestJson.parse("{\"created_at\":\"2026-11-01T10:15:30Z\",\"creation_sources\":[],\"escalation_blueprint_name\":\"value\",\"four_eyes_checker_blueprint_name\":\"value\",\"name\":\"value\",\"receives_escalation_from\":[],\"updated_at\":\"2026-11-01T10:15:30Z\",\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().publish("00000000-0000-4000-8000-0000000134b5", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-0000000134b5/publish/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"expected_version\":1,\"expected_revision\":\"00000000-0000-4000-8000-000000004071\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveDraft() { + JsonNode example = TestJson.parse("{\"draft\":{\"base_version\":1,\"updated_at\":\"2026-11-01T10:15:30Z\"}}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().retrieveDraft("00000000-0000-4000-8000-00000001ae8e"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-00000001ae8e/draft/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void saveDraft() { + CasePublicationPolicyDraftWriteRequest params = CasePublicationPolicyDraftWriteRequest.builder().expectedVersion(1L).expectedRevision("00000000-0000-4000-8000-000000004071").changes(Map.of("key", "value")).build(); + JsonNode example = TestJson.parse("{\"base_version\":1,\"updated_at\":\"2026-11-01T10:15:30Z\"}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().saveDraft("00000000-0000-4000-8000-0000000164f9", params); + RecordedRequest request = transport.only(); + assertEquals("PUT", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-0000000164f9/draft/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"expected_version\":1,\"expected_revision\":\"00000000-0000-4000-8000-000000004071\",\"changes\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void discardDraft() { + CasePublicationPolicyDraftPreconditionRequest params = CasePublicationPolicyDraftPreconditionRequest.builder().expectedVersion(1L).expectedRevision("00000000-0000-4000-8000-000000004071").build(); + transport.respond(204, ""); + client.cases().blueprints().discardDraft("00000000-0000-4000-8000-000000019922", params); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-000000019922/draft/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"expected_version\":1,\"expected_revision\":\"00000000-0000-4000-8000-000000004071\"}", request.body()); + } + + @Test + void listHistory() { + CasesBlueprintsListHistoryParams params = CasesBlueprintsListHistoryParams.builder().ordering("value-ordering").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().blueprints().listHistory("00000000-0000-4000-8000-000000018e40", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/blueprints/00000000-0000-4000-8000-000000018e40/history/", request.path()); + assertEquals(Map.ofEntries(Map.entry("ordering", List.of("value-ordering")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } +} diff --git a/src/test/java/me/didit/resources/CasesChecklistResourceTest.java b/src/test/java/me/didit/resources/CasesChecklistResourceTest.java new file mode 100644 index 0000000..74881ce --- /dev/null +++ b/src/test/java/me/didit/resources/CasesChecklistResourceTest.java @@ -0,0 +1,58 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CasesChecklistToggleItemParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.checklist}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesChecklistResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + JsonNode example = TestJson.parse("[]"); + transport.respondJson(200, example); + var result = client.cases().checklist().list("00000000-0000-4000-8000-00000000b072"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000b072/checklist/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void toggleItem() { + CasesChecklistToggleItemParams params = CasesChecklistToggleItemParams.builder().isCompleted(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().checklist().toggleItem("00000000-0000-4000-8000-000000010e5c", "00000000-0000-4000-8000-00000001107f", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000010e5c/checklist/00000000-0000-4000-8000-00000001107f/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_completed\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesLinksResourceTest.java b/src/test/java/me/didit/resources/CasesLinksResourceTest.java new file mode 100644 index 0000000..0c1b4e6 --- /dev/null +++ b/src/test/java/me/didit/resources/CasesLinksResourceTest.java @@ -0,0 +1,71 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CasesLinksCreateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.links}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesLinksResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + JsonNode example = TestJson.parse("[]"); + transport.respondJson(200, example); + var result = client.cases().links().list("00000000-0000-4000-8000-0000000083c7"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-0000000083c7/links/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void create() { + CasesLinksCreateParams params = CasesLinksCreateParams.builder().entityType(CasesLinksCreateParams.EntityType.SESSION).entityUuid("00000000-0000-4000-8000-000000001c1f").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().links().create("00000000-0000-4000-8000-000000009800", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000009800/links/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"entity_type\":\"session\",\"entity_uuid\":\"00000000-0000-4000-8000-000000001c1f\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.cases().links().delete("00000000-0000-4000-8000-000000009800", "00000000-0000-4000-8000-000000009966"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000009800/links/00000000-0000-4000-8000-000000009966/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } +} diff --git a/src/test/java/me/didit/resources/CasesNotesResourceTest.java b/src/test/java/me/didit/resources/CasesNotesResourceTest.java new file mode 100644 index 0000000..ab22cbe --- /dev/null +++ b/src/test/java/me/didit/resources/CasesNotesResourceTest.java @@ -0,0 +1,130 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CaseCollaborationCaseNoteCreateRequest; +import me.didit.types.CaseCollaborationPatchedCaseNoteUpdateRequest; +import me.didit.types.CasesNotesCreateAttachmentUploadParams; +import me.didit.types.CasesNotesListParams; +import me.didit.types.CasesNotesRetrieveAttachmentUrlParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.notes}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesNotesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + CasesNotesListParams params = CasesNotesListParams.builder().ordering("value-ordering").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().notes().list("00000000-0000-4000-8000-0000000083ff", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-0000000083ff/notes/", request.path()); + assertEquals(Map.ofEntries(Map.entry("ordering", List.of("value-ordering")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CaseCollaborationCaseNoteCreateRequest params = CaseCollaborationCaseNoteCreateRequest.builder().comment("value-comment").replyTo("00000000-0000-4000-8000-000000000f77").clientReference("00000000-0000-4000-8000-00000000378b").mentionedEmails(List.of("user@example.com")).isInternal(true).attachments(List.of(Map.of("key", "value"))).tags(List.of("value-tags")).build(); + JsonNode example = TestJson.parse("{\"comment\":\"value\",\"created_at\":\"2026-11-01T10:15:30Z\",\"reply_to\":{\"actor_email\":\"value\",\"actor_name\":\"value\",\"comment\":\"value\",\"uuid\":\"value\"},\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.cases().notes().create("00000000-0000-4000-8000-000000009838", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000009838/notes/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"comment\":\"value-comment\",\"reply_to\":\"00000000-0000-4000-8000-000000000f77\",\"client_reference\":\"00000000-0000-4000-8000-00000000378b\",\"mentioned_emails\":[\"user@example.com\"],\"is_internal\":true,\"attachments\":[{\"key\":\"value\"}],\"tags\":[\"value-tags\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + CaseCollaborationPatchedCaseNoteUpdateRequest params = CaseCollaborationPatchedCaseNoteUpdateRequest.builder().isPinned(true).build(); + JsonNode example = TestJson.parse("{\"comment\":\"value\",\"created_at\":\"2026-11-01T10:15:30Z\",\"reply_to\":{\"actor_email\":\"value\",\"actor_name\":\"value\",\"comment\":\"value\",\"uuid\":\"value\"},\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.cases().notes().update("00000000-0000-4000-8000-0000000098f7", "00000000-0000-4000-8000-000000009af5", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-0000000098f7/notes/00000000-0000-4000-8000-000000009af5/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_pinned\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.cases().notes().delete("00000000-0000-4000-8000-000000009838", "00000000-0000-4000-8000-000000009a36"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000009838/notes/00000000-0000-4000-8000-000000009a36/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } + + @Test + void retrieveAttachmentUrl() { + CasesNotesRetrieveAttachmentUrlParams params = CasesNotesRetrieveAttachmentUrlParams.builder().s3Key("value-s3-key").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().notes().retrieveAttachmentUrl("00000000-0000-4000-8000-000000019809", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000019809/notes/presign/", request.path()); + assertEquals(Map.ofEntries(Map.entry("s3_key", List.of("value-s3-key"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void createAttachmentUpload() { + CasesNotesCreateAttachmentUploadParams params = CasesNotesCreateAttachmentUploadParams.builder().file(FileUpload.of(new byte[] {37, 80, 68, 70}, "file.pdf", "application/pdf")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().notes().createAttachmentUpload("00000000-0000-4000-8000-00000001a72f", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000001a72f/notes/presign/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.of(), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("file", List.of("file.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesRegulatoryReportsResourceTest.java b/src/test/java/me/didit/resources/CasesRegulatoryReportsResourceTest.java new file mode 100644 index 0000000..3588617 --- /dev/null +++ b/src/test/java/me/didit/resources/CasesRegulatoryReportsResourceTest.java @@ -0,0 +1,62 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CasesRegulatoryReportsCreateParams; +import me.didit.types.CasesRegulatoryReportsListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.regulatory_reports}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesRegulatoryReportsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + CasesRegulatoryReportsListParams params = CasesRegulatoryReportsListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().regulatoryReports().list("00000000-0000-4000-8000-000000013202", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000013202/regulatory-reports/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CasesRegulatoryReportsCreateParams params = CasesRegulatoryReportsCreateParams.builder().reportType(CasesRegulatoryReportsCreateParams.ReportType.SAR).jurisdiction("value-jurisdiction").template("00000000-0000-4000-8000-000000000efb").transactions(List.of("00000000-0000-4000-8000-000000002132")).rentityId("value-rentity-id").rentityBranch("value-rentity-branch").submissionCode(CasesRegulatoryReportsCreateParams.SubmissionCode.E).entityReference("value-entity-reference").fiuRefNumber("value-fiu-ref-number").currencyCodeLocal("value-currency-code-local").submissionDate(OffsetDateTime.parse("2026-11-01T10:15:30Z")).reportingPerson(Map.of("key", "value")).location(Map.of("key", "value")).reason("value-reason").action("value-action").activity("value-activity").narrative(CasesRegulatoryReportsCreateParams.Narrative.builder().who("value-who").what("value-what").build()).reportIndicators(List.of("value-report-indicators")).includedFields(List.of("value-included-fields")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().regulatoryReports().create("00000000-0000-4000-8000-000000014f93", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000014f93/regulatory-reports/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"report_type\":\"SAR\",\"jurisdiction\":\"value-jurisdiction\",\"template\":\"00000000-0000-4000-8000-000000000efb\",\"transactions\":[\"00000000-0000-4000-8000-000000002132\"],\"rentity_id\":\"value-rentity-id\",\"rentity_branch\":\"value-rentity-branch\",\"submission_code\":\"E\",\"entity_reference\":\"value-entity-reference\",\"fiu_ref_number\":\"value-fiu-ref-number\",\"currency_code_local\":\"value-currency-code-local\",\"submission_date\":\"2026-11-01T10:15:30Z\",\"reporting_person\":{\"key\":\"value\"},\"location\":{\"key\":\"value\"},\"reason\":\"value-reason\",\"action\":\"value-action\",\"activity\":\"value-activity\",\"narrative\":{\"who\":\"value-who\",\"what\":\"value-what\"},\"report_indicators\":[\"value-report-indicators\"],\"included_fields\":[\"value-included-fields\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesRequestsResourceTest.java b/src/test/java/me/didit/resources/CasesRequestsResourceTest.java new file mode 100644 index 0000000..9d9dc6e --- /dev/null +++ b/src/test/java/me/didit/resources/CasesRequestsResourceTest.java @@ -0,0 +1,129 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CasesRequestsListParams; +import me.didit.types.CustomerMessagingCaseRequestConfirmRequest; +import me.didit.types.CustomerMessagingCaseRequestPreviewRequest; +import me.didit.types.CustomerMessagingLanguageEnum; +import me.didit.types.CustomerMessagingPurposeEnum; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.requests}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesRequestsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + CasesRequestsListParams params = CasesRequestsListParams.builder().ordering("value-ordering").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().requests().list("00000000-0000-4000-8000-00000000a61c", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000a61c/requests/", request.path()); + assertEquals(Map.ofEntries(Map.entry("ordering", List.of("value-ordering")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CustomerMessagingCaseRequestConfirmRequest params = CustomerMessagingCaseRequestConfirmRequest.builder().contactId("00000000-0000-4000-8000-00000000164f").purpose(CustomerMessagingPurposeEnum.IDENTITY_DOCUMENT).language(CustomerMessagingLanguageEnum.EN).requestId("00000000-0000-4000-8000-0000000016cb").expiresAt(OffsetDateTime.parse("2026-11-01T10:15:30Z")).previewToken("value-preview-token").build(); + JsonNode example = TestJson.parse("{\"actor_email\":\"value\",\"cancelled_at\":\"2026-11-01T10:15:30Z\",\"created_at\":\"2026-11-01T10:15:30Z\",\"delivered_at\":\"2026-11-01T10:15:30Z\",\"delivery_status\":\"value\",\"expires_at\":\"2026-11-01T10:15:30Z\",\"has_attachment\":true,\"language\":\"value\",\"purpose\":\"value\",\"recipient\":\"value\",\"responded_at\":\"2026-11-01T10:15:30Z\",\"response\":{},\"uuid\":\"value\"}"); + transport.respondJson(201, example); + var result = client.cases().requests().create("00000000-0000-4000-8000-00000000bc7d", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000bc7d/requests/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"contact_id\":\"00000000-0000-4000-8000-00000000164f\",\"purpose\":\"identity_document\",\"language\":\"en\",\"request_id\":\"00000000-0000-4000-8000-0000000016cb\",\"expires_at\":\"2026-11-01T10:15:30Z\",\"preview_token\":\"value-preview-token\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void cancel() { + JsonNode example = TestJson.parse("{\"actor_email\":\"value\",\"cancelled_at\":\"2026-11-01T10:15:30Z\",\"created_at\":\"2026-11-01T10:15:30Z\",\"delivered_at\":\"2026-11-01T10:15:30Z\",\"delivery_status\":\"value\",\"expires_at\":\"2026-11-01T10:15:30Z\",\"has_attachment\":true,\"language\":\"value\",\"purpose\":\"value\",\"recipient\":\"value\",\"responded_at\":\"2026-11-01T10:15:30Z\",\"response\":{},\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.cases().requests().cancel("00000000-0000-4000-8000-00000000bb8b", "00000000-0000-4000-8000-00000000e7e6"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000bb8b/requests/00000000-0000-4000-8000-00000000e7e6/cancel/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveOptions() { + JsonNode example = TestJson.parse("{\"contacts\":[],\"languages\":[],\"purposes\":[]}"); + transport.respondJson(200, example); + var result = client.cases().requests().retrieveOptions("00000000-0000-4000-8000-00000001546b"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000001546b/requests/options/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveAttachment() { + transport.respondBinary(200, "image/jpeg", new byte[] {37, 80, 68, 70}); + var result = client.cases().requests().retrieveAttachment("00000000-0000-4000-8000-000000018517", "00000000-0000-4000-8000-00000001c3fb"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000018517/requests/00000000-0000-4000-8000-00000001c3fb/attachment/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("image/jpeg, application/json", request.header("Accept")); + assertEquals(0, request.body().length); + assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes()); + } + + @Test + void preview() { + CustomerMessagingCaseRequestPreviewRequest params = CustomerMessagingCaseRequestPreviewRequest.builder().contactId("00000000-0000-4000-8000-00000000164f").purpose(CustomerMessagingPurposeEnum.IDENTITY_DOCUMENT).language(CustomerMessagingLanguageEnum.EN).build(); + JsonNode example = TestJson.parse("{\"expires_at\":\"2026-11-01T10:15:30Z\",\"html\":\"value\",\"preview_token\":\"value\",\"recipient\":\"value\",\"request_id\":\"value\",\"requires_user_action\":true,\"sender\":\"value\",\"subject\":\"value\"}"); + transport.respondJson(200, example); + var result = client.cases().requests().preview("00000000-0000-4000-8000-00000000cbec", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000cbec/requests/preview/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"contact_id\":\"00000000-0000-4000-8000-00000000164f\",\"purpose\":\"identity_document\",\"language\":\"en\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesResourceTest.java b/src/test/java/me/didit/resources/CasesResourceTest.java new file mode 100644 index 0000000..2eb9f87 --- /dev/null +++ b/src/test/java/me/didit/resources/CasesResourceTest.java @@ -0,0 +1,443 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CaseActionActionEnum; +import me.didit.types.CaseActionCaseEntityActionRequest; +import me.didit.types.CaseDuplicateCaseDuplicateQueryRequest; +import me.didit.types.CaseDuplicateCaseFraudSourceContextRequest; +import me.didit.types.CaseDuplicateCaseLinkCreateRequest; +import me.didit.types.CaseDuplicateCaseSubjectInputRequest; +import me.didit.types.CaseDuplicateEntityTypeEnum; +import me.didit.types.CaseDuplicateTypeEnum; +import me.didit.types.CasesAssignParams; +import me.didit.types.CasesBulkAssignParams; +import me.didit.types.CasesBulkUpdateStatusParams; +import me.didit.types.CasesCreateParams; +import me.didit.types.CasesListActionReceiptsParams; +import me.didit.types.CasesListEventsParams; +import me.didit.types.CasesListParams; +import me.didit.types.CasesRejectResolutionParams; +import me.didit.types.CasesResolveParams; +import me.didit.types.CasesRetrieveStatisticsParams; +import me.didit.types.CasesTransferParams; +import me.didit.types.CasesUpdateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + CasesListParams params = CasesListParams.builder().limit(1L).offset(1L).statusIn("value-status-in").priority("value-priority").sourceIn("value-source-in").blueprint("00000000-0000-4000-8000-00000000136c").assignedTo("00000000-0000-4000-8000-000000001b62").unassigned(true).tag("value-tag").search("value-search").dateFrom(LocalDate.parse("2026-11-01")).dateTo(LocalDate.parse("2026-11-01")).dueBefore(OffsetDateTime.parse("2026-11-01T10:15:30Z")).overdue(true).ordering(CasesListParams.Ordering.CREATED_AT).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1")), Map.entry("status__in", List.of("value-status-in")), Map.entry("priority", List.of("value-priority")), Map.entry("source__in", List.of("value-source-in")), Map.entry("blueprint", List.of("00000000-0000-4000-8000-00000000136c")), Map.entry("assigned_to", List.of("00000000-0000-4000-8000-000000001b62")), Map.entry("unassigned", List.of("true")), Map.entry("tag", List.of("value-tag")), Map.entry("search", List.of("value-search")), Map.entry("date_from", List.of("2026-11-01")), Map.entry("date_to", List.of("2026-11-01")), Map.entry("due_before", List.of("2026-11-01T10:15:30Z")), Map.entry("overdue", List.of("true")), Map.entry("ordering", List.of("created_at"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CasesCreateParams params = CasesCreateParams.builder().title("value-title").blueprint("00000000-0000-4000-8000-00000000136c").priority(CasesCreateParams.Priority.LOW).dueAt(OffsetDateTime.parse("2026-11-01T10:15:30Z")).tags(List.of("value-tags")).subject(CasesCreateParams.Subject.builder().type(CasesCreateParams.Subject.Type.USER).uuid("00000000-0000-4000-8000-00000000042a").build()).links(List.of(Map.of("key", "value"))).assignedTo("00000000-0000-4000-8000-000000001b62").reviewDuplicates(true).separateIncidentReason("value-separate-incident-reason").sourceContext(CaseDuplicateCaseFraudSourceContextRequest.builder().checkId("00000000-0000-4000-8000-000000000e3e").requestId("00000000-0000-4000-8000-0000000016cb").sourceSection("value-source-section").build()).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"title\":\"value-title\",\"blueprint\":\"00000000-0000-4000-8000-00000000136c\",\"priority\":\"LOW\",\"due_at\":\"2026-11-01T10:15:30Z\",\"tags\":[\"value-tags\"],\"subject\":{\"type\":\"user\",\"uuid\":\"00000000-0000-4000-8000-00000000042a\"},\"links\":[{\"key\":\"value\"}],\"assigned_to\":\"00000000-0000-4000-8000-000000001b62\",\"review_duplicates\":true,\"separate_incident_reason\":\"value-separate-incident-reason\",\"source_context\":{\"check_id\":\"00000000-0000-4000-8000-000000000e3e\",\"request_id\":\"00000000-0000-4000-8000-0000000016cb\",\"source_section\":\"value-source-section\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().retrieve("00000000-0000-4000-8000-00000000715c"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000715c/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + CasesUpdateParams params = CasesUpdateParams.builder().title("value-title").priority(CasesUpdateParams.Priority.LOW).dueAt(OffsetDateTime.parse("2026-11-01T10:15:30Z")).tags(List.of("value-tags")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().update("00000000-0000-4000-8000-000000005e20", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000005e20/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"title\":\"value-title\",\"priority\":\"LOW\",\"due_at\":\"2026-11-01T10:15:30Z\",\"tags\":[\"value-tags\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.cases().delete("00000000-0000-4000-8000-000000005dc1"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000005dc1/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } + + @Test + void assign() { + CasesAssignParams params = CasesAssignParams.builder().assigneeUserId("00000000-0000-4000-8000-0000000037bf").assigneeEmail("user@example.com").assigneeName("value-assignee-name").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().assign("00000000-0000-4000-8000-000000005e60", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000005e60/assign/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"assignee_user_id\":\"00000000-0000-4000-8000-0000000037bf\",\"assignee_email\":\"user@example.com\",\"assignee_name\":\"value-assignee-name\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void resolve() { + CasesResolveParams params = CasesResolveParams.builder().resolution(CasesResolveParams.Resolution.FALSE_POSITIVE).note("value-note").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().resolve("00000000-0000-4000-8000-00000000680d", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000680d/resolve/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"resolution\":\"FALSE_POSITIVE\",\"note\":\"value-note\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void reopen() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().reopen("00000000-0000-4000-8000-000000005e73"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000005e73/reopen/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void requestInfo() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().requestInfo("00000000-0000-4000-8000-000000009bd0"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000009bd0/request-info/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void escalate() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().escalate("00000000-0000-4000-8000-000000007005"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000007005/escalate/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void transfer() { + CasesTransferParams params = CasesTransferParams.builder().targetBlueprint("00000000-0000-4000-8000-0000000039b1").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().transfer("00000000-0000-4000-8000-000000007152", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-000000007152/transfer/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"target_blueprint\":\"00000000-0000-4000-8000-0000000039b1\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void approveResolution() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().approveResolution("00000000-0000-4000-8000-00000000ea54"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000ea54/approve/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void rejectResolution() { + CasesRejectResolutionParams params = CasesRejectResolutionParams.builder().notes("value-notes").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().rejectResolution("00000000-0000-4000-8000-00000000db99", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000db99/reject-approval/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"notes\":\"value-notes\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void applyEntityAction() { + CaseActionCaseEntityActionRequest params = CaseActionCaseEntityActionRequest.builder().clientReference("00000000-0000-4000-8000-00000000378b").retry(true).action(CaseActionActionEnum.SET_STATUS).status("value-status").tags(List.of("value-tags")).note("value-note").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().applyEntityAction("00000000-0000-4000-8000-00000000f66b", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000f66b/entity-actions/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"client_reference\":\"00000000-0000-4000-8000-00000000378b\",\"retry\":true,\"action\":\"set_status\",\"status\":\"value-status\",\"tags\":[\"value-tags\"],\"note\":\"value-note\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void print() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().print("00000000-0000-4000-8000-00000000564e"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000564e/print/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listEvents() { + CasesListEventsParams params = CasesListEventsParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().listEvents("00000000-0000-4000-8000-00000000915a", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000915a/events/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void listAmlHits() { + JsonNode example = TestJson.parse("[]"); + transport.respondJson(200, example); + var result = client.cases().listAmlHits("00000000-0000-4000-8000-00000000a6e1"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000000a6e1/aml/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveStatistics() { + CasesRetrieveStatisticsParams params = CasesRetrieveStatisticsParams.builder().dateFrom(LocalDate.parse("2026-11-01")).dateTo(LocalDate.parse("2026-11-01")).blueprint("00000000-0000-4000-8000-00000000136c").assignedTo("00000000-0000-4000-8000-000000001b62").priority(CasesRetrieveStatisticsParams.Priority.LOW).source(CasesRetrieveStatisticsParams.Source.MANUAL).status(CasesRetrieveStatisticsParams.Status.OPEN).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().retrieveStatistics(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/statistics/", request.path()); + assertEquals(Map.ofEntries(Map.entry("date_from", List.of("2026-11-01")), Map.entry("date_to", List.of("2026-11-01")), Map.entry("blueprint", List.of("00000000-0000-4000-8000-00000000136c")), Map.entry("assigned_to", List.of("00000000-0000-4000-8000-000000001b62")), Map.entry("priority", List.of("LOW")), Map.entry("source", List.of("MANUAL")), Map.entry("status", List.of("OPEN"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void bulkUpdateStatus() { + CasesBulkUpdateStatusParams params = CasesBulkUpdateStatusParams.builder().caseUuids(List.of("00000000-0000-4000-8000-000000001728")).status(CasesBulkUpdateStatusParams.Status.OPEN).resolution(CasesBulkUpdateStatusParams.Resolution.FALSE_POSITIVE).note("value-note").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().bulkUpdateStatus(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/bulk/status/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"case_uuids\":[\"00000000-0000-4000-8000-000000001728\"],\"status\":\"OPEN\",\"resolution\":\"FALSE_POSITIVE\",\"note\":\"value-note\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void bulkAssign() { + CasesBulkAssignParams params = CasesBulkAssignParams.builder().caseUuids(List.of("00000000-0000-4000-8000-000000001728")).assigneeUserId("00000000-0000-4000-8000-0000000037bf").assigneeEmail("user@example.com").assigneeName("value-assignee-name").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().bulkAssign(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/bulk/assign/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"case_uuids\":[\"00000000-0000-4000-8000-000000001728\"],\"assignee_user_id\":\"00000000-0000-4000-8000-0000000037bf\",\"assignee_email\":\"user@example.com\",\"assignee_name\":\"value-assignee-name\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listActionReceipts() { + CasesListActionReceiptsParams params = CasesListActionReceiptsParams.builder().offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":1,\"next_offset\":1,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().listActionReceipts("00000000-0000-4000-8000-00000001041d", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-00000001041d/action-receipts/", request.path()); + assertEquals(Map.ofEntries(Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retryActionReceipt() { + JsonNode example = TestJson.parse("{\"action\":\"value\",\"client_reference\":\"value\",\"created_at\":\"2026-11-01T10:15:30Z\",\"status\":\"APPLIED\",\"updated_at\":\"2026-11-01T10:15:30Z\",\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.cases().retryActionReceipt("00000000-0000-4000-8000-0000000103c9", "00000000-0000-4000-8000-0000000133eb"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/00000000-0000-4000-8000-0000000103c9/action-receipts/00000000-0000-4000-8000-0000000133eb/retry/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void findDuplicates() { + CaseDuplicateCaseDuplicateQueryRequest params = CaseDuplicateCaseDuplicateQueryRequest.builder().subject(CaseDuplicateCaseSubjectInputRequest.builder().type(CaseDuplicateTypeEnum.USER).uuid("00000000-0000-4000-8000-00000000042a").build()).links(List.of(CaseDuplicateCaseLinkCreateRequest.builder().entityType(CaseDuplicateEntityTypeEnum.SESSION).entityUuid("00000000-0000-4000-8000-000000001c1f").build())).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":1,\"next_offset\":1,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().findDuplicates(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/duplicates/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"subject\":{\"type\":\"user\",\"uuid\":\"00000000-0000-4000-8000-00000000042a\"},\"links\":[{\"entity_type\":\"session\",\"entity_uuid\":\"00000000-0000-4000-8000-000000001c1f\"}],\"offset\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listReviewers() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().listReviewers(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/reviewers/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesRoutingRulesResourceTest.java b/src/test/java/me/didit/resources/CasesRoutingRulesResourceTest.java new file mode 100644 index 0000000..ff0804f --- /dev/null +++ b/src/test/java/me/didit/resources/CasesRoutingRulesResourceTest.java @@ -0,0 +1,199 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CaseRoutingCondition; +import me.didit.types.CaseRoutingPreviewRequest; +import me.didit.types.CaseRoutingRuleCreate; +import me.didit.types.CaseRoutingRuleUpdate; +import me.didit.types.CasesRoutingRulesListHistoryParams; +import me.didit.types.CasesRoutingRulesListParams; +import me.didit.types.RoutingPublicationPolicyDraftPreconditionRequest; +import me.didit.types.RoutingPublicationPolicyDraftWriteRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.routing_rules}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesRoutingRulesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void listHistory() { + CasesRoutingRulesListHistoryParams params = CasesRoutingRulesListHistoryParams.builder().ordering("value-ordering").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().listHistory("00000000-0000-4000-8000-000000018add", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-000000018add/history/", request.path()); + assertEquals(Map.ofEntries(Map.entry("ordering", List.of("value-ordering")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().retrieve("00000000-0000-4000-8000-000000014205"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-000000014205/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + CaseRoutingRuleUpdate params = CaseRoutingRuleUpdate.builder().name("value-name").description("value-description").priority(1L).conditions(List.of(CaseRoutingCondition.builder().field(CaseRoutingCondition.Field.SOURCE).operator(CaseRoutingCondition.Operator.EQUALS).value(CaseRoutingCondition.Value.ofString("value-value")).build())).requiredSkills(List.of("value-required-skills")).blueprint("00000000-0000-4000-8000-00000000136c").team("00000000-0000-4000-8000-000000000415").isActive(true).expectedVersion(1L).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().update("00000000-0000-4000-8000-000000012099", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-000000012099/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"description\":\"value-description\",\"priority\":1,\"conditions\":[{\"field\":\"source\",\"operator\":\"equals\",\"value\":\"value-value\"}],\"required_skills\":[\"value-required-skills\"],\"blueprint\":\"00000000-0000-4000-8000-00000000136c\",\"team\":\"00000000-0000-4000-8000-000000000415\",\"is_active\":true,\"expected_version\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void list() { + CasesRoutingRulesListParams params = CasesRoutingRulesListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CaseRoutingRuleCreate params = CaseRoutingRuleCreate.builder().name("value-name").description("value-description").priority(1L).conditions(List.of(CaseRoutingCondition.builder().field(CaseRoutingCondition.Field.SOURCE).operator(CaseRoutingCondition.Operator.EQUALS).value(CaseRoutingCondition.Value.ofString("value-value")).build())).requiredSkills(List.of("value-required-skills")).blueprint("00000000-0000-4000-8000-00000000136c").team("00000000-0000-4000-8000-000000000415").isActive(true).publish(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().routingRules().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"description\":\"value-description\",\"priority\":1,\"conditions\":[{\"field\":\"source\",\"operator\":\"equals\",\"value\":\"value-value\"}],\"required_skills\":[\"value-required-skills\"],\"blueprint\":\"00000000-0000-4000-8000-00000000136c\",\"team\":\"00000000-0000-4000-8000-000000000415\",\"is_active\":true,\"publish\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void publish() { + RoutingPublicationPolicyDraftPreconditionRequest params = RoutingPublicationPolicyDraftPreconditionRequest.builder().expectedVersion(1L).expectedRevision("00000000-0000-4000-8000-000000004071").build(); + JsonNode example = TestJson.parse("{\"blueprint\":\"value\",\"blueprint_name\":\"value\",\"conditions\":[],\"created_at\":\"2026-11-01T10:15:30Z\",\"name\":\"value\",\"team_name\":\"value\",\"updated_at\":\"2026-11-01T10:15:30Z\",\"uuid\":\"value\",\"version\":1}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().publish("00000000-0000-4000-8000-00000001315e", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-00000001315e/publish/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"expected_version\":1,\"expected_revision\":\"00000000-0000-4000-8000-000000004071\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveDraft() { + JsonNode example = TestJson.parse("{\"draft\":{\"base_version\":1,\"updated_at\":\"2026-11-01T10:15:30Z\"}}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().retrieveDraft("00000000-0000-4000-8000-00000001aa7a"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-00000001aa7a/draft/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void saveDraft() { + RoutingPublicationPolicyDraftWriteRequest params = RoutingPublicationPolicyDraftWriteRequest.builder().expectedVersion(1L).expectedRevision("00000000-0000-4000-8000-000000004071").changes(Map.of("key", "value")).build(); + JsonNode example = TestJson.parse("{\"base_version\":1,\"updated_at\":\"2026-11-01T10:15:30Z\"}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().saveDraft("00000000-0000-4000-8000-000000016118", params); + RecordedRequest request = transport.only(); + assertEquals("PUT", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-000000016118/draft/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"expected_version\":1,\"expected_revision\":\"00000000-0000-4000-8000-000000004071\",\"changes\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void discardDraft() { + RoutingPublicationPolicyDraftPreconditionRequest params = RoutingPublicationPolicyDraftPreconditionRequest.builder().expectedVersion(1L).expectedRevision("00000000-0000-4000-8000-000000004071").build(); + transport.respond(204, ""); + client.cases().routingRules().discardDraft("00000000-0000-4000-8000-0000000194c0", params); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/00000000-0000-4000-8000-0000000194c0/draft/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"expected_version\":1,\"expected_revision\":\"00000000-0000-4000-8000-000000004071\"}", request.body()); + } + + @Test + void preview() { + CaseRoutingPreviewRequest params = CaseRoutingPreviewRequest.builder().source(CaseRoutingPreviewRequest.Source.MANUAL).priority(CaseRoutingPreviewRequest.Priority.LOW).tags(List.of("value-tags")).ruleUuid("00000000-0000-4000-8000-0000000012cc").draft(CaseRoutingRuleCreate.builder().name("value-name").description("value-description").priority(1L).conditions(List.of(CaseRoutingCondition.builder().field(CaseRoutingCondition.Field.SOURCE).operator(CaseRoutingCondition.Operator.EQUALS).value(CaseRoutingCondition.Value.ofString("value-value")).build())).blueprint("00000000-0000-4000-8000-00000000136c").build()).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().routingRules().preview(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/routing-rules/preview/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"source\":\"MANUAL\",\"priority\":\"LOW\",\"tags\":[\"value-tags\"],\"rule_uuid\":\"00000000-0000-4000-8000-0000000012cc\",\"draft\":{\"name\":\"value-name\",\"description\":\"value-description\",\"priority\":1,\"conditions\":[{\"field\":\"source\",\"operator\":\"equals\",\"value\":\"value-value\"}],\"blueprint\":\"00000000-0000-4000-8000-00000000136c\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CasesTeamsResourceTest.java b/src/test/java/me/didit/resources/CasesTeamsResourceTest.java new file mode 100644 index 0000000..524a6f7 --- /dev/null +++ b/src/test/java/me/didit/resources/CasesTeamsResourceTest.java @@ -0,0 +1,96 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CaseReviewTeamCreate; +import me.didit.types.CaseReviewTeamMember; +import me.didit.types.CaseReviewTeamUpdate; +import me.didit.types.CasesTeamsListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code cases.teams}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CasesTeamsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + CasesTeamsListParams params = CasesTeamsListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.cases().teams().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/teams/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + CaseReviewTeamCreate params = CaseReviewTeamCreate.builder().name("value-name").description("value-description").members(List.of(CaseReviewTeamMember.builder().userId("00000000-0000-4000-8000-000000000b5f").availability(CaseReviewTeamMember.Availability.AVAILABLE).capacity(1L).build())).isActive(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.cases().teams().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/teams/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"description\":\"value-description\",\"members\":[{\"user_id\":\"00000000-0000-4000-8000-000000000b5f\",\"availability\":\"available\",\"capacity\":1}],\"is_active\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().teams().retrieve("00000000-0000-4000-8000-00000000cb8d"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/teams/00000000-0000-4000-8000-00000000cb8d/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + CaseReviewTeamUpdate params = CaseReviewTeamUpdate.builder().name("value-name").description("value-description").members(List.of(CaseReviewTeamMember.builder().userId("00000000-0000-4000-8000-000000000b5f").availability(CaseReviewTeamMember.Availability.AVAILABLE).capacity(1L).build())).isActive(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.cases().teams().update("00000000-0000-4000-8000-00000000b139", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/cases/teams/00000000-0000-4000-8000-00000000b139/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"description\":\"value-description\",\"members\":[{\"user_id\":\"00000000-0000-4000-8000-000000000b5f\",\"availability\":\"available\",\"capacity\":1}],\"is_active\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/CustomizationResourceTest.java b/src/test/java/me/didit/resources/CustomizationResourceTest.java new file mode 100644 index 0000000..e8f794f --- /dev/null +++ b/src/test/java/me/didit/resources/CustomizationResourceTest.java @@ -0,0 +1,60 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.CustomizationUpdateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code customization}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class CustomizationResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/customization/", "200"); + transport.respondJson(200, example); + var result = client.customization().retrieve(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/customization/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + CustomizationUpdateParams params = CustomizationUpdateParams.builder().imageSquare(FileUpload.of(new byte[] {37, 80, 68, 70}, "image_square.pdf", "application/pdf")).imageRectangular(FileUpload.of(new byte[] {37, 80, 68, 70}, "image_rectangular.pdf", "application/pdf")).imageFavicon(FileUpload.of(new byte[] {37, 80, 68, 70}, "image_favicon.pdf", "application/pdf")).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/customization/", "200"); + transport.respondJson(200, example); + var result = client.customization().update(params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/customization/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.of(), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("image_square", List.of("image_square.pdf")), Map.entry("image_rectangular", List.of("image_rectangular.pdf")), Map.entry("image_favicon", List.of("image_favicon.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/DatabaseValidationResourceTest.java b/src/test/java/me/didit/resources/DatabaseValidationResourceTest.java new file mode 100644 index 0000000..7069a28 --- /dev/null +++ b/src/test/java/me/didit/resources/DatabaseValidationResourceTest.java @@ -0,0 +1,45 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.DatabaseValidationValidateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code database_validation}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class DatabaseValidationResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void validate() { + DatabaseValidationValidateParams params = DatabaseValidationValidateParams.builder().issuingState("value-issuing-state").services(List.of("value-services")).validationType("value-validation-type").consent(true).identificationNumber("value-identification-number").firstName("value-first-name").lastName("value-last-name").middleName("value-middle-name").fullName("value-full-name").dateOfBirth(LocalDate.parse("2026-11-01")).personalNumber("value-personal-number").taxNumber("value-tax-number").documentNumber("value-document-number").documentType(DatabaseValidationValidateParams.DocumentType.P).expirationDate(LocalDate.parse("2026-11-01")).dateOfIssue(LocalDate.parse("2026-11-01")).nationality("value-nationality").gender(DatabaseValidationValidateParams.Gender.M).address(DatabaseValidationValidateParams.Address.ofVariant1(DatabaseValidationValidateParams.Address.Variant1.builder().street1("value-street-1").street2("value-street-2").build())).addressElement1("value-address-element-1").addressElement2("value-address-element-2").addressElement3("value-address-element-3").addressElement4("value-address-element-4").addressElement5("value-address-element-5").postalCode("value-postal-code").driverLicenseNumber("value-driver-license-number").driverLicenseCardNumber("value-driver-license-card-number").driverLicenseState("value-driver-license-state").driverLicenseVersion("value-driver-license-version").passportNumber("value-passport-number").passportExpirationDate(LocalDate.parse("2026-11-01")).passportFileNumber("value-passport-file-number").passportIssueCountry("value-passport-issue-country").medicareCardNumber("value-medicare-card-number").immiCardNumber("value-immi-card-number").immiCardExpiryDate(LocalDate.parse("2026-11-01")).citizenshipCertificateNumber("value-citizenship-certificate-number").birthRegistrationNumber("value-birth-registration-number").birthRegistrationDate(LocalDate.parse("2026-11-01")).birthRegistrationState("value-birth-registration-state").marriageCertificateNumber("value-marriage-certificate-number").changeOfNameCertificateNumber("value-change-of-name-certificate-number").firstPartnerName("value-first-partner-name").lastPartnerName("value-last-partner-name").voterId("value-voter-id").epicCard("value-epic-card").pan("value-pan").nationalId("value-national-id").cic("value-cic").identificadorCiudadano("value-identificador-ciudadano").ocr("value-ocr").voterNumber("value-voter-number").emissionNumber("value-emission-number").bvn("value-bvn").bankCardNumber("value-bank-card-number").ssn("value-ssn").phone("value-phone").landline("value-landline").email("user@example.com").countryOfResidence("value-country-of-residence").partialMatchAction(DatabaseValidationValidateParams.PartialMatchAction.DECLINE).noMatchAction(DatabaseValidationValidateParams.NoMatchAction.DECLINE).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).selfie(FileUpload.of(new byte[] {37, 80, 68, 70}, "selfie.pdf", "application/pdf")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/database-validation/", "200"); + transport.respondJson(200, example); + var result = client.databaseValidation().validate(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/database-validation/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("issuing_state", List.of("value-issuing-state")), Map.entry("services", List.of("value-services")), Map.entry("validation_type", List.of("value-validation-type")), Map.entry("consent", List.of("true")), Map.entry("identification_number", List.of("value-identification-number")), Map.entry("first_name", List.of("value-first-name")), Map.entry("last_name", List.of("value-last-name")), Map.entry("middle_name", List.of("value-middle-name")), Map.entry("full_name", List.of("value-full-name")), Map.entry("date_of_birth", List.of("2026-11-01")), Map.entry("personal_number", List.of("value-personal-number")), Map.entry("tax_number", List.of("value-tax-number")), Map.entry("document_number", List.of("value-document-number")), Map.entry("document_type", List.of("P")), Map.entry("expiration_date", List.of("2026-11-01")), Map.entry("date_of_issue", List.of("2026-11-01")), Map.entry("nationality", List.of("value-nationality")), Map.entry("gender", List.of("M")), Map.entry("address", List.of("{\"street_1\":\"value-street-1\",\"street_2\":\"value-street-2\"}")), Map.entry("address_element_1", List.of("value-address-element-1")), Map.entry("address_element_2", List.of("value-address-element-2")), Map.entry("address_element_3", List.of("value-address-element-3")), Map.entry("address_element_4", List.of("value-address-element-4")), Map.entry("address_element_5", List.of("value-address-element-5")), Map.entry("postal_code", List.of("value-postal-code")), Map.entry("driver_license_number", List.of("value-driver-license-number")), Map.entry("driver_license_card_number", List.of("value-driver-license-card-number")), Map.entry("driver_license_state", List.of("value-driver-license-state")), Map.entry("driver_license_version", List.of("value-driver-license-version")), Map.entry("passport_number", List.of("value-passport-number")), Map.entry("passport_expiration_date", List.of("2026-11-01")), Map.entry("passport_file_number", List.of("value-passport-file-number")), Map.entry("passport_issue_country", List.of("value-passport-issue-country")), Map.entry("medicare_card_number", List.of("value-medicare-card-number")), Map.entry("immi_card_number", List.of("value-immi-card-number")), Map.entry("immi_card_expiry_date", List.of("2026-11-01")), Map.entry("citizenship_certificate_number", List.of("value-citizenship-certificate-number")), Map.entry("birth_registration_number", List.of("value-birth-registration-number")), Map.entry("birth_registration_date", List.of("2026-11-01")), Map.entry("birth_registration_state", List.of("value-birth-registration-state")), Map.entry("marriage_certificate_number", List.of("value-marriage-certificate-number")), Map.entry("change_of_name_certificate_number", List.of("value-change-of-name-certificate-number")), Map.entry("first_partner_name", List.of("value-first-partner-name")), Map.entry("last_partner_name", List.of("value-last-partner-name")), Map.entry("voter_id", List.of("value-voter-id")), Map.entry("epic_card", List.of("value-epic-card")), Map.entry("pan", List.of("value-pan")), Map.entry("national_id", List.of("value-national-id")), Map.entry("cic", List.of("value-cic")), Map.entry("identificador_ciudadano", List.of("value-identificador-ciudadano")), Map.entry("ocr", List.of("value-ocr")), Map.entry("voter_number", List.of("value-voter-number")), Map.entry("emission_number", List.of("value-emission-number")), Map.entry("bvn", List.of("value-bvn")), Map.entry("bank_card_number", List.of("value-bank-card-number")), Map.entry("ssn", List.of("value-ssn")), Map.entry("phone", List.of("value-phone")), Map.entry("landline", List.of("value-landline")), Map.entry("email", List.of("user@example.com")), Map.entry("country_of_residence", List.of("value-country-of-residence")), Map.entry("partial_match_action", List.of("DECLINE")), Map.entry("no_match_action", List.of("DECLINE")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("selfie", List.of("selfie.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/DocumentAiResourceTest.java b/src/test/java/me/didit/resources/DocumentAiResourceTest.java new file mode 100644 index 0000000..6ac25f9 --- /dev/null +++ b/src/test/java/me/didit/resources/DocumentAiResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.DocumentAiAnalyzeParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code document_ai}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class DocumentAiResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void analyze() { + DocumentAiAnalyzeParams params = DocumentAiAnalyzeParams.builder().document(FileUpload.of(new byte[] {37, 80, 68, 70}, "document.pdf", "application/pdf")).fields("value-fields").expectedFirstName("value-expected-first-name").expectedLastName("value-expected-last-name").expectedCompanyName("value-expected-company-name").expectedCompanyCountry("value-expected-company-country").documentAiNameMatchScoreThreshold(1L).documentAiUnreadableDocumentAction(DocumentAiAnalyzeParams.DocumentAiUnreadableDocumentAction.DECLINE).documentAiMissingRequiredFieldsAction(DocumentAiAnalyzeParams.DocumentAiMissingRequiredFieldsAction.DECLINE).documentAiDocumentTamperingAction(DocumentAiAnalyzeParams.DocumentAiDocumentTamperingAction.DECLINE).documentAiNameMismatchAction(DocumentAiAnalyzeParams.DocumentAiNameMismatchAction.DECLINE).documentAiUnsupportedFileAction(DocumentAiAnalyzeParams.DocumentAiUnsupportedFileAction.DECLINE).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/document-ai/", "200"); + transport.respondJson(200, example); + var result = client.documentAi().analyze(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/document-ai/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("fields", List.of("value-fields")), Map.entry("expected_first_name", List.of("value-expected-first-name")), Map.entry("expected_last_name", List.of("value-expected-last-name")), Map.entry("expected_company_name", List.of("value-expected-company-name")), Map.entry("expected_company_country", List.of("value-expected-company-country")), Map.entry("document_ai_name_match_score_threshold", List.of("1")), Map.entry("document_ai_unreadable_document_action", List.of("DECLINE")), Map.entry("document_ai_missing_required_fields_action", List.of("DECLINE")), Map.entry("document_ai_document_tampering_action", List.of("DECLINE")), Map.entry("document_ai_name_mismatch_action", List.of("DECLINE")), Map.entry("document_ai_unsupported_file_action", List.of("DECLINE")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("document", List.of("document.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/EmailResourceTest.java b/src/test/java/me/didit/resources/EmailResourceTest.java new file mode 100644 index 0000000..022e590 --- /dev/null +++ b/src/test/java/me/didit/resources/EmailResourceTest.java @@ -0,0 +1,79 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.EmailCheckCodeParams; +import me.didit.types.EmailRiskRequest; +import me.didit.types.EmailSendCodeParams; +import me.didit.types.RiskSignals; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code email}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class EmailResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void assessRisk() { + EmailRiskRequest params = EmailRiskRequest.builder().email("user@example.com").countryCode("value-country-code").signals(RiskSignals.builder().ip("192.0.2.10").deviceId("value-device-id").build()).vendorData("value-vendor-data").metadata(Map.of("key", "value")).enableSocial(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/email/risk/", "200"); + transport.respondJson(200, example); + var result = client.email().assessRisk(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/email/risk/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"country_code\":\"value-country-code\",\"signals\":{\"ip\":\"192.0.2.10\",\"device_id\":\"value-device-id\"},\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"enable_social\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void sendCode() { + EmailSendCodeParams params = EmailSendCodeParams.builder().email("user@example.com").options(EmailSendCodeParams.Options.builder().codeSize(1L).alphanumericCode(true).build()).signals(EmailSendCodeParams.Signals.builder().ip("value-ip").deviceId("value-device-id").build()).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/email/send/", "200"); + transport.respondJson(200, example); + var result = client.email().sendCode(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/email/send/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"options\":{\"code_size\":1,\"alphanumeric_code\":true},\"signals\":{\"ip\":\"value-ip\",\"device_id\":\"value-device-id\"},\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void checkCode() { + EmailCheckCodeParams params = EmailCheckCodeParams.builder().email("user@example.com").code("value-code").duplicatedEmailAction(EmailCheckCodeParams.DuplicatedEmailAction.NO_ACTION).breachedEmailAction(EmailCheckCodeParams.BreachedEmailAction.NO_ACTION).disposableEmailAction(EmailCheckCodeParams.DisposableEmailAction.NO_ACTION).enableSocial(true).emailNoSocialPresenceAction(EmailCheckCodeParams.EmailNoSocialPresenceAction.NO_ACTION).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/email/check/", "200"); + transport.respondJson(200, example); + var result = client.email().checkCode(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/email/check/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"email\":\"user@example.com\",\"code\":\"value-code\",\"duplicated_email_action\":\"NO_ACTION\",\"breached_email_action\":\"NO_ACTION\",\"disposable_email_action\":\"NO_ACTION\",\"enable_social\":true,\"email_no_social_presence_action\":\"NO_ACTION\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/FaceMatchResourceTest.java b/src/test/java/me/didit/resources/FaceMatchResourceTest.java new file mode 100644 index 0000000..deb6a68 --- /dev/null +++ b/src/test/java/me/didit/resources/FaceMatchResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.FaceMatchCompareParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code face_match}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class FaceMatchResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void compare() { + FaceMatchCompareParams params = FaceMatchCompareParams.builder().userImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "user_image.pdf", "application/pdf")).refImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "ref_image.pdf", "application/pdf")).faceMatchScoreDeclineThreshold(1.5).rotateImage(true).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/face-match/", "200"); + transport.respondJson(200, example); + var result = client.faceMatch().compare(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/face-match/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("face_match_score_decline_threshold", List.of("1.5")), Map.entry("rotate_image", List.of("true")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("user_image", List.of("user_image.pdf")), Map.entry("ref_image", List.of("ref_image.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/FaceSearchResourceTest.java b/src/test/java/me/didit/resources/FaceSearchResourceTest.java new file mode 100644 index 0000000..1cca3c3 --- /dev/null +++ b/src/test/java/me/didit/resources/FaceSearchResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.FaceSearchSearchParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code face_search}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class FaceSearchResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void search() { + FaceSearchSearchParams params = FaceSearchSearchParams.builder().userImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "user_image.pdf", "application/pdf")).searchType(FaceSearchSearchParams.SearchType.MOST_SIMILAR).rotateImage(true).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/face-search/", "200"); + transport.respondJson(200, example); + var result = client.faceSearch().search(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/face-search/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("search_type", List.of("most_similar")), Map.entry("rotate_image", List.of("true")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("user_image", List.of("user_image.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/FraudChecksResourceTest.java b/src/test/java/me/didit/resources/FraudChecksResourceTest.java new file mode 100644 index 0000000..33bbc1b --- /dev/null +++ b/src/test/java/me/didit/resources/FraudChecksResourceTest.java @@ -0,0 +1,82 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.FraudCheckAttributesRequest; +import me.didit.types.FraudCheckContextRequest; +import me.didit.types.FraudCheckIdentifierRequest; +import me.didit.types.FraudCheckModuleSelectionRequest; +import me.didit.types.FraudCheckRequestRequest; +import me.didit.types.FraudCheckSubjectRequest; +import me.didit.types.FraudExcludeEnum; +import me.didit.types.FraudTypeEnum; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code fraud_checks}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class FraudChecksResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{\"attribute_evidence\":[],\"check_id\":\"value\",\"client_reference\":\"value\",\"completed_at\":\"2026-11-01T10:15:30Z\",\"compound_evidence\":[],\"coverage\":{},\"created_at\":\"2026-11-01T10:15:30Z\",\"decision_reasons\":[],\"inputs\":[],\"modules\":[],\"network\":{},\"next_action\":\"none\",\"processing_status\":\"pending\",\"profile_id\":\"value\",\"profile_version\":\"value\",\"recommendation\":\"approve\",\"risk\":[],\"usage\":[]}"); + transport.respondJson(200, example); + var result = client.fraudChecks().retrieve("00000000-0000-4000-8000-00000000ae2d"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/fraud/checks/00000000-0000-4000-8000-00000000ae2d/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void create() { + FraudCheckRequestRequest params = FraudCheckRequestRequest.builder().clientReference("value-client-reference").profile("value-profile").profileVersion("value-profile-version").subject(FraudCheckSubjectRequest.builder().selfie("value-selfie").identifiers(List.of(FraudCheckIdentifierRequest.builder().type(FraudTypeEnum.EMAIL).value("value-value").country("value-country").issuer("value-issuer").build())).attributes(FraudCheckAttributesRequest.builder().firstName("value-first-name").lastName("value-last-name").build()).build()).context(FraudCheckContextRequest.builder().ipAddress("value-ip-address").userAgent("value-user-agent").build()).checks(FraudCheckModuleSelectionRequest.builder().include(List.of(FraudExcludeEnum.NORMALIZATION)).exclude(List.of(FraudExcludeEnum.NORMALIZATION)).build()).vendorData("value-vendor-data").metadata("value").build(); + JsonNode example = TestJson.parse("{\"attribute_evidence\":[],\"check_id\":\"value\",\"client_reference\":\"value\",\"completed_at\":\"2026-11-01T10:15:30Z\",\"compound_evidence\":[],\"coverage\":{},\"created_at\":\"2026-11-01T10:15:30Z\",\"decision_reasons\":[],\"inputs\":[],\"modules\":[],\"network\":{},\"next_action\":\"none\",\"processing_status\":\"pending\",\"profile_id\":\"value\",\"profile_version\":\"value\",\"recommendation\":\"approve\",\"risk\":[],\"usage\":[]}"); + transport.respondJson(200, example); + var result = client.fraudChecks().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/fraud/checks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"client_reference\":\"value-client-reference\",\"profile\":\"value-profile\",\"profile_version\":\"value-profile-version\",\"subject\":{\"selfie\":\"value-selfie\",\"identifiers\":[{\"type\":\"email\",\"value\":\"value-value\",\"country\":\"value-country\",\"issuer\":\"value-issuer\"}],\"attributes\":{\"first_name\":\"value-first-name\",\"last_name\":\"value-last-name\"}},\"context\":{\"ip_address\":\"value-ip-address\",\"user_agent\":\"value-user-agent\"},\"checks\":{\"include\":[\"normalization\"],\"exclude\":[\"normalization\"]},\"vendor_data\":\"value-vendor-data\",\"metadata\":\"value\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void plan() { + FraudCheckRequestRequest params = FraudCheckRequestRequest.builder().clientReference("value-client-reference").profile("value-profile").profileVersion("value-profile-version").subject(FraudCheckSubjectRequest.builder().selfie("value-selfie").identifiers(List.of(FraudCheckIdentifierRequest.builder().type(FraudTypeEnum.EMAIL).value("value-value").country("value-country").issuer("value-issuer").build())).attributes(FraudCheckAttributesRequest.builder().firstName("value-first-name").lastName("value-last-name").build()).build()).context(FraudCheckContextRequest.builder().ipAddress("value-ip-address").userAgent("value-user-agent").build()).checks(FraudCheckModuleSelectionRequest.builder().include(List.of(FraudExcludeEnum.NORMALIZATION)).exclude(List.of(FraudExcludeEnum.NORMALIZATION)).build()).vendorData("value-vendor-data").metadata("value").build(); + JsonNode example = TestJson.parse("{\"can_afford\":true,\"currency\":\"value\",\"estimated_price\":\"value\",\"is_sandbox\":true,\"modules\":[],\"profile_id\":\"value\",\"profile_version\":\"value\"}"); + transport.respondJson(200, example); + var result = client.fraudChecks().plan(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/fraud/checks/plan/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"client_reference\":\"value-client-reference\",\"profile\":\"value-profile\",\"profile_version\":\"value-profile-version\",\"subject\":{\"selfie\":\"value-selfie\",\"identifiers\":[{\"type\":\"email\",\"value\":\"value-value\",\"country\":\"value-country\",\"issuer\":\"value-issuer\"}],\"attributes\":{\"first_name\":\"value-first-name\",\"last_name\":\"value-last-name\"}},\"context\":{\"ip_address\":\"value-ip-address\",\"user_agent\":\"value-user-agent\"},\"checks\":{\"include\":[\"normalization\"],\"exclude\":[\"normalization\"]},\"vendor_data\":\"value-vendor-data\",\"metadata\":\"value\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/IdVerificationResourceTest.java b/src/test/java/me/didit/resources/IdVerificationResourceTest.java new file mode 100644 index 0000000..135e91e --- /dev/null +++ b/src/test/java/me/didit/resources/IdVerificationResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.IdVerificationVerifyParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code id_verification}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class IdVerificationResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void verify() { + IdVerificationVerifyParams params = IdVerificationVerifyParams.builder().frontImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "front_image.pdf", "application/pdf")).frontImagePassword("value-front-image-password").backImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "back_image.pdf", "application/pdf")).backImagePassword("value-back-image-password").performDocumentLiveness(true).minimumAge(1L).expirationDateNotDetectedAction(IdVerificationVerifyParams.ExpirationDateNotDetectedAction.NO_ACTION).invalidMrzAction(IdVerificationVerifyParams.InvalidMrzAction.NO_ACTION).inconsistentDataAction(IdVerificationVerifyParams.InconsistentDataAction.NO_ACTION).criticalFieldOcclusionAction(IdVerificationVerifyParams.CriticalFieldOcclusionAction.NO_ACTION).documentOrPersonalNumberFormatMismatchAction(IdVerificationVerifyParams.DocumentOrPersonalNumberFormatMismatchAction.NO_ACTION).preferredCharacters(IdVerificationVerifyParams.PreferredCharacters.LATIN).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/", "200"); + transport.respondJson(200, example); + var result = client.idVerification().verify(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("front_image_password", List.of("value-front-image-password")), Map.entry("back_image_password", List.of("value-back-image-password")), Map.entry("perform_document_liveness", List.of("true")), Map.entry("minimum_age", List.of("1")), Map.entry("expiration_date_not_detected_action", List.of("NO_ACTION")), Map.entry("invalid_mrz_action", List.of("NO_ACTION")), Map.entry("inconsistent_data_action", List.of("NO_ACTION")), Map.entry("critical_field_occlusion_action", List.of("NO_ACTION")), Map.entry("document_or_personal_number_format_mismatch_action", List.of("NO_ACTION")), Map.entry("preferred_characters", List.of("latin")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("front_image", List.of("front_image.pdf")), Map.entry("back_image", List.of("back_image.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/IdWalletsResourceTest.java b/src/test/java/me/didit/resources/IdWalletsResourceTest.java new file mode 100644 index 0000000..a25a8b0 --- /dev/null +++ b/src/test/java/me/didit/resources/IdWalletsResourceTest.java @@ -0,0 +1,610 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.core.RequestOptions; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiAudkenniWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBankidCzWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBankidNoWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBankidSeWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiBuypassWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiConnectidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiCountry520Enum; +import me.didit.types.DigitalIdWalletApiCountryAfcEnum; +import me.didit.types.DigitalIdWalletApiCountryE2dEnum; +import me.didit.types.DigitalIdWalletApiCountryEe9Enum; +import me.didit.types.DigitalIdWalletApiDeviceEnum; +import me.didit.types.DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiDiiaWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiEudiWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiEudiWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiFranceconnectWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiFrejaidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiFtnWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiFtnWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiGovbrWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiGovukWalletWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiIdcardEeWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiIdinWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiIdinWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiItsmeWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiMitidWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiMitidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiMobileIdWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiMojeidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiOneidWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiSmartIdWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum; +import me.didit.types.DigitalIdWalletApiUaePassWalletVerificationStartRequest; +import me.didit.types.DigitalIdWalletApiVippsWalletVerificationStartRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code id_wallets}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class IdWalletsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + JsonNode example = TestJson.parse("{\"wallets\":[]}"); + transport.respondJson(200, example); + var result = client.idWallets().list(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/id-verification/wallets/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveVerification() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/id-verification/wallets/verifications/{request_id}/", "200"); + transport.respondJson(200, example); + var result = client.idWallets().retrieveVerification("00000000-0000-4000-8000-000000017767"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/id-verification/wallets/verifications/00000000-0000-4000-8000-000000017767/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void pollVerification() { + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/verifications/{request_id}/poll/", "200"); + transport.respondJson(200, example); + var result = client.idWallets().pollVerification("00000000-0000-4000-8000-00000001339b"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/verifications/00000000-0000-4000-8000-00000001339b/poll/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void cancelVerification() { + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/verifications/{request_id}/cancel/", "200"); + transport.respondJson(200, example); + var result = client.idWallets().cancelVerification("00000000-0000-4000-8000-000000015288"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/verifications/00000000-0000-4000-8000-000000015288/cancel/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startMitid() { + DigitalIdWalletApiMitidWalletVerificationStartRequest params = DigitalIdWalletApiMitidWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiMitidWalletVerificationStartCountryEnum.DNK).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/mitid/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startMitid(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/mitid/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"DNK\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startBankidSe() { + DigitalIdWalletApiBankidSeWalletVerificationStartRequest params = DigitalIdWalletApiBankidSeWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryEe9Enum.SWE).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/bankid-se/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startBankidSe(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/bankid-se/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"SWE\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startBankidNo() { + DigitalIdWalletApiBankidNoWalletVerificationStartRequest params = DigitalIdWalletApiBankidNoWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryAfcEnum.NOR).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/bankid-no/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startBankidNo(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/bankid-no/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"NOR\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startVipps() { + DigitalIdWalletApiVippsWalletVerificationStartRequest params = DigitalIdWalletApiVippsWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryAfcEnum.NOR).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/vipps/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startVipps(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/vipps/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"NOR\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startBuypass() { + DigitalIdWalletApiBuypassWalletVerificationStartRequest params = DigitalIdWalletApiBuypassWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryAfcEnum.NOR).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/buypass/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startBuypass(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/buypass/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"NOR\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startItsme() { + DigitalIdWalletApiItsmeWalletVerificationStartRequest params = DigitalIdWalletApiItsmeWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiItsmeWalletVerificationStartCountryEnum.BEL).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/itsme/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startItsme(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/itsme/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"BEL\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startIdin() { + DigitalIdWalletApiIdinWalletVerificationStartRequest params = DigitalIdWalletApiIdinWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiIdinWalletVerificationStartCountryEnum.NLD).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/idin/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startIdin(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/idin/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"NLD\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startFtn() { + DigitalIdWalletApiFtnWalletVerificationStartRequest params = DigitalIdWalletApiFtnWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiFtnWalletVerificationStartCountryEnum.FIN).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/ftn/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startFtn(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/ftn/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"FIN\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startPersonalausweis() { + DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest params = DigitalIdWalletApiPersonalausweisWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiPersonalausweisWalletVerificationStartCountryEnum.DEU).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/personalausweis/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startPersonalausweis(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/personalausweis/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"DEU\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startFrejaid() { + DigitalIdWalletApiFrejaidWalletVerificationStartRequest params = DigitalIdWalletApiFrejaidWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryEe9Enum.SWE).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/frejaid/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startFrejaid(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/frejaid/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"SWE\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startUaePass() { + DigitalIdWalletApiUaePassWalletVerificationStartRequest params = DigitalIdWalletApiUaePassWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiUaePassWalletVerificationStartCountryEnum.ARE).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/uae-pass/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startUaePass(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/uae-pass/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"ARE\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startGovbr() { + DigitalIdWalletApiGovbrWalletVerificationStartRequest params = DigitalIdWalletApiGovbrWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiGovbrWalletVerificationStartCountryEnum.BRA).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/govbr/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startGovbr(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/govbr/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"BRA\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startOneid() { + DigitalIdWalletApiOneidWalletVerificationStartRequest params = DigitalIdWalletApiOneidWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountry520Enum.GBR).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/oneid/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startOneid(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/oneid/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"GBR\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startGovukWallet() { + DigitalIdWalletApiGovukWalletWalletVerificationStartRequest params = DigitalIdWalletApiGovukWalletWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountry520Enum.GBR).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/govuk-wallet/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startGovukWallet(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/govuk-wallet/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"GBR\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startSmartId() { + DigitalIdWalletApiSmartIdWalletVerificationStartRequest params = DigitalIdWalletApiSmartIdWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiSmartIdWalletVerificationStartCountryEnum.EST).personalCode("value-personal-code").build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/smart-id/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startSmartId(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/smart-id/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"EST\",\"personal_code\":\"value-personal-code\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startMobileId() { + DigitalIdWalletApiMobileIdWalletVerificationStartRequest params = DigitalIdWalletApiMobileIdWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiMobileIdWalletVerificationStartCountryEnum.EST).personalCode("value-personal-code").phoneNumber("value-phone-number").build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/mobile-id/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startMobileId(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/mobile-id/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"EST\",\"personal_code\":\"value-personal-code\",\"phone_number\":\"value-phone-number\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startIdcardEe() { + DigitalIdWalletApiIdcardEeWalletVerificationStartRequest params = DigitalIdWalletApiIdcardEeWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiIdcardEeWalletVerificationStartCountryEnum.EST).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/idcard-ee/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startIdcardEe(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/idcard-ee/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"EST\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startEparakstsMobile() { + DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest params = DigitalIdWalletApiEparakstsMobileWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiEparakstsMobileWalletVerificationStartCountryEnum.LVA).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/eparaksts-mobile/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startEparakstsMobile(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/eparaksts-mobile/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"LVA\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startBankidCz() { + DigitalIdWalletApiBankidCzWalletVerificationStartRequest params = DigitalIdWalletApiBankidCzWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryE2dEnum.CZE).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/bankid-cz/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startBankidCz(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/bankid-cz/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"CZE\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startMojeid() { + DigitalIdWalletApiMojeidWalletVerificationStartRequest params = DigitalIdWalletApiMojeidWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiCountryE2dEnum.CZE).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/mojeid/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startMojeid(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/mojeid/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"CZE\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startDiia() { + DigitalIdWalletApiDiiaWalletVerificationStartRequest params = DigitalIdWalletApiDiiaWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiDiiaWalletVerificationStartCountryEnum.UKR).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/diia/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startDiia(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/diia/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"UKR\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startFranceconnect() { + DigitalIdWalletApiFranceconnectWalletVerificationStartRequest params = DigitalIdWalletApiFranceconnectWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiFranceconnectWalletVerificationStartCountryEnum.FRA).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/franceconnect/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startFranceconnect(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/franceconnect/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"FRA\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startAudkenni() { + DigitalIdWalletApiAudkenniWalletVerificationStartRequest params = DigitalIdWalletApiAudkenniWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiAudkenniWalletVerificationStartCountryEnum.ISL).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/audkenni/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startAudkenni(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/audkenni/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"ISL\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startConnectid() { + DigitalIdWalletApiConnectidWalletVerificationStartRequest params = DigitalIdWalletApiConnectidWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiConnectidWalletVerificationStartCountryEnum.AUS).authorisationServerId("value-authorisation-server-id").returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/connectid/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startConnectid(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/connectid/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"AUS\",\"authorisation_server_id\":\"value-authorisation-server-id\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void startEudi() { + DigitalIdWalletApiEudiWalletVerificationStartRequest params = DigitalIdWalletApiEudiWalletVerificationStartRequest.builder().vendorData("value-vendor-data").metadata(Map.of("key", "value")).sandboxScenario("value-sandbox-scenario").country(DigitalIdWalletApiEudiWalletVerificationStartCountryEnum.AUT).returnUrl("https://example.com/callback").device(DigitalIdWalletApiDeviceEnum.SAME_DEVICE).build(); + RequestOptions options = RequestOptions.builder().idempotencyKey("idem-1").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/id-verification/wallets/eudi/", "201"); + transport.respondJson(201, example); + var result = client.idWallets().startEudi(params, options); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/id-verification/wallets/eudi/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("idem-1", request.header("Idempotency-Key")); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"sandbox_scenario\":\"value-sandbox-scenario\",\"country\":\"AUT\",\"return_url\":\"https://example.com/callback\",\"device\":\"same_device\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/IpResourceTest.java b/src/test/java/me/didit/resources/IpResourceTest.java new file mode 100644 index 0000000..8ed7954 --- /dev/null +++ b/src/test/java/me/didit/resources/IpResourceTest.java @@ -0,0 +1,42 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.IPRiskRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code ip}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class IpResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void assessRisk() { + IPRiskRequest params = IPRiskRequest.builder().ipAddress("192.0.2.10").claimedCountry("value-claimed-country").userAgent("value-user-agent").vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/ip/risk/", "200"); + transport.respondJson(200, example); + var result = client.ip().assessRisk(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/ip/risk/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"ip_address\":\"192.0.2.10\",\"claimed_country\":\"value-claimed-country\",\"user_agent\":\"value-user-agent\",\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/KybResourceTest.java b/src/test/java/me/didit/resources/KybResourceTest.java new file mode 100644 index 0000000..3ff6dfb --- /dev/null +++ b/src/test/java/me/didit/resources/KybResourceTest.java @@ -0,0 +1,96 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.KybListShareholdersParams; +import me.didit.types.KybListUbosParams; +import me.didit.types.KybSearchParams; +import me.didit.types.KybSelectParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code kyb}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class KybResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void search() { + KybSearchParams params = KybSearchParams.builder().countryCode("value-country-code").name("value-name").registrationNumber("value-registration-number").searchType(KybSearchParams.SearchType.CONTAINS).vendorData("value-vendor-data").metadata(Map.of("key", "value")).webhookUrl("https://example.com/callback").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/kyb/search/", "200"); + transport.respondJson(200, example); + var result = client.kyb().search(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/kyb/search/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"country_code\":\"value-country-code\",\"name\":\"value-name\",\"registration_number\":\"value-registration-number\",\"search_type\":\"contains\",\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"webhook_url\":\"https://example.com/callback\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void select() { + KybSelectParams params = KybSelectParams.builder().kybResponseId("value-kyb-response-id").vendorData("value-vendor-data").metadata(Map.of("key", "value")).saveApiRequest(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/kyb/select/", "200"); + transport.respondJson(200, example); + var result = client.kyb().select(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/kyb/select/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"kyb_response_id\":\"value-kyb-response-id\",\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"save_api_request\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listShareholders() { + KybListShareholdersParams params = KybListShareholdersParams.builder().kybResponseId("value-kyb-response-id").vendorData("value-vendor-data").metadata(Map.of("key", "value")).saveApiRequest(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/kyb/shareholders/", "200"); + transport.respondJson(200, example); + var result = client.kyb().listShareholders(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/kyb/shareholders/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"kyb_response_id\":\"value-kyb-response-id\",\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"save_api_request\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listUbos() { + KybListUbosParams params = KybListUbosParams.builder().kybResponseId("value-kyb-response-id").vendorData("value-vendor-data").metadata(Map.of("key", "value")).saveApiRequest(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/kyb/ubo/", "200"); + transport.respondJson(200, example); + var result = client.kyb().listUbos(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/kyb/ubo/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"kyb_response_id\":\"value-kyb-response-id\",\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"save_api_request\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/NetworksNotesResourceTest.java b/src/test/java/me/didit/resources/NetworksNotesResourceTest.java new file mode 100644 index 0000000..148a5eb --- /dev/null +++ b/src/test/java/me/didit/resources/NetworksNotesResourceTest.java @@ -0,0 +1,74 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.NetworksNotesCreateParams; +import me.didit.types.NetworksNotesListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code networks.notes}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class NetworksNotesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void delete() { + transport.respond(204, ""); + client.networks().notes().delete("00000000-0000-4000-8000-00000000e81b", "00000000-0000-4000-8000-00000000bdfd"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000e81b/notes/00000000-0000-4000-8000-00000000bdfd/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } + + @Test + void list() { + NetworksNotesListParams params = NetworksNotesListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.networks().notes().list("00000000-0000-4000-8000-00000000cee1", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000cee1/notes/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + NetworksNotesCreateParams params = NetworksNotesCreateParams.builder().comment("value-comment").clientReference("00000000-0000-4000-8000-00000000378b").build(); + JsonNode example = TestJson.parse("{\"actor_email\":\"value\",\"client_reference\":\"value\",\"comment\":\"value\",\"created_at\":\"2026-11-01T10:15:30Z\",\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.networks().notes().create("00000000-0000-4000-8000-00000000e81e", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000e81e/notes/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"comment\":\"value-comment\",\"client_reference\":\"00000000-0000-4000-8000-00000000378b\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/NetworksResourceTest.java b/src/test/java/me/didit/resources/NetworksResourceTest.java new file mode 100644 index 0000000..123eae3 --- /dev/null +++ b/src/test/java/me/didit/resources/NetworksResourceTest.java @@ -0,0 +1,157 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.NetworksListParams; +import me.didit.types.NetworksRetrieveGraphParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code networks}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class NetworksResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + NetworksListParams params = NetworksListParams.builder().status("value-status").signalType("value-signal-type").patternType("value-pattern-type").riskBand("value-risk-band").minSize(1L).maxSize(1L).dateFrom(LocalDate.parse("2026-11-01")).dateTo(LocalDate.parse("2026-11-01")).q("value-q").ordering("value-ordering").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.networks().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/", request.path()); + assertEquals(Map.ofEntries(Map.entry("status", List.of("value-status")), Map.entry("signal_type", List.of("value-signal-type")), Map.entry("pattern_type", List.of("value-pattern-type")), Map.entry("risk_band", List.of("value-risk-band")), Map.entry("min_size", List.of("1")), Map.entry("max_size", List.of("1")), Map.entry("date_from", List.of("2026-11-01")), Map.entry("date_to", List.of("2026-11-01")), Map.entry("q", List.of("value-q")), Map.entry("ordering", List.of("value-ordering")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.networks().retrieve("00000000-0000-4000-8000-00000000b75b"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000b75b/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveGraph() { + NetworksRetrieveGraphParams params = NetworksRetrieveGraphParams.builder().depth(NetworksRetrieveGraphParams.Depth._1).focusKind(NetworksRetrieveGraphParams.FocusKind.VENDOR_USER).focusId("00000000-0000-4000-8000-000000000eb9").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.networks().retrieveGraph("00000000-0000-4000-8000-000000010843", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-000000010843/graph/", request.path()); + assertEquals(Map.ofEntries(Map.entry("depth", List.of("1")), Map.entry("focus_kind", List.of("vendor_user")), Map.entry("focus_id", List.of("00000000-0000-4000-8000-000000000eb9"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listMembers() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.networks().listMembers("00000000-0000-4000-8000-00000000ebf7"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000ebf7/members/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listSignals() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.networks().listSignals("00000000-0000-4000-8000-00000000ec3f"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000ec3f/signals/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveTimeline() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.networks().retrieveTimeline("00000000-0000-4000-8000-000000013724"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-000000013724/timeline/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveMap() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.networks().retrieveMap("00000000-0000-4000-8000-00000000eb64"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000000eb64/map/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void downloadReport() { + transport.respondBinary(200, "application/pdf", new byte[] {37, 80, 68, 70}); + var result = client.networks().downloadReport("00000000-0000-4000-8000-00000001194c"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/networks/00000000-0000-4000-8000-00000001194c/report/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("application/pdf, application/json", request.header("Accept")); + assertEquals(0, request.body().length); + assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes()); + } +} diff --git a/src/test/java/me/didit/resources/PassiveLivenessResourceTest.java b/src/test/java/me/didit/resources/PassiveLivenessResourceTest.java new file mode 100644 index 0000000..051a5b4 --- /dev/null +++ b/src/test/java/me/didit/resources/PassiveLivenessResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.PassiveLivenessCheckParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code passive_liveness}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class PassiveLivenessResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void check() { + PassiveLivenessCheckParams params = PassiveLivenessCheckParams.builder().userImage(FileUpload.of(new byte[] {37, 80, 68, 70}, "user_image.pdf", "application/pdf")).faceLivenessScoreDeclineThreshold(1.5).rotateImage(true).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/passive-liveness/", "200"); + transport.respondJson(200, example); + var result = client.passiveLiveness().check(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/passive-liveness/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("face_liveness_score_decline_threshold", List.of("1.5")), Map.entry("rotate_image", List.of("true")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("user_image", List.of("user_image.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/PhoneResourceTest.java b/src/test/java/me/didit/resources/PhoneResourceTest.java new file mode 100644 index 0000000..809f0c7 --- /dev/null +++ b/src/test/java/me/didit/resources/PhoneResourceTest.java @@ -0,0 +1,79 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.PhoneCheckCodeParams; +import me.didit.types.PhoneRiskRequest; +import me.didit.types.PhoneSendCodeParams; +import me.didit.types.RiskSignals; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code phone}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class PhoneResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void assessRisk() { + PhoneRiskRequest params = PhoneRiskRequest.builder().phoneNumber("value-phone-number").countryCode("value-country-code").signals(RiskSignals.builder().ip("192.0.2.10").deviceId("value-device-id").build()).vendorData("value-vendor-data").metadata(Map.of("key", "value")).enableSocial(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/phone/risk/", "200"); + transport.respondJson(200, example); + var result = client.phone().assessRisk(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/phone/risk/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"phone_number\":\"value-phone-number\",\"country_code\":\"value-country-code\",\"signals\":{\"ip\":\"192.0.2.10\",\"device_id\":\"value-device-id\"},\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"},\"enable_social\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void sendCode() { + PhoneSendCodeParams params = PhoneSendCodeParams.builder().phoneNumber("value-phone-number").options(PhoneSendCodeParams.Options.builder().codeSize(1L).locale("value-locale").build()).signals(PhoneSendCodeParams.Signals.builder().ip("value-ip").deviceId("value-device-id").build()).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/phone/send/", "200"); + transport.respondJson(200, example); + var result = client.phone().sendCode(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/phone/send/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"phone_number\":\"value-phone-number\",\"options\":{\"code_size\":1,\"locale\":\"value-locale\"},\"signals\":{\"ip\":\"value-ip\",\"device_id\":\"value-device-id\"},\"vendor_data\":\"value-vendor-data\",\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void checkCode() { + PhoneCheckCodeParams params = PhoneCheckCodeParams.builder().phoneNumber("value-phone-number").code("value-code").duplicatedPhoneNumberAction(PhoneCheckCodeParams.DuplicatedPhoneNumberAction.NO_ACTION).disposableNumberAction(PhoneCheckCodeParams.DisposableNumberAction.NO_ACTION).voipNumberAction(PhoneCheckCodeParams.VoipNumberAction.NO_ACTION).enableSocial(true).phoneNoSocialPresenceAction(PhoneCheckCodeParams.PhoneNoSocialPresenceAction.NO_ACTION).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/phone/check/", "200"); + transport.respondJson(200, example); + var result = client.phone().checkCode(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/phone/check/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"phone_number\":\"value-phone-number\",\"code\":\"value-code\",\"duplicated_phone_number_action\":\"NO_ACTION\",\"disposable_number_action\":\"NO_ACTION\",\"voip_number_action\":\"NO_ACTION\",\"enable_social\":true,\"phone_no_social_presence_action\":\"NO_ACTION\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/ProofOfAddressResourceTest.java b/src/test/java/me/didit/resources/ProofOfAddressResourceTest.java new file mode 100644 index 0000000..a6e90f6 --- /dev/null +++ b/src/test/java/me/didit/resources/ProofOfAddressResourceTest.java @@ -0,0 +1,44 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.ProofOfAddressVerifyParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code proof_of_address}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class ProofOfAddressResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void verify() { + ProofOfAddressVerifyParams params = ProofOfAddressVerifyParams.builder().document(FileUpload.of(new byte[] {37, 80, 68, 70}, "document.pdf", "application/pdf")).documentPassword("value-document-password").expectedAddress("value-expected-address").expectedCountry("value-expected-country").expectedFirstName("value-expected-first-name").expectedLastName("value-expected-last-name").poaLanguagesAllowed("value-poa-languages-allowed").poaDocumentAgeMonths("value-poa-document-age-months").poaNameMismatchAction(ProofOfAddressVerifyParams.PoaNameMismatchAction.DECLINE).poaDocumentIssuesAction(ProofOfAddressVerifyParams.PoaDocumentIssuesAction.DECLINE).poaDocumentAuthenticityAction(ProofOfAddressVerifyParams.PoaDocumentAuthenticityAction.DECLINE).poaUnsupportedLanguageAction(ProofOfAddressVerifyParams.PoaUnsupportedLanguageAction.DECLINE).poaAddressMismatchAction(ProofOfAddressVerifyParams.PoaAddressMismatchAction.DECLINE).poaIssuerNotIdentifiedAction(ProofOfAddressVerifyParams.PoaIssuerNotIdentifiedAction.DECLINE).saveApiRequest(true).vendorData("value-vendor-data").metadata(Map.of("key", "value")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/poa/", "200"); + transport.respondJson(200, example); + var result = client.proofOfAddress().verify(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/poa/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("document_password", List.of("value-document-password")), Map.entry("expected_address", List.of("value-expected-address")), Map.entry("expected_country", List.of("value-expected-country")), Map.entry("expected_first_name", List.of("value-expected-first-name")), Map.entry("expected_last_name", List.of("value-expected-last-name")), Map.entry("poa_languages_allowed", List.of("value-poa-languages-allowed")), Map.entry("poa_document_age_months", List.of("value-poa-document-age-months")), Map.entry("poa_name_mismatch_action", List.of("DECLINE")), Map.entry("poa_document_issues_action", List.of("DECLINE")), Map.entry("poa_document_authenticity_action", List.of("DECLINE")), Map.entry("poa_unsupported_language_action", List.of("DECLINE")), Map.entry("poa_address_mismatch_action", List.of("DECLINE")), Map.entry("poa_issuer_not_identified_action", List.of("DECLINE")), Map.entry("save_api_request", List.of("true")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("metadata", List.of("{\"key\":\"value\"}"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("document", List.of("document.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/QuestionnairesResourceTest.java b/src/test/java/me/didit/resources/QuestionnairesResourceTest.java new file mode 100644 index 0000000..7e33503 --- /dev/null +++ b/src/test/java/me/didit/resources/QuestionnairesResourceTest.java @@ -0,0 +1,109 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.QuestionnairesListParams; +import me.didit.types.SimpleQuestionnaireElement; +import me.didit.types.SimpleQuestionnaireRequest; +import me.didit.types.SimpleQuestionnaireUpdateRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code questionnaires}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class QuestionnairesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + QuestionnairesListParams params = QuestionnairesListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/questionnaires/", "200"); + transport.respondJson(200, example); + var result = client.questionnaires().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/questionnaires/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + SimpleQuestionnaireRequest params = SimpleQuestionnaireRequest.builder().title("value-title").description("value-description").languages(List.of("value-languages")).defaultLanguage("value-default-language").isActive(true).status(SimpleQuestionnaireRequest.Status.DRAFT).formElements(List.of(SimpleQuestionnaireElement.builder().id("value-id").elementType(SimpleQuestionnaireElement.ElementType.SHORT_TEXT).label(Map.of("key", "value-label")).description(Map.of("key", "value-description")).build())).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/questionnaires/", "201"); + transport.respondJson(201, example); + var result = client.questionnaires().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/questionnaires/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"title\":\"value-title\",\"description\":\"value-description\",\"languages\":[\"value-languages\"],\"default_language\":\"value-default-language\",\"is_active\":true,\"status\":\"draft\",\"form_elements\":[{\"id\":\"value-id\",\"element_type\":\"short_text\",\"label\":{\"key\":\"value-label\"},\"description\":{\"key\":\"value-description\"}}]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/questionnaires/{questionnaire_uuid}/", "200"); + transport.respondJson(200, example); + var result = client.questionnaires().retrieve("00000000-0000-4000-8000-0000000167f6"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/questionnaires/00000000-0000-4000-8000-0000000167f6/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + SimpleQuestionnaireUpdateRequest params = SimpleQuestionnaireUpdateRequest.builder().title("value-title").description("value-description").languages(List.of("value-languages")).defaultLanguage("value-default-language").isActive(true).status(SimpleQuestionnaireUpdateRequest.Status.DRAFT).formElements(List.of(SimpleQuestionnaireElement.builder().id("value-id").elementType(SimpleQuestionnaireElement.ElementType.SHORT_TEXT).label(Map.of("key", "value-label")).description(Map.of("key", "value-description")).build())).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.questionnaires().update("00000000-0000-4000-8000-0000000144e9", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/questionnaires/00000000-0000-4000-8000-0000000144e9/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"title\":\"value-title\",\"description\":\"value-description\",\"languages\":[\"value-languages\"],\"default_language\":\"value-default-language\",\"is_active\":true,\"status\":\"draft\",\"form_elements\":[{\"id\":\"value-id\",\"element_type\":\"short_text\",\"label\":{\"key\":\"value-label\"},\"description\":{\"key\":\"value-description\"}}]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.questionnaires().delete("00000000-0000-4000-8000-0000000143fa"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/questionnaires/00000000-0000-4000-8000-0000000143fa/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } +} diff --git a/src/test/java/me/didit/resources/RegulatoryReportsResourceTest.java b/src/test/java/me/didit/resources/RegulatoryReportsResourceTest.java new file mode 100644 index 0000000..b84d94e --- /dev/null +++ b/src/test/java/me/didit/resources/RegulatoryReportsResourceTest.java @@ -0,0 +1,159 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.RegulatoryReportsCreateParams; +import me.didit.types.RegulatoryReportsListParams; +import me.didit.types.RegulatoryReportsRetrieveDownloadUrlParams; +import me.didit.types.RegulatoryReportsUpdateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code regulatory_reports}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class RegulatoryReportsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + RegulatoryReportsListParams params = RegulatoryReportsListParams.builder().limit(1L).offset(1L).status(RegulatoryReportsListParams.Status.DRAFT).reportType(RegulatoryReportsListParams.ReportType.SAR).case_("00000000-0000-4000-8000-000000000412").build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.regulatoryReports().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1")), Map.entry("status", List.of("DRAFT")), Map.entry("report_type", List.of("SAR")), Map.entry("case", List.of("00000000-0000-4000-8000-000000000412"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + RegulatoryReportsCreateParams params = RegulatoryReportsCreateParams.builder().case_("00000000-0000-4000-8000-000000000412").template("00000000-0000-4000-8000-000000000efb").reportType(RegulatoryReportsCreateParams.ReportType.SAR).jurisdiction("value-jurisdiction").transactions(List.of("00000000-0000-4000-8000-000000002132")).rentityId("value-rentity-id").rentityBranch("value-rentity-branch").submissionCode(RegulatoryReportsCreateParams.SubmissionCode.E).entityReference("value-entity-reference").fiuRefNumber("value-fiu-ref-number").currencyCodeLocal("value-currency-code-local").submissionDate(OffsetDateTime.parse("2026-11-01T10:15:30Z")).reportingPerson(Map.of("key", "value")).location(Map.of("key", "value")).reason("value-reason").action("value-action").activity("value-activity").narrative(RegulatoryReportsCreateParams.Narrative.builder().who("value-who").what("value-what").build()).reportIndicators(List.of("value-report-indicators")).includedFields(List.of("value-included-fields")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.regulatoryReports().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"case\":\"00000000-0000-4000-8000-000000000412\",\"template\":\"00000000-0000-4000-8000-000000000efb\",\"report_type\":\"SAR\",\"jurisdiction\":\"value-jurisdiction\",\"transactions\":[\"00000000-0000-4000-8000-000000002132\"],\"rentity_id\":\"value-rentity-id\",\"rentity_branch\":\"value-rentity-branch\",\"submission_code\":\"E\",\"entity_reference\":\"value-entity-reference\",\"fiu_ref_number\":\"value-fiu-ref-number\",\"currency_code_local\":\"value-currency-code-local\",\"submission_date\":\"2026-11-01T10:15:30Z\",\"reporting_person\":{\"key\":\"value\"},\"location\":{\"key\":\"value\"},\"reason\":\"value-reason\",\"action\":\"value-action\",\"activity\":\"value-activity\",\"narrative\":{\"who\":\"value-who\",\"what\":\"value-what\"},\"report_indicators\":[\"value-report-indicators\"],\"included_fields\":[\"value-included-fields\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.regulatoryReports().retrieve("00000000-0000-4000-8000-00000001380d"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/00000000-0000-4000-8000-00000001380d/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + RegulatoryReportsUpdateParams params = RegulatoryReportsUpdateParams.builder().jurisdiction("value-jurisdiction").rentityId("value-rentity-id").rentityBranch("value-rentity-branch").submissionCode(RegulatoryReportsUpdateParams.SubmissionCode.E).entityReference("value-entity-reference").fiuRefNumber("value-fiu-ref-number").currencyCodeLocal("value-currency-code-local").submissionDate(OffsetDateTime.parse("2026-11-01T10:15:30Z")).reportingPerson(Map.of("key", "value")).location(Map.of("key", "value")).reason("value-reason").action("value-action").activity("value-activity").narrative(RegulatoryReportsUpdateParams.Narrative.builder().who("value-who").what("value-what").build()).reportIndicators(List.of("value-report-indicators")).includedFields(List.of("value-included-fields")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.regulatoryReports().update("00000000-0000-4000-8000-00000001174a", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/00000000-0000-4000-8000-00000001174a/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"jurisdiction\":\"value-jurisdiction\",\"rentity_id\":\"value-rentity-id\",\"rentity_branch\":\"value-rentity-branch\",\"submission_code\":\"E\",\"entity_reference\":\"value-entity-reference\",\"fiu_ref_number\":\"value-fiu-ref-number\",\"currency_code_local\":\"value-currency-code-local\",\"submission_date\":\"2026-11-01T10:15:30Z\",\"reporting_person\":{\"key\":\"value\"},\"location\":{\"key\":\"value\"},\"reason\":\"value-reason\",\"action\":\"value-action\",\"activity\":\"value-activity\",\"narrative\":{\"who\":\"value-who\",\"what\":\"value-what\"},\"report_indicators\":[\"value-report-indicators\"],\"included_fields\":[\"value-included-fields\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.regulatoryReports().delete("00000000-0000-4000-8000-00000001161b"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/00000000-0000-4000-8000-00000001161b/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } + + @Test + void validate() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.regulatoryReports().validate("00000000-0000-4000-8000-00000001357a"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/00000000-0000-4000-8000-00000001357a/validate/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void finalize_() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.regulatoryReports().finalize_("00000000-0000-4000-8000-00000001367a"); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/00000000-0000-4000-8000-00000001367a/finalize/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveDownloadUrl() { + RegulatoryReportsRetrieveDownloadUrlParams params = RegulatoryReportsRetrieveDownloadUrlParams.builder().file(RegulatoryReportsRetrieveDownloadUrlParams.File.PDF).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.regulatoryReports().retrieveDownloadUrl("00000000-0000-4000-8000-000000022d4e", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/regulatory-reports/00000000-0000-4000-8000-000000022d4e/download-url/", request.path()); + assertEquals(Map.ofEntries(Map.entry("file", List.of("pdf"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/ReportTemplatesResourceTest.java b/src/test/java/me/didit/resources/ReportTemplatesResourceTest.java new file mode 100644 index 0000000..86c6304 --- /dev/null +++ b/src/test/java/me/didit/resources/ReportTemplatesResourceTest.java @@ -0,0 +1,108 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.ReportTemplatesCreateParams; +import me.didit.types.ReportTemplatesListParams; +import me.didit.types.ReportTemplatesUpdateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code report_templates}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class ReportTemplatesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + ReportTemplatesListParams params = ReportTemplatesListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.reportTemplates().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/report-templates/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + ReportTemplatesCreateParams params = ReportTemplatesCreateParams.builder().name("value-name").jurisdiction("value-jurisdiction").reportType(ReportTemplatesCreateParams.ReportType.SAR).fieldConfig(Map.of("key", "value")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.reportTemplates().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/report-templates/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"jurisdiction\":\"value-jurisdiction\",\"report_type\":\"SAR\",\"field_config\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.reportTemplates().retrieve("00000000-0000-4000-8000-000000013390"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/report-templates/00000000-0000-4000-8000-000000013390/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + ReportTemplatesUpdateParams params = ReportTemplatesUpdateParams.builder().name("value-name").jurisdiction("value-jurisdiction").reportType(ReportTemplatesUpdateParams.ReportType.SAR).fieldConfig(Map.of("key", "value")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.reportTemplates().update("00000000-0000-4000-8000-000000011313", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/report-templates/00000000-0000-4000-8000-000000011313/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"name\":\"value-name\",\"jurisdiction\":\"value-jurisdiction\",\"report_type\":\"SAR\",\"field_config\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.reportTemplates().delete("00000000-0000-4000-8000-000000011204"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/report-templates/00000000-0000-4000-8000-000000011204/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } +} diff --git a/src/test/java/me/didit/resources/SessionsImportsResourceTest.java b/src/test/java/me/didit/resources/SessionsImportsResourceTest.java new file mode 100644 index 0000000..02dd3b1 --- /dev/null +++ b/src/test/java/me/didit/resources/SessionsImportsResourceTest.java @@ -0,0 +1,96 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.FileUpload; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.SessionsImportsCreateParams; +import me.didit.types.SessionsImportsListErrorsParams; +import me.didit.types.SessionsImportsRetrieveTemplateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code sessions.imports}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class SessionsImportsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void create() { + SessionsImportsCreateParams params = SessionsImportsCreateParams.builder().importType(SessionsImportsCreateParams.ImportType.USER_VERIFICATION).workflowId("00000000-0000-4000-8000-000000001b5b").sourceFormat(SessionsImportsCreateParams.SourceFormat.CSV).file(FileUpload.of(new byte[] {37, 80, 68, 70}, "file.pdf", "application/pdf")).sourceFileUrl("https://example.com/callback").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/session/imports/", "201"); + transport.respondJson(201, example); + var result = client.sessions().imports().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/session/imports/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(Map.ofEntries(Map.entry("import_type", List.of("user_verification")), Map.entry("workflow_id", List.of("00000000-0000-4000-8000-000000001b5b")), Map.entry("source_format", List.of("csv")), Map.entry("source_file_url", List.of("https://example.com/callback"))), request.multipartFields()); + assertEquals(Map.ofEntries(Map.entry("file", List.of("file.pdf"))), request.multipartFiles()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveTemplate() { + SessionsImportsRetrieveTemplateParams params = SessionsImportsRetrieveTemplateParams.builder().importType(SessionsImportsRetrieveTemplateParams.ImportType.USER_VERIFICATION).build(); + transport.respondBinary(200, "text/csv", new byte[] {37, 80, 68, 70}); + var result = client.sessions().imports().retrieveTemplate(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/session/imports/template/", request.path()); + assertEquals(Map.ofEntries(Map.entry("import_type", List.of("user_verification"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("text/csv, application/json", request.header("Accept")); + assertEquals(0, request.body().length); + assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes()); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{\"created_count\":1,\"failed_count\":1,\"import_type\":\"user_verification\",\"processed_rows\":1,\"skipped_count\":1,\"source_filename\":\"value\",\"source_format\":\"csv\",\"status\":\"PENDING\",\"total_rows\":1,\"updated_count\":1,\"uuid\":\"value\"}"); + transport.respondJson(200, example); + var result = client.sessions().imports().retrieve("00000000-0000-4000-8000-00000000e58e"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/session/imports/00000000-0000-4000-8000-00000000e58e/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listErrors() { + SessionsImportsListErrorsParams params = SessionsImportsListErrorsParams.builder().limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/session/imports/{importId}/errors/", "200"); + transport.respondJson(200, example); + var result = client.sessions().imports().listErrors("00000000-0000-4000-8000-000000011345", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/session/imports/00000000-0000-4000-8000-000000011345/errors/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } +} diff --git a/src/test/java/me/didit/resources/SessionsResourceTest.java b/src/test/java/me/didit/resources/SessionsResourceTest.java new file mode 100644 index 0000000..2b34731 --- /dev/null +++ b/src/test/java/me/didit/resources/SessionsResourceTest.java @@ -0,0 +1,360 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.SessionsBatchDeleteParams; +import me.didit.types.SessionsBulkUpdateAmlHitStatusParams; +import me.didit.types.SessionsCreateParams; +import me.didit.types.SessionsDeleteParams; +import me.didit.types.SessionsImportSharedParams; +import me.didit.types.SessionsListParams; +import me.didit.types.SessionsPreviewResubmissionParams; +import me.didit.types.SessionsRetrieveDecisionParams; +import me.didit.types.SessionsShareParams; +import me.didit.types.SessionsUpdateAmlHitStatusParams; +import me.didit.types.SessionsUpdateDataParams; +import me.didit.types.SessionsUpdateFeatureStatusParams; +import me.didit.types.SessionsUpdateKybCompanyDataParams; +import me.didit.types.SessionsUpdateKybPartyParams; +import me.didit.types.SessionsUpdatePoaDataParams; +import me.didit.types.SessionsUpdateStatusParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code sessions}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class SessionsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void create() { + SessionsCreateParams params = SessionsCreateParams.builder().workflowId("00000000-0000-4000-8000-000000001b5b").vendorData("value-vendor-data").callback("value-callback").callbackMethod(SessionsCreateParams.CallbackMethod.INITIATOR).metadata("value").language(SessionsCreateParams.Language.EN).contactDetails(SessionsCreateParams.ContactDetails.builder().email("user@example.com").sendNotificationEmails(true).build()).expectedDetails(SessionsCreateParams.ExpectedDetails.builder().firstName("value-first-name").lastName("value-last-name").build()).portraitImage("value-portrait-image").sandboxScenario("value-sandbox-scenario").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/session/", "201"); + transport.respondJson(201, example); + var result = client.sessions().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/session/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"workflow_id\":\"00000000-0000-4000-8000-000000001b5b\",\"vendor_data\":\"value-vendor-data\",\"callback\":\"value-callback\",\"callback_method\":\"initiator\",\"metadata\":\"value\",\"language\":\"en\",\"contact_details\":{\"email\":\"user@example.com\",\"send_notification_emails\":true},\"expected_details\":{\"first_name\":\"value-first-name\",\"last_name\":\"value-last-name\"},\"portrait_image\":\"value-portrait-image\",\"sandbox_scenario\":\"value-sandbox-scenario\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieveDecision() { + SessionsRetrieveDecisionParams params = SessionsRetrieveDecisionParams.builder().include(SessionsRetrieveDecisionParams.Include.EVENTS).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/session/{sessionId}/decision/", "200"); + transport.respondJson(200, example); + var result = client.sessions().retrieveDecision("00000000-0000-4000-8000-000000010228", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-000000010228/decision/", request.path()); + assertEquals(Map.ofEntries(Map.entry("include", List.of("events"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + SessionsDeleteParams params = SessionsDeleteParams.builder().retainFaceEmbeddings(true).faceRetentionDays(1L).faceRetentionDeadline(OffsetDateTime.parse("2026-11-01T10:15:30Z")).deletionInstruction(SessionsDeleteParams.DeletionInstruction.OPERATIONAL_SESSION_DELETE).instructionId("value-instruction-id").build(); + JsonNode example = SpecExamples.response("verification.json", "DELETE", "/v3/session/{sessionId}/delete/", "200"); + transport.respondJson(200, example); + var result = client.sessions().delete("00000000-0000-4000-8000-00000000792a", params); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000000792a/delete/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"retain_face_embeddings\":true,\"face_retention_days\":1,\"face_retention_deadline\":\"2026-11-01T10:15:30Z\",\"deletion_instruction\":\"operational_session_delete\",\"instruction_id\":\"value-instruction-id\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void generatePdf() { + transport.respondBinary(200, "application/pdf", new byte[] {37, 80, 68, 70}); + var result = client.sessions().generatePdf("00000000-0000-4000-8000-00000000bc4f"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000000bc4f/generate-pdf/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("application/pdf, application/json", request.header("Accept")); + assertEquals(0, request.body().length); + assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes()); + } + + @Test + void updateStatus() { + SessionsUpdateStatusParams params = SessionsUpdateStatusParams.builder().newStatus(SessionsUpdateStatusParams.NewStatus.APPROVED).comment("value-comment").nodesToResubmit(List.of(SessionsUpdateStatusParams.NodesToResubmit.builder().nodeId("value-node-id").feature(SessionsUpdateStatusParams.NodesToResubmit.Feature.OCR).build())).sendEmail(true).emailAddress("user@example.com").emailLanguage("value-email-language").emailPreviewToken("value-email-preview-token").build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/update-status/", "200"); + transport.respondJson(200, example); + var result = client.sessions().updateStatus("00000000-0000-4000-8000-00000000cd09", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000000cd09/update-status/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"new_status\":\"Approved\",\"comment\":\"value-comment\",\"nodes_to_resubmit\":[{\"node_id\":\"value-node-id\",\"feature\":\"OCR\"}],\"send_email\":true,\"email_address\":\"user@example.com\",\"email_language\":\"value-email-language\",\"email_preview_token\":\"value-email-preview-token\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void list() { + SessionsListParams params = SessionsListParams.builder().sessionKind(SessionsListParams.SessionKind.USER).limit(1L).offset(1L).status("value-status").vendorData("value-vendor-data").search("value-search").workflowId("value-workflow-id").dateFrom(LocalDate.parse("2026-11-01")).dateTo(LocalDate.parse("2026-11-01")).country("value-country").documentType("value-document-type").documentName("value-document-name").region("value-region").diditInternalId("00000000-0000-4000-8000-000000003e81").sessionType("value-session-type").apiService(SessionsListParams.ApiService.ID_VERIFICATION).screenedFullName("value-screened-full-name").warning("value-warning").statusInitializedAsInReview(true).isKycToBeReviewed(true).euuid("00000000-0000-4000-8000-000000000646").organizationName("value-organization-name").build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/sessions/", "200"); + transport.respondJson(200, example); + var result = client.sessions().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/sessions/", request.path()); + assertEquals(Map.ofEntries(Map.entry("session_kind", List.of("user")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1")), Map.entry("status", List.of("value-status")), Map.entry("vendor_data", List.of("value-vendor-data")), Map.entry("search", List.of("value-search")), Map.entry("workflow_id", List.of("value-workflow-id")), Map.entry("date_from", List.of("2026-11-01")), Map.entry("date_to", List.of("2026-11-01")), Map.entry("country", List.of("value-country")), Map.entry("document_type", List.of("value-document-type")), Map.entry("document_name", List.of("value-document-name")), Map.entry("region", List.of("value-region")), Map.entry("didit_internal_id", List.of("00000000-0000-4000-8000-000000003e81")), Map.entry("session_type", List.of("value-session-type")), Map.entry("api_service", List.of("ID_VERIFICATION")), Map.entry("screened_full_name", List.of("value-screened-full-name")), Map.entry("warning", List.of("value-warning")), Map.entry("status_initialized_as_in_review", List.of("true")), Map.entry("is_kyc_to_be_reviewed", List.of("true")), Map.entry("euuid", List.of("00000000-0000-4000-8000-000000000646")), Map.entry("organization_name", List.of("value-organization-name"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void share() { + SessionsShareParams params = SessionsShareParams.builder().forApplicationId("00000000-0000-4000-8000-0000000045ff").ttlInSeconds(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/session/{sessionId}/share/", "200"); + transport.respondJson(200, example); + var result = client.sessions().share("00000000-0000-4000-8000-000000006f98", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-000000006f98/share/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"for_application_id\":\"00000000-0000-4000-8000-0000000045ff\",\"ttl_in_seconds\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void importShared() { + SessionsImportSharedParams params = SessionsImportSharedParams.builder().shareToken("value-share-token").trustReview(true).workflowId("00000000-0000-4000-8000-000000001b5b").vendorData("value-vendor-data").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/session/import-shared/", "201"); + transport.respondJson(201, example); + var result = client.sessions().importShared(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/session/import-shared/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"share_token\":\"value-share-token\",\"trust_review\":true,\"workflow_id\":\"00000000-0000-4000-8000-000000001b5b\",\"vendor_data\":\"value-vendor-data\"}", request.body()); + TestJson.assertJsonEquals(example, result); + } + + @Test + void batchDelete() { + SessionsBatchDeleteParams params = SessionsBatchDeleteParams.builder().sessionNumbers(List.of("value-session-numbers")).deleteAll(true).retainFaceEmbeddings(true).faceRetentionDays(1L).faceRetentionDeadline(OffsetDateTime.parse("2026-11-01T10:15:30Z")).deletionInstruction(SessionsBatchDeleteParams.DeletionInstruction.OPERATIONAL_SESSION_DELETE).instructionId("value-instruction-id").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/sessions/delete/", "200"); + transport.respondJson(200, example); + var result = client.sessions().batchDelete(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/sessions/delete/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"session_numbers\":[\"value-session-numbers\"],\"delete_all\":true,\"retain_face_embeddings\":true,\"face_retention_days\":1,\"face_retention_deadline\":\"2026-11-01T10:15:30Z\",\"deletion_instruction\":\"operational_session_delete\",\"instruction_id\":\"value-instruction-id\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void retrieveDeletionJob() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/sessions/delete/{job_id}/", "200"); + transport.respondJson(200, example); + var result = client.sessions().retrieveDeletionJob("00000000-0000-4000-8000-000000010ee0"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/sessions/delete/00000000-0000-4000-8000-000000010ee0/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateData() { + SessionsUpdateDataParams params = SessionsUpdateDataParams.builder().nodeId("value-node-id").documentType(SessionsUpdateDataParams.DocumentType.P).documentSubtype("value-document-subtype").documentNumber("value-document-number").personalNumber("value-personal-number").dateOfBirth(LocalDate.parse("2026-11-01")).dateOfIssue(LocalDate.parse("2026-11-01")).expirationDate(LocalDate.parse("2026-11-01")).issuingState("value-issuing-state").firstName("value-first-name").lastName("value-last-name").gender(SessionsUpdateDataParams.Gender.M).address("value-address").placeOfBirth("value-place-of-birth").nationality("value-nationality").maritalStatus(SessionsUpdateDataParams.MaritalStatus.SINGLE).extraFields(Map.of("key", "value")).parsedAddress(SessionsUpdateDataParams.ParsedAddress.builder().addressType("value-address-type").city("value-city").build()).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/update-data/", "200"); + transport.respondJson(200, example); + var result = client.sessions().updateData("00000000-0000-4000-8000-00000000afc4", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000000afc4/update-data/", request.path()); + assertEquals(Map.ofEntries(Map.entry("node_id", List.of("value-node-id"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"document_type\":\"P\",\"document_subtype\":\"value-document-subtype\",\"document_number\":\"value-document-number\",\"personal_number\":\"value-personal-number\",\"date_of_birth\":\"2026-11-01\",\"date_of_issue\":\"2026-11-01\",\"expiration_date\":\"2026-11-01\",\"issuing_state\":\"value-issuing-state\",\"first_name\":\"value-first-name\",\"last_name\":\"value-last-name\",\"gender\":\"M\",\"address\":\"value-address\",\"place_of_birth\":\"value-place-of-birth\",\"nationality\":\"value-nationality\",\"marital_status\":\"SINGLE\",\"extra_fields\":{\"key\":\"value\"},\"parsed_address\":{\"address_type\":\"value-address-type\",\"city\":\"value-city\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateFeatureStatus() { + SessionsUpdateFeatureStatusParams params = SessionsUpdateFeatureStatusParams.builder().newStatus(SessionsUpdateFeatureStatusParams.NewStatus.APPROVED).comment("value-comment").build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/features/{nodeId}/update-status/", "200"); + transport.respondJson(200, example); + var result = client.sessions().updateFeatureStatus("00000000-0000-4000-8000-000000014334", "00000000-0000-4000-8000-00000001102a", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-000000014334/features/00000000-0000-4000-8000-00000001102a/update-status/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"new_status\":\"Approved\",\"comment\":\"value-comment\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateAmlHitStatus() { + SessionsUpdateAmlHitStatusParams params = SessionsUpdateAmlHitStatusParams.builder().nodeIdQuery("value-node-id-query").hitId("value-hit-id").reviewStatus(SessionsUpdateAmlHitStatusParams.ReviewStatus.UNREVIEWED).nodeId("value-node-id").build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/update-aml-hit-status/", "200"); + transport.respondJson(200, example); + var result = client.sessions().updateAmlHitStatus("00000000-0000-4000-8000-00000001421e", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000001421e/update-aml-hit-status/", request.path()); + assertEquals(Map.ofEntries(Map.entry("node_id", List.of("value-node-id-query"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"hit_id\":\"value-hit-id\",\"review_status\":\"Unreviewed\",\"node_id\":\"value-node-id\"}", request.body()); + TestJson.assertJsonEquals(example, result); + } + + @Test + void bulkUpdateAmlHitStatus() { + SessionsBulkUpdateAmlHitStatusParams params = SessionsBulkUpdateAmlHitStatusParams.builder().nodeIdQuery("value-node-id-query").hitUpdates(List.of(SessionsBulkUpdateAmlHitStatusParams.HitUpdates.builder().hitId("value-hit-id").reviewStatus(SessionsBulkUpdateAmlHitStatusParams.HitUpdates.ReviewStatus.UNREVIEWED).build())).nodeId("value-node-id").build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/bulk-update-aml-hit-status/", "200"); + transport.respondJson(200, example); + var result = client.sessions().bulkUpdateAmlHitStatus("00000000-0000-4000-8000-0000000198ee", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-0000000198ee/bulk-update-aml-hit-status/", request.path()); + assertEquals(Map.ofEntries(Map.entry("node_id", List.of("value-node-id-query"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"hit_updates\":[{\"hit_id\":\"value-hit-id\",\"review_status\":\"Unreviewed\"}],\"node_id\":\"value-node-id\"}", request.body()); + TestJson.assertJsonEquals(example, result); + } + + @Test + void updatePoaData() { + SessionsUpdatePoaDataParams params = SessionsUpdatePoaDataParams.builder().nodeId("value-node-id").issuingState("value-issuing-state").documentType(SessionsUpdatePoaDataParams.DocumentType.UTILITY_BILL).documentLanguage("value-document-language").issuer("value-issuer").issueDate(LocalDate.parse("2026-11-01")).poaAddress("value-poa-address").nameOnDocument("value-name-on-document").extraFields(Map.of("key", "value")).poaParsedAddress(SessionsUpdatePoaDataParams.PoaParsedAddress.builder().addressType("value-address-type").city("value-city").build()).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/update-poa-data/", "200"); + transport.respondJson(200, example); + var result = client.sessions().updatePoaData("00000000-0000-4000-8000-00000000e2cd", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000000e2cd/update-poa-data/", request.path()); + assertEquals(Map.ofEntries(Map.entry("node_id", List.of("value-node-id"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"issuing_state\":\"value-issuing-state\",\"document_type\":\"UTILITY_BILL\",\"document_language\":\"value-document-language\",\"issuer\":\"value-issuer\",\"issue_date\":\"2026-11-01\",\"poa_address\":\"value-poa-address\",\"name_on_document\":\"value-name-on-document\",\"extra_fields\":{\"key\":\"value\"},\"poa_parsed_address\":{\"address_type\":\"value-address-type\",\"city\":\"value-city\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateKybCompanyData() { + SessionsUpdateKybCompanyDataParams params = SessionsUpdateKybCompanyDataParams.builder().companyName("value-company-name").registrationNumber("value-registration-number").countryCode("value-country-code").region("value-region").incorporationDate(LocalDate.parse("2026-11-01")).registrationDate(LocalDate.parse("2026-11-01")).dissolutionDate(LocalDate.parse("2026-11-01")).taxNumber("value-tax-number").legalAddress("value-legal-address").companyType("value-company-type").registryStatus(SessionsUpdateKybCompanyDataParams.RegistryStatus.ACTIVE).verificationStatus(SessionsUpdateKybCompanyDataParams.VerificationStatus.VERIFIED).alternativeNames("value-alternative-names").natureOfBusiness("value-nature-of-business").registeredCapital("value-registered-capital").registeredCapitalAmount(1.5).registeredCapitalCurrency("value-registered-capital-currency").website("value-website").email("user@example.com").phone("value-phone").legalEntityIdentifier("value-legal-entity-identifier").locationOfRegistration("value-location-of-registration").vatNumber("value-vat-number").controlScheme("value-control-scheme").build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/session/{sessionId}/kyb/{companyUuid}/update-data/", "200"); + transport.respondJson(200, example); + var result = client.sessions().updateKybCompanyData("00000000-0000-4000-8000-000000015f57", "00000000-0000-4000-8000-00000001845b", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-000000015f57/kyb/00000000-0000-4000-8000-00000001845b/update-data/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"company_name\":\"value-company-name\",\"registration_number\":\"value-registration-number\",\"country_code\":\"value-country-code\",\"region\":\"value-region\",\"incorporation_date\":\"2026-11-01\",\"registration_date\":\"2026-11-01\",\"dissolution_date\":\"2026-11-01\",\"tax_number\":\"value-tax-number\",\"legal_address\":\"value-legal-address\",\"company_type\":\"value-company-type\",\"registry_status\":\"active\",\"verification_status\":\"verified\",\"alternative_names\":\"value-alternative-names\",\"nature_of_business\":\"value-nature-of-business\",\"registered_capital\":\"value-registered-capital\",\"registered_capital_amount\":1.5,\"registered_capital_currency\":\"value-registered-capital-currency\",\"website\":\"value-website\",\"email\":\"user@example.com\",\"phone\":\"value-phone\",\"legal_entity_identifier\":\"value-legal-entity-identifier\",\"location_of_registration\":\"value-location-of-registration\",\"vat_number\":\"value-vat-number\",\"control_scheme\":\"value-control-scheme\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateKybParty() { + SessionsUpdateKybPartyParams params = SessionsUpdateKybPartyParams.builder().isSkipped(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.sessions().updateKybParty("00000000-0000-4000-8000-00000000f557", "00000000-0000-4000-8000-00000000f858", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000000f557/kyb/parties/00000000-0000-4000-8000-00000000f858/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_skipped\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listNetworks() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.sessions().listNetworks("00000000-0000-4000-8000-00000000ddd4"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/sessions/00000000-0000-4000-8000-00000000ddd4/networks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void previewResubmission() { + SessionsPreviewResubmissionParams params = SessionsPreviewResubmissionParams.builder().nodesToResubmit(List.of(SessionsPreviewResubmissionParams.NodesToResubmit.builder().nodeId("value-node-id").feature(SessionsPreviewResubmissionParams.NodesToResubmit.Feature.OCR).build())).emailAddress("user@example.com").emailLanguage("value-email-language").build(); + JsonNode example = TestJson.parse("{\"html\":\"value\",\"nodes_to_resubmit\":[],\"preview_token\":\"value\",\"recipient\":\"value\",\"requires_user_action\":true,\"sender\":\"value\",\"subject\":\"value\"}"); + transport.respondJson(200, example); + var result = client.sessions().previewResubmission("00000000-0000-4000-8000-00000001344a", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/session/00000000-0000-4000-8000-00000001344a/resubmission-preview/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"nodes_to_resubmit\":[{\"node_id\":\"value-node-id\",\"feature\":\"OCR\"}],\"email_address\":\"user@example.com\",\"email_language\":\"value-email-language\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/SessionsReviewsResourceTest.java b/src/test/java/me/didit/resources/SessionsReviewsResourceTest.java new file mode 100644 index 0000000..392a45e --- /dev/null +++ b/src/test/java/me/didit/resources/SessionsReviewsResourceTest.java @@ -0,0 +1,61 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.SessionsReviewsCreateParams; +import me.didit.types.SessionsReviewsListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code sessions.reviews}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class SessionsReviewsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + SessionsReviewsListParams params = SessionsReviewsListParams.builder().limit(1L).offset(1L).ordering("value-ordering").build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/sessions/{session_id}/reviews/", "200"); + transport.respondJson(200, example); + var result = client.sessions().reviews().list("00000000-0000-4000-8000-00000000cc15", params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/sessions/00000000-0000-4000-8000-00000000cc15/reviews/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1")), Map.entry("ordering", List.of("value-ordering"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + SessionsReviewsCreateParams params = SessionsReviewsCreateParams.builder().newStatus(SessionsReviewsCreateParams.NewStatus.NOT_STARTED).comment("value-comment").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/sessions/{session_id}/reviews/", "201"); + transport.respondJson(201, example); + var result = client.sessions().reviews().create("00000000-0000-4000-8000-00000000e4e2", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/sessions/00000000-0000-4000-8000-00000000e4e2/reviews/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"new_status\":\"Not Started\",\"comment\":\"value-comment\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/TransactionsResourceTest.java b/src/test/java/me/didit/resources/TransactionsResourceTest.java new file mode 100644 index 0000000..d4915b0 --- /dev/null +++ b/src/test/java/me/didit/resources/TransactionsResourceTest.java @@ -0,0 +1,128 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.TransactionsCreateParams; +import me.didit.types.TransactionsCreateSdkTokenParams; +import me.didit.types.TransactionsListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code transactions}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class TransactionsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + TransactionsListParams params = TransactionsListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/transactions/", "200"); + transport.respondJson(200, example); + var result = client.transactions().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/transactions/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + TransactionsCreateParams params = TransactionsCreateParams.builder().transactionId("value-transaction-id").transactionAt(OffsetDateTime.parse("2026-11-01T10:15:30Z")).timeZone("value-time-zone").transactionCategory(TransactionsCreateParams.TransactionCategory.FINANCE).transactionDetails(TransactionsCreateParams.TransactionDetails.builder().direction(TransactionsCreateParams.TransactionDetails.Direction.INBOUND).amount(1.5).currency("value-currency").currencyKind("value-currency-kind").amountInDefaultCurrency(1.5).build()).subject(TransactionsCreateParams.Subject.builder().entityType("value-entity-type").vendorData("value-vendor-data").fullName("value-full-name").firstName("value-first-name").build()).counterparty(TransactionsCreateParams.Counterparty.builder().entityType("value-entity-type").vendorData("value-vendor-data").build()).customProperties(Map.of("key", "value")).travelRuleDetails(TransactionsCreateParams.TravelRuleDetails.builder().status("value-status").protocol("value-protocol").required(true).build()).networkSnapshot(TransactionsCreateParams.NetworkSnapshot.builder().nodes(List.of(Map.of("key", "value"))).edges(List.of(Map.of("key", "value"))).build()).includeCryptoScreening(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/transactions/", "201"); + transport.respondJson(201, example); + var result = client.transactions().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/transactions/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"transaction_id\":\"value-transaction-id\",\"transaction_at\":\"2026-11-01T10:15:30Z\",\"time_zone\":\"value-time-zone\",\"transaction_category\":\"finance\",\"transaction_details\":{\"direction\":\"inbound\",\"amount\":1.5,\"currency\":\"value-currency\",\"currency_kind\":\"value-currency-kind\",\"amount_in_default_currency\":1.5},\"subject\":{\"entity_type\":\"value-entity-type\",\"vendor_data\":\"value-vendor-data\",\"full_name\":\"value-full-name\",\"first_name\":\"value-first-name\"},\"counterparty\":{\"entity_type\":\"value-entity-type\",\"vendor_data\":\"value-vendor-data\"},\"custom_properties\":{\"key\":\"value\"},\"travel_rule_details\":{\"status\":\"value-status\",\"protocol\":\"value-protocol\",\"required\":true},\"network_snapshot\":{\"nodes\":[{\"key\":\"value\"}],\"edges\":[{\"key\":\"value\"}]},\"include_crypto_screening\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/transactions/{transaction_id}/", "200"); + transport.respondJson(200, example); + var result = client.transactions().retrieve("00000000-0000-4000-8000-00000001042c"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/transactions/00000000-0000-4000-8000-00000001042c/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void createSdkToken() { + TransactionsCreateSdkTokenParams params = TransactionsCreateSdkTokenParams.builder().vendorData("value-vendor-data").ttlSeconds(1L).maxUses(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/transactions/sdk-token/", "201"); + transport.respondJson(201, example); + var result = client.transactions().createSdkToken(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/transactions/sdk-token/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"ttl_seconds\":1,\"max_uses\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listNetworks() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.transactions().listNetworks("00000000-0000-4000-8000-000000017bd7"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/transactions/00000000-0000-4000-8000-000000017bd7/networks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listPartyNetworks() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.transactions().listPartyNetworks("00000000-0000-4000-8000-00000001f02a", "00000000-0000-4000-8000-0000000273f7"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/transactions/00000000-0000-4000-8000-00000001f02a/parties/00000000-0000-4000-8000-0000000273f7/networks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/TransactionsRulesResourceTest.java b/src/test/java/me/didit/resources/TransactionsRulesResourceTest.java new file mode 100644 index 0000000..c3c94ce --- /dev/null +++ b/src/test/java/me/didit/resources/TransactionsRulesResourceTest.java @@ -0,0 +1,184 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.TransactionRuleAction; +import me.didit.types.TransactionRuleAggregation; +import me.didit.types.TransactionRuleBacktestRequest; +import me.didit.types.TransactionRuleCondition; +import me.didit.types.TransactionRuleCreateRequest; +import me.didit.types.TransactionRuleInstallRequest; +import me.didit.types.TransactionRuleScope; +import me.didit.types.TransactionRuleUpdateRequest; +import me.didit.types.TransactionsRulesListLibraryParams; +import me.didit.types.TransactionsRulesListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code transactions.rules}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class TransactionsRulesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + TransactionsRulesListParams params = TransactionsRulesListParams.builder().source(TransactionsRulesListParams.Source.PRESET).category("value-category").mode(TransactionsRulesListParams.Mode.ACTIVE).bundle("value-bundle").search("value-search").ordering("value-ordering").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.transactions().rules().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/transactions/rules/", request.path()); + assertEquals(Map.ofEntries(Map.entry("source", List.of("PRESET")), Map.entry("category", List.of("value-category")), Map.entry("mode", List.of("ACTIVE")), Map.entry("bundle", List.of("value-bundle")), Map.entry("search", List.of("value-search")), Map.entry("ordering", List.of("value-ordering")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + TransactionRuleCreateRequest params = TransactionRuleCreateRequest.builder().title("value-title").description("value-description").category("value-category").mode(TransactionRuleCreateRequest.Mode.ACTIVE).evaluationMode(TransactionRuleCreateRequest.EvaluationMode.ALL).scope(TransactionRuleScope.builder().transactionTypes(List.of("value-transaction-types")).directions(List.of(TransactionRuleScope.Directions.INBOUND)).build()).conditions(List.of(TransactionRuleCondition.builder().field("value-field").operator(TransactionRuleCondition.Operator.EQ).value("value").valueType(TransactionRuleCondition.ValueType.LIST).build())).aggregation(List.of(TransactionRuleAggregation.builder().metric(TransactionRuleAggregation.Metric.COUNT).field("value-field").value(1.5).build())).actions(List.of(TransactionRuleAction.ofAddScore(TransactionRuleAction.AddScore.builder().type(TransactionRuleAction.AddScore.Type.ADD_SCORE).value(1L).build()))).metadata(Map.of("key", "value")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.transactions().rules().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/transactions/rules/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"title\":\"value-title\",\"description\":\"value-description\",\"category\":\"value-category\",\"mode\":\"ACTIVE\",\"evaluation_mode\":\"ALL\",\"scope\":{\"transaction_types\":[\"value-transaction-types\"],\"directions\":[\"INBOUND\"]},\"conditions\":[{\"field\":\"value-field\",\"operator\":\"eq\",\"value\":\"value\",\"value_type\":\"list\"}],\"aggregation\":[{\"metric\":\"count\",\"field\":\"value-field\",\"value\":1.5}],\"actions\":[{\"type\":\"add_score\",\"value\":1}],\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.transactions().rules().retrieve("00000000-0000-4000-8000-0000000112d9"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/transactions/rules/00000000-0000-4000-8000-0000000112d9/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + TransactionRuleUpdateRequest params = TransactionRuleUpdateRequest.builder().title("value-title").description("value-description").category("value-category").mode(TransactionRuleUpdateRequest.Mode.ACTIVE).evaluationMode(TransactionRuleUpdateRequest.EvaluationMode.ALL).scope(TransactionRuleScope.builder().transactionTypes(List.of("value-transaction-types")).directions(List.of(TransactionRuleScope.Directions.INBOUND)).build()).conditions(List.of(TransactionRuleCondition.builder().field("value-field").operator(TransactionRuleCondition.Operator.EQ).value("value").valueType(TransactionRuleCondition.ValueType.LIST).build())).aggregation(List.of(TransactionRuleAggregation.builder().metric(TransactionRuleAggregation.Metric.COUNT).field("value-field").value(1.5).build())).actions(List.of(TransactionRuleAction.ofAddScore(TransactionRuleAction.AddScore.builder().type(TransactionRuleAction.AddScore.Type.ADD_SCORE).value(1L).build()))).metadata(Map.of("key", "value")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.transactions().rules().update("00000000-0000-4000-8000-00000000f3de", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/transactions/rules/00000000-0000-4000-8000-00000000f3de/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"title\":\"value-title\",\"description\":\"value-description\",\"category\":\"value-category\",\"mode\":\"ACTIVE\",\"evaluation_mode\":\"ALL\",\"scope\":{\"transaction_types\":[\"value-transaction-types\"],\"directions\":[\"INBOUND\"]},\"conditions\":[{\"field\":\"value-field\",\"operator\":\"eq\",\"value\":\"value\",\"value_type\":\"list\"}],\"aggregation\":[{\"metric\":\"count\",\"field\":\"value-field\",\"value\":1.5}],\"actions\":[{\"type\":\"add_score\",\"value\":1}],\"metadata\":{\"key\":\"value\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.transactions().rules().delete("00000000-0000-4000-8000-00000000f2af"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/transactions/rules/00000000-0000-4000-8000-00000000f2af/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } + + @Test + void backtest() { + TransactionRuleBacktestRequest params = TransactionRuleBacktestRequest.builder().conditions(List.of(TransactionRuleCondition.builder().field("value-field").operator(TransactionRuleCondition.Operator.EQ).value("value").valueType(TransactionRuleCondition.ValueType.LIST).build())).aggregation(List.of(TransactionRuleAggregation.builder().metric(TransactionRuleAggregation.Metric.COUNT).field("value-field").value(1.5).build())).evaluationMode(TransactionRuleBacktestRequest.EvaluationMode.ALL).scope(TransactionRuleScope.builder().transactionTypes(List.of("value-transaction-types")).directions(List.of(TransactionRuleScope.Directions.INBOUND)).build()).periodDays(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/transactions/rules/backtest/", "200"); + transport.respondJson(200, example); + var result = client.transactions().rules().backtest(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/transactions/rules/backtest/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"conditions\":[{\"field\":\"value-field\",\"operator\":\"eq\",\"value\":\"value\",\"value_type\":\"list\"}],\"aggregation\":[{\"metric\":\"count\",\"field\":\"value-field\",\"value\":1.5}],\"evaluation_mode\":\"ALL\",\"scope\":{\"transaction_types\":[\"value-transaction-types\"],\"directions\":[\"INBOUND\"]},\"period_days\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listLibrary() { + TransactionsRulesListLibraryParams params = TransactionsRulesListLibraryParams.builder().bundle("value-bundle").category("value-category").search("value-search").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.transactions().rules().listLibrary(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/transactions/rules/library/", request.path()); + assertEquals(Map.ofEntries(Map.entry("bundle", List.of("value-bundle")), Map.entry("category", List.of("value-category")), Map.entry("search", List.of("value-search")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void installLibrary() { + TransactionRuleInstallRequest params = TransactionRuleInstallRequest.builder().libraryKeys(List.of("value-library-keys")).bundle("value-bundle").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/transactions/rules/install/", "200"); + transport.respondJson(200, example); + var result = client.transactions().rules().installLibrary(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/transactions/rules/install/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"library_keys\":[\"value-library-keys\"],\"bundle\":\"value-bundle\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void uninstallLibrary() { + TransactionRuleInstallRequest params = TransactionRuleInstallRequest.builder().libraryKeys(List.of("value-library-keys")).bundle("value-bundle").build(); + JsonNode example = SpecExamples.response("verification.json", "DELETE", "/v3/transactions/rules/install/", "200"); + transport.respondJson(200, example); + var result = client.transactions().rules().uninstallLibrary(params); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/transactions/rules/install/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"library_keys\":[\"value-library-keys\"],\"bundle\":\"value-bundle\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/TransactionsTravelRuleResourceTest.java b/src/test/java/me/didit/resources/TransactionsTravelRuleResourceTest.java new file mode 100644 index 0000000..e69c876 --- /dev/null +++ b/src/test/java/me/didit/resources/TransactionsTravelRuleResourceTest.java @@ -0,0 +1,60 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.TravelRuleOwnershipConfirmRequest; +import me.didit.types.TravelRuleTransferPatchRequest; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code transactions.travel_rule}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class TransactionsTravelRuleResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void updateTransfer() { + TravelRuleTransferPatchRequest params = TravelRuleTransferPatchRequest.builder().paymentTxnId("value-payment-txn-id").action(TravelRuleTransferPatchRequest.Action.CANCEL).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.transactions().travelRule().updateTransfer("00000000-0000-4000-8000-00000002630a", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/transactions/00000000-0000-4000-8000-00000002630a/travel-rule/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"payment_txn_id\":\"value-payment-txn-id\",\"action\":\"cancel\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void confirmOwnership() { + TravelRuleOwnershipConfirmRequest params = TravelRuleOwnershipConfirmRequest.builder().confirmed(true).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.transactions().travelRule().confirmOwnership("00000000-0000-4000-8000-0000000293dd", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/transactions/00000000-0000-4000-8000-0000000293dd/travel-rule/ownership/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"confirmed\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/TravelRuleResourceTest.java b/src/test/java/me/didit/resources/TravelRuleResourceTest.java new file mode 100644 index 0000000..1dfb8a1 --- /dev/null +++ b/src/test/java/me/didit/resources/TravelRuleResourceTest.java @@ -0,0 +1,113 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.TravelRuleInboundRequest; +import me.didit.types.TravelRuleListVaspsParams; +import me.didit.types.TravelRuleSettingsUpdate; +import me.didit.types.TravelRuleWidgetSessionCreate; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code travel_rule}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class TravelRuleResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void retrieveSettings() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/travel-rule/settings/", "200"); + transport.respondJson(200, example); + var result = client.travelRule().retrieveSettings(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/travel-rule/settings/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void updateSettings() { + TravelRuleSettingsUpdate params = TravelRuleSettingsUpdate.builder().isEnabled(true).legalName("value-legal-name").lei("value-lei").jurisdiction("value-jurisdiction").nameMatchingStrictness(TravelRuleSettingsUpdate.NameMatchingStrictness.NONE).confirmationTimeoutHours(1L).timeoutOutcome(TravelRuleSettingsUpdate.TimeoutOutcome.HOLD).complianceEmail("user@example.com").isDiscoverable(true).thresholdAmount("value-threshold-amount").inboundAutoAccept(true).allowSelfDeclaration(true).allowScreenshotProof(true).autoWalletVerification(true).vaspAttributionEnabled(true).disabledNetworks(List.of(TravelRuleSettingsUpdate.DisabledNetworks.GTR)).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.travelRule().updateSettings(params); + RecordedRequest request = transport.only(); + assertEquals("PUT", request.method()); + assertEquals("/v3/travel-rule/settings/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_enabled\":true,\"legal_name\":\"value-legal-name\",\"lei\":\"value-lei\",\"jurisdiction\":\"value-jurisdiction\",\"name_matching_strictness\":\"NONE\",\"confirmation_timeout_hours\":1,\"timeout_outcome\":\"HOLD\",\"compliance_email\":\"user@example.com\",\"is_discoverable\":true,\"threshold_amount\":\"value-threshold-amount\",\"inbound_auto_accept\":true,\"allow_self_declaration\":true,\"allow_screenshot_proof\":true,\"auto_wallet_verification\":true,\"vasp_attribution_enabled\":true,\"disabled_networks\":[\"GTR\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listVasps() { + TravelRuleListVaspsParams params = TravelRuleListVaspsParams.builder().search("value-search").limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.travelRule().listVasps(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/travel-rule/vasps/", request.path()); + assertEquals(Map.ofEntries(Map.entry("search", List.of("value-search")), Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void registerInbound() { + TravelRuleInboundRequest params = TravelRuleInboundRequest.builder().chain("value-chain").txid("value-txid").walletAddress("value-wallet-address").amount("value-amount").currency("value-currency").originatorData(Map.of("key", "value")).beneficiaryData(Map.of("key", "value")).originatingVasp(TravelRuleInboundRequest.OriginatingVasp.builder().name("value-name").lei("value-lei").build()).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.travelRule().registerInbound(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/travel-rule/inbound/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"chain\":\"value-chain\",\"txid\":\"value-txid\",\"wallet_address\":\"value-wallet-address\",\"amount\":\"value-amount\",\"currency\":\"value-currency\",\"originator_data\":{\"key\":\"value\"},\"beneficiary_data\":{\"key\":\"value\"},\"originating_vasp\":{\"name\":\"value-name\",\"lei\":\"value-lei\"}}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void createWidgetSession() { + TravelRuleWidgetSessionCreate params = TravelRuleWidgetSessionCreate.builder().walletAddress("value-wallet-address").chain("value-chain").holderName("value-holder-name").vendorData("value-vendor-data").transactionId("00000000-0000-4000-8000-000000002b0f").satoshiDepositAddress("value-satoshi-deposit-address").callbackUrl("value-callback-url").expiresInMinutes(1L).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.travelRule().createWidgetSession(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/travel-rule/widget-session/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"wallet_address\":\"value-wallet-address\",\"chain\":\"value-chain\",\"holder_name\":\"value-holder-name\",\"vendor_data\":\"value-vendor-data\",\"transaction_id\":\"00000000-0000-4000-8000-000000002b0f\",\"satoshi_deposit_address\":\"value-satoshi-deposit-address\",\"callback_url\":\"value-callback-url\",\"expires_in_minutes\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/TravelRuleWalletAddressesResourceTest.java b/src/test/java/me/didit/resources/TravelRuleWalletAddressesResourceTest.java new file mode 100644 index 0000000..2201108 --- /dev/null +++ b/src/test/java/me/didit/resources/TravelRuleWalletAddressesResourceTest.java @@ -0,0 +1,92 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.TravelRuleWalletAddressesListParams; +import me.didit.types.WalletAddressEntryCreate; +import me.didit.types.WalletAddressEntryUpdate; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code travel_rule.wallet_addresses}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class TravelRuleWalletAddressesResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + TravelRuleWalletAddressesListParams params = TravelRuleWalletAddressesListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = TestJson.parse("{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}"); + transport.respondJson(200, example); + var result = client.travelRule().walletAddresses().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/travel-rule/wallet-addresses/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + WalletAddressEntryCreate params = WalletAddressEntryCreate.builder().address("value-address").chain("value-chain").holderVendorData("value-holder-vendor-data").holderName("value-holder-name").entityType("value-entity-type").selfDeclared(true).travelAddress("value-travel-address").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(201, example); + var result = client.travelRule().walletAddresses().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/travel-rule/wallet-addresses/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"address\":\"value-address\",\"chain\":\"value-chain\",\"holder_vendor_data\":\"value-holder-vendor-data\",\"holder_name\":\"value-holder-name\",\"entity_type\":\"value-entity-type\",\"self_declared\":true,\"travel_address\":\"value-travel-address\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + WalletAddressEntryUpdate params = WalletAddressEntryUpdate.builder().holderName("value-holder-name").holderVendorData("value-holder-vendor-data").entityType("value-entity-type").travelAddress("value-travel-address").build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.travelRule().walletAddresses().update("00000000-0000-4000-8000-00000001aa5e", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/travel-rule/wallet-addresses/00000000-0000-4000-8000-00000001aa5e/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"holder_name\":\"value-holder-name\",\"holder_vendor_data\":\"value-holder-vendor-data\",\"entity_type\":\"value-entity-type\",\"travel_address\":\"value-travel-address\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.travelRule().walletAddresses().delete("00000000-0000-4000-8000-00000001a88f"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/travel-rule/wallet-addresses/00000000-0000-4000-8000-00000001a88f/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } +} diff --git a/src/test/java/me/didit/resources/UsersResourceTest.java b/src/test/java/me/didit/resources/UsersResourceTest.java new file mode 100644 index 0000000..d423765 --- /dev/null +++ b/src/test/java/me/didit/resources/UsersResourceTest.java @@ -0,0 +1,235 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.UsersBatchDeleteParams; +import me.didit.types.UsersCreateParams; +import me.didit.types.UsersListParams; +import me.didit.types.UsersSetAmlMonitoringParams; +import me.didit.types.UsersSetOngoingMonitoringParams; +import me.didit.types.UsersUpdateParams; +import me.didit.types.UsersUpdateStatusParams; +import me.didit.types.UsersUploadFaceParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code users}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class UsersResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + UsersListParams params = UsersListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/users/", "200"); + transport.respondJson(200, example); + var result = client.users().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/users/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/users/{vendor_data}/", "200"); + transport.respondJson(200, example); + var result = client.users().retrieve("00000000-0000-4000-8000-00000000855e"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/users/00000000-0000-4000-8000-00000000855e/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + UsersUpdateParams params = UsersUpdateParams.builder().fullName("value-full-name").displayName("value-display-name").dateOfBirth(LocalDate.parse("2026-11-01")).status(UsersUpdateParams.Status.ACTIVE).metadata(Map.of("key", "value")).approvedEmails(List.of("value-approved-emails")).approvedPhones(List.of("value-approved-phones")).issuingStates(List.of("value-issuing-states")).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/users/{vendor_data}/", "200"); + transport.respondJson(200, example); + var result = client.users().update("00000000-0000-4000-8000-000000007078", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/users/00000000-0000-4000-8000-000000007078/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"full_name\":\"value-full-name\",\"display_name\":\"value-display-name\",\"date_of_birth\":\"2026-11-01\",\"status\":\"ACTIVE\",\"metadata\":{\"key\":\"value\"},\"approved_emails\":[\"value-approved-emails\"],\"approved_phones\":[\"value-approved-phones\"],\"issuing_states\":[\"value-issuing-states\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void generatePdf() { + transport.respondBinary(200, "application/pdf", new byte[] {37, 80, 68, 70}); + var result = client.users().generatePdf("00000000-0000-4000-8000-00000000b0ef"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/users/00000000-0000-4000-8000-00000000b0ef/generate-pdf/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("application/pdf, application/json", request.header("Accept")); + assertEquals(0, request.body().length); + assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes()); + } + + @Test + void batchDelete() { + UsersBatchDeleteParams params = UsersBatchDeleteParams.builder().vendorDataList(List.of("value-vendor-data-list")).diditInternalIdList(List.of("00000000-0000-4000-8000-0000000068ce")).deleteAll(true).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/users/delete/", "200"); + transport.respondJson(200, example); + var result = client.users().batchDelete(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/users/delete/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"vendor_data_list\":[\"value-vendor-data-list\"],\"didit_internal_id_list\":[\"00000000-0000-4000-8000-0000000068ce\"],\"delete_all\":true}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void setAmlMonitoring() { + UsersSetAmlMonitoringParams params = UsersSetAmlMonitoringParams.builder().isEnabled(true).estimateOnly(true).vendorDataList(List.of("value-vendor-data-list")).diditInternalIdList(List.of("00000000-0000-4000-8000-0000000068ce")).build(); + JsonNode example = TestJson.parse("{\"already_enabled\":1,\"balance_sufficient\":true,\"estimated_annual_monitoring_cost_usd\":1.5,\"estimated_screening_cost_usd\":1.5,\"needing_screening\":1,\"skipped_blocked\":1,\"skipped_no_identity_data\":1,\"unmatched\":[],\"users_total\":1,\"with_existing_aml\":1}"); + transport.respondJson(200, example); + var result = client.users().setAmlMonitoring(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/users/aml-monitoring/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_enabled\":true,\"estimate_only\":true,\"vendor_data_list\":[\"value-vendor-data-list\"],\"didit_internal_id_list\":[\"00000000-0000-4000-8000-0000000068ce\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void updateStatus() { + UsersUpdateStatusParams params = UsersUpdateStatusParams.builder().status(UsersUpdateStatusParams.Status.ACTIVE).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/users/{vendor_data}/update-status/", "200"); + transport.respondJson(200, example); + var result = client.users().updateStatus("00000000-0000-4000-8000-00000000c099", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/users/00000000-0000-4000-8000-00000000c099/update-status/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"status\":\"ACTIVE\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void create() { + UsersCreateParams params = UsersCreateParams.builder().vendorData("value-vendor-data").fullName("value-full-name").displayName("value-display-name").dateOfBirth(LocalDate.parse("2026-11-01")).status(UsersCreateParams.Status.ACTIVE).metadata(Map.of("key", "value")).approvedEmails(List.of("value-approved-emails")).approvedPhones(List.of("value-approved-phones")).issuingStates(List.of("value-issuing-states")).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/users/create/", "201"); + transport.respondJson(201, example); + var result = client.users().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/users/create/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"vendor_data\":\"value-vendor-data\",\"full_name\":\"value-full-name\",\"display_name\":\"value-display-name\",\"date_of_birth\":\"2026-11-01\",\"status\":\"ACTIVE\",\"metadata\":{\"key\":\"value\"},\"approved_emails\":[\"value-approved-emails\"],\"approved_phones\":[\"value-approved-phones\"],\"issuing_states\":[\"value-issuing-states\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void uploadFace() { + UsersUploadFaceParams params = UsersUploadFaceParams.builder().image("value-image").comment("value-comment").build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/organization/{organization_id}/application/{application_id}/vendor-users/by-id/{didit_internal_id}/faces/upload/", "201"); + transport.respondJson(201, example); + var result = client.users().uploadFace("00000000-0000-4000-8000-00000000f127", params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/vendor-users/by-id/00000000-0000-4000-8000-00000000f127/faces/upload/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"image\":\"value-image\",\"comment\":\"value-comment\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void setOngoingMonitoring() { + UsersSetOngoingMonitoringParams params = UsersSetOngoingMonitoringParams.builder().isEnabled(true).estimateOnly(true).updateAll(true).filterSearch("value-filter-search").filterStatus(List.of("value-filter-status")).filterCountry("value-filter-country").filterDateFrom(LocalDate.parse("2026-11-01")).filterDateTo(LocalDate.parse("2026-11-01")).diditInternalIdList(List.of("00000000-0000-4000-8000-0000000068ce")).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.users().setOngoingMonitoring(params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/vendor-users/toggle-ongoing-monitoring/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"is_enabled\":true,\"estimate_only\":true,\"update_all\":true,\"filter_search\":\"value-filter-search\",\"filter_status\":[\"value-filter-status\"],\"filter_country\":\"value-filter-country\",\"filter_date_from\":\"2026-11-01\",\"filter_date_to\":\"2026-11-01\",\"didit_internal_id_list\":[\"00000000-0000-4000-8000-0000000068ce\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + assertEquals(200, result.statusCode()); + TestModels.readAll(result); + } + + @Test + void retrieveOngoingMonitoringJob() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.users().retrieveOngoingMonitoringJob("00000000-0000-4000-8000-0000000184dc"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/vendor-users/toggle-ongoing-monitoring/00000000-0000-4000-8000-0000000184dc/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void listNetworks() { + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.users().listNetworks("00000000-0000-4000-8000-000000010a61"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/organization/00000000-0000-4000-8000-0000000000a1/application/00000000-0000-4000-8000-0000000000a2/users/00000000-0000-4000-8000-000000010a61/networks/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } +} diff --git a/src/test/java/me/didit/resources/WalletScreeningResourceTest.java b/src/test/java/me/didit/resources/WalletScreeningResourceTest.java new file mode 100644 index 0000000..d73d62e --- /dev/null +++ b/src/test/java/me/didit/resources/WalletScreeningResourceTest.java @@ -0,0 +1,59 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.WalletScreeningResult; +import me.didit.types.WalletScreeningScreenParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code wallet_screening}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class WalletScreeningResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void screen() { + WalletScreeningScreenParams params = WalletScreeningScreenParams.builder().walletAddress("value-wallet-address").blockchain(WalletScreeningScreenParams.Blockchain.BTC).direction(WalletScreeningScreenParams.Direction.INBOUND).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/wallet-screening/", "200"); + transport.respondJson(200, example); + var result = client.walletScreening().screen(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/wallet-screening/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"wallet_address\":\"value-wallet-address\",\"blockchain\":\"BTC\",\"direction\":\"inbound\"}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void screenPdf() { + WalletScreeningResult params = WalletScreeningResult.builder().provider("value-provider").screeningType(WalletScreeningResult.ScreeningType.WALLET_SCREENING).riskScore(1L).severity(WalletScreeningResult.Severity.UNKNOWN).status(WalletScreeningResult.Status.SCREENED).summary("value-summary").walletAddress("value-wallet-address").transactionHash("value-transaction-hash").blockchain("value-blockchain").blockTimestamp("value-block-timestamp").totalValueUsd(1.5).feeUsd(1.5).senderRows(List.of(Map.of("key", "value"))).receiverRows(List.of(Map.of("key", "value"))).transactionFlows(List.of(Map.of("key", "value"))).transactionFlowsStatus("value-transaction-flows-status").transactionFlowsError("value-transaction-flows-error").sourceOfFunds(List.of(WalletScreeningResult.SourceOfFunds.builder().category("value-category").percentage(1.5).build())).destinationOfFunds(List.of(WalletScreeningResult.DestinationOfFunds.builder().category("value-category").percentage(1.5).build())).counterpartyConnections(List.of(WalletScreeningResult.CounterpartyConnections.builder().entityName("value-entity-name").entityType("value-entity-type").build())).networkNodes(List.of(Map.of("key", "value"))).networkEdges(List.of(Map.of("key", "value"))).sanctionsHit(true).pepCounterparty(true).dominantRiskCategory("value-dominant-risk-category").riskFactors(List.of(WalletScreeningResult.RiskFactors.builder().source(WalletScreeningResult.RiskFactors.Source.ATTRIBUTION).category("value-category").build())).rawResponse(Map.of("key", "value")).reportSignature("value-report-signature").build(); + transport.respondBinary(200, "application/pdf", new byte[] {37, 80, 68, 70}); + var result = client.walletScreening().screenPdf(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/wallet-screening/pdf/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals("application/pdf, application/json", request.header("Accept")); + TestJson.assertJsonEquals("{\"provider\":\"value-provider\",\"screening_type\":\"WALLET_SCREENING\",\"risk_score\":1,\"severity\":\"UNKNOWN\",\"status\":\"SCREENED\",\"summary\":\"value-summary\",\"wallet_address\":\"value-wallet-address\",\"transaction_hash\":\"value-transaction-hash\",\"blockchain\":\"value-blockchain\",\"block_timestamp\":\"value-block-timestamp\",\"total_value_usd\":1.5,\"fee_usd\":1.5,\"sender_rows\":[{\"key\":\"value\"}],\"receiver_rows\":[{\"key\":\"value\"}],\"transaction_flows\":[{\"key\":\"value\"}],\"transaction_flows_status\":\"value-transaction-flows-status\",\"transaction_flows_error\":\"value-transaction-flows-error\",\"source_of_funds\":[{\"category\":\"value-category\",\"percentage\":1.5}],\"destination_of_funds\":[{\"category\":\"value-category\",\"percentage\":1.5}],\"counterparty_connections\":[{\"entity_name\":\"value-entity-name\",\"entity_type\":\"value-entity-type\"}],\"network_nodes\":[{\"key\":\"value\"}],\"network_edges\":[{\"key\":\"value\"}],\"sanctions_hit\":true,\"pep_counterparty\":true,\"dominant_risk_category\":\"value-dominant-risk-category\",\"risk_factors\":[{\"source\":\"attribution\",\"category\":\"value-category\"}],\"raw_response\":{\"key\":\"value\"},\"report_signature\":\"value-report-signature\"}", request.body()); + assertArrayEquals(new byte[] {37, 80, 68, 70}, result.bytes()); + } +} diff --git a/src/test/java/me/didit/resources/WebhooksDestinationsResourceTest.java b/src/test/java/me/didit/resources/WebhooksDestinationsResourceTest.java new file mode 100644 index 0000000..f545e79 --- /dev/null +++ b/src/test/java/me/didit/resources/WebhooksDestinationsResourceTest.java @@ -0,0 +1,106 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.WebhookEvent; +import me.didit.types.WebhooksDestinationsCreateParams; +import me.didit.types.WebhooksDestinationsUpdateParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code webhooks.destinations}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class WebhooksDestinationsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/webhook/destinations/", "200"); + transport.respondJson(200, example); + var result = client.webhooks().destinations().list(); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/webhook/destinations/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void create() { + WebhooksDestinationsCreateParams params = WebhooksDestinationsCreateParams.builder().label("value-label").url("https://example.com/callback").enabled(true).webhookVersion(WebhooksDestinationsCreateParams.WebhookVersion.V_1).subscribedEvents(List.of(WebhookEvent.STATUS_UPDATED)).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/webhook/destinations/", "201"); + transport.respondJson(201, example); + var result = client.webhooks().destinations().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/webhook/destinations/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"label\":\"value-label\",\"url\":\"https://example.com/callback\",\"enabled\":true,\"webhook_version\":\"v1\",\"subscribed_events\":[\"status.updated\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/webhook/destinations/{destination_uuid}/", "200"); + transport.respondJson(200, example); + var result = client.webhooks().destinations().retrieve("00000000-0000-4000-8000-00000001c0b7"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/webhook/destinations/00000000-0000-4000-8000-00000001c0b7/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void update() { + WebhooksDestinationsUpdateParams params = WebhooksDestinationsUpdateParams.builder().label("value-label").url("https://example.com/callback").enabled(true).webhookVersion(WebhooksDestinationsUpdateParams.WebhookVersion.V_1).subscribedEvents(List.of(WebhookEvent.STATUS_UPDATED)).build(); + JsonNode example = SpecExamples.response("verification.json", "PATCH", "/v3/webhook/destinations/{destination_uuid}/", "200"); + transport.respondJson(200, example); + var result = client.webhooks().destinations().update("00000000-0000-4000-8000-00000001993f", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/webhook/destinations/00000000-0000-4000-8000-00000001993f/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"label\":\"value-label\",\"url\":\"https://example.com/callback\",\"enabled\":true,\"webhook_version\":\"v1\",\"subscribed_events\":[\"status.updated\"]}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.webhooks().destinations().delete("00000000-0000-4000-8000-0000000197e0"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/webhook/destinations/00000000-0000-4000-8000-0000000197e0/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } +} diff --git a/src/test/java/me/didit/resources/WorkflowsResourceTest.java b/src/test/java/me/didit/resources/WorkflowsResourceTest.java new file mode 100644 index 0000000..acb018c --- /dev/null +++ b/src/test/java/me/didit/resources/WorkflowsResourceTest.java @@ -0,0 +1,108 @@ +// Code generated by codegen from openapi/*.json. DO NOT EDIT. +package me.didit.resources; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.core.Json; +import me.didit.testing.MockTransport; +import me.didit.testing.RecordedRequest; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import me.didit.testing.TestModels; +import me.didit.types.SimpleWorkflowFeature; +import me.didit.types.SimpleWorkflowRequest; +import me.didit.types.SimpleWorkflowUpdateRequest; +import me.didit.types.WorkflowsListParams; +import org.junit.jupiter.api.Test; + +/** One test per operation of {@code workflows}, against a stubbed HTTP layer. */ +@SuppressWarnings({"deprecation", "unused"}) +final class WorkflowsResourceTest { + private final MockTransport transport = new MockTransport(); + private final Didit client = transport.client(); + + @Test + void list() { + WorkflowsListParams params = WorkflowsListParams.builder().limit(1L).offset(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/workflows/", "200"); + transport.respondJson(200, example); + var result = client.workflows().list(params); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/workflows/", request.path()); + assertEquals(Map.ofEntries(Map.entry("limit", List.of("1")), Map.entry("offset", List.of("1"))), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result._json()); + assertEquals(example.path("results").size(), result.results().size()); + TestModels.readAll(result.results()); + } + + @Test + void create() { + SimpleWorkflowRequest params = SimpleWorkflowRequest.builder().workflowLabel("value-workflow-label").isDefault(true).status(SimpleWorkflowRequest.Status.DRAFT).features(List.of(SimpleWorkflowFeature.builder().feature(SimpleWorkflowFeature.Feature.OCR).config(Map.of("key", "value")).label("value-label").build())).isWhiteLabelEnabled(true).isDesktopAllowed(true).maxRetryAttempts(1L).retryWindowDays(1L).faceLivenessMaxAttempts(1L).faceMatchMaxAttempts(1L).sessionExpirationTime(1L).build(); + JsonNode example = SpecExamples.response("verification.json", "POST", "/v3/workflows/", "201"); + transport.respondJson(201, example); + var result = client.workflows().create(params); + RecordedRequest request = transport.only(); + assertEquals("POST", request.method()); + assertEquals("/v3/workflows/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"workflow_label\":\"value-workflow-label\",\"is_default\":true,\"status\":\"draft\",\"features\":[{\"feature\":\"OCR\",\"config\":{\"key\":\"value\"},\"label\":\"value-label\"}],\"is_white_label_enabled\":true,\"is_desktop_allowed\":true,\"max_retry_attempts\":1,\"retry_window_days\":1,\"face_liveness_max_attempts\":1,\"face_match_max_attempts\":1,\"session_expiration_time\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void retrieve() { + JsonNode example = SpecExamples.response("verification.json", "GET", "/v3/workflows/{settings_uuid}/", "200"); + transport.respondJson(200, example); + var result = client.workflows().retrieve("00000000-0000-4000-8000-00000000d07f"); + RecordedRequest request = transport.only(); + assertEquals("GET", request.method()); + assertEquals("/v3/workflows/00000000-0000-4000-8000-00000000d07f/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + TestJson.assertJsonEquals(example, result); + } + + @Test + void update() { + SimpleWorkflowUpdateRequest params = SimpleWorkflowUpdateRequest.builder().workflowLabel("value-workflow-label").isDefault(true).status(SimpleWorkflowUpdateRequest.Status.DRAFT).features(List.of(SimpleWorkflowFeature.builder().feature(SimpleWorkflowFeature.Feature.OCR).config(Map.of("key", "value")).label("value-label").build())).isWhiteLabelEnabled(true).isDesktopAllowed(true).maxRetryAttempts(1L).retryWindowDays(1L).faceLivenessMaxAttempts(1L).faceMatchMaxAttempts(1L).sessionExpirationTime(1L).build(); + JsonNode example = TestJson.parse("{}"); + transport.respondJson(200, example); + var result = client.workflows().update("00000000-0000-4000-8000-00000000b60d", params); + RecordedRequest request = transport.only(); + assertEquals("PATCH", request.method()); + assertEquals("/v3/workflows/00000000-0000-4000-8000-00000000b60d/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + TestJson.assertJsonEquals("{\"workflow_label\":\"value-workflow-label\",\"is_default\":true,\"status\":\"draft\",\"features\":[{\"feature\":\"OCR\",\"config\":{\"key\":\"value\"},\"label\":\"value-label\"}],\"is_white_label_enabled\":true,\"is_desktop_allowed\":true,\"max_retry_attempts\":1,\"retry_window_days\":1,\"face_liveness_max_attempts\":1,\"face_match_max_attempts\":1,\"session_expiration_time\":1}", request.body()); + TestJson.assertJsonEquals(example, Json.toNode(result)); + TestModels.readAll(result); + } + + @Test + void delete() { + transport.respond(204, ""); + client.workflows().delete("00000000-0000-4000-8000-00000000b56e"); + RecordedRequest request = transport.only(); + assertEquals("DELETE", request.method()); + assertEquals("/v3/workflows/00000000-0000-4000-8000-00000000b56e/", request.path()); + assertEquals(Map.of(), request.query()); + assertEquals("test-api-key", request.header("x-api-key")); + assertEquals("https://verification.didit.me", request.origin()); + assertEquals(0, request.body().length); + } +} diff --git a/src/test/java/me/didit/testing/MockTransport.java b/src/test/java/me/didit/testing/MockTransport.java new file mode 100644 index 0000000..c9d70e2 --- /dev/null +++ b/src/test/java/me/didit/testing/MockTransport.java @@ -0,0 +1,98 @@ +package me.didit.testing; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Deque; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import me.didit.Didit; +import me.didit.core.Headers; +import me.didit.core.HttpTransport; +import me.didit.core.TransportRequest; +import me.didit.core.TransportResponse; + +/** An {@link HttpTransport} that records requests and replays queued responses. */ +public final class MockTransport implements HttpTransport { + public static final String ORGANIZATION_ID = "00000000-0000-4000-8000-0000000000a1"; + public static final String APPLICATION_ID = "00000000-0000-4000-8000-0000000000a2"; + + private final Deque>> responses = + new ArrayDeque<>(); + private final List requests = new ArrayList<>(); + + /** A client with test credentials that sends through this transport. */ + public Didit client() { + return Didit.builder() + .apiKey("test-api-key") + .accountToken("test-account-token") + .organizationId(ORGANIZATION_ID) + .applicationId(APPLICATION_ID) + .environment(name -> null) + .transport(this) + .build(); + } + + public MockTransport respond(int status, String body) { + return respond(status, Map.of("Content-Type", "application/json"), body); + } + + public MockTransport respond(int status, Map headers, String body) { + byte[] bytes = body.getBytes(StandardCharsets.UTF_8); + Headers h = headers(headers); + responses.add(r -> CompletableFuture.completedFuture(new TransportResponse(status, h, bytes))); + return this; + } + + public MockTransport respondJson(int status, JsonNode body) { + return respond(status, body.toString()); + } + + public MockTransport respondBinary(int status, String contentType, byte[] body) { + Headers h = headers(Map.of("Content-Type", contentType)); + responses.add(r -> CompletableFuture.completedFuture(new TransportResponse(status, h, body))); + return this; + } + + public MockTransport fail(IOException error) { + responses.add(r -> CompletableFuture.failedFuture(error)); + return this; + } + + public MockTransport answer(Function> f) { + responses.add(f); + return this; + } + + public static Headers headers(Map headers) { + Map> map = new java.util.LinkedHashMap<>(); + headers.forEach((k, v) -> map.put(k, List.of(v))); + return Headers.of(map); + } + + @Override + public synchronized CompletableFuture send(TransportRequest request) { + requests.add(new RecordedRequest(request)); + Function> next = responses.poll(); + if (next == null) { + throw new AssertionError("Unexpected request: " + request); + } + return next.apply(request); + } + + public synchronized List requests() { + return List.copyOf(requests); + } + + /** The only request sent; fails when there were none or several. */ + public synchronized RecordedRequest only() { + if (requests.size() != 1) { + throw new AssertionError("Expected exactly one request, got " + requests.size()); + } + return requests.get(0); + } +} diff --git a/src/test/java/me/didit/testing/RecordedRequest.java b/src/test/java/me/didit/testing/RecordedRequest.java new file mode 100644 index 0000000..839170e --- /dev/null +++ b/src/test/java/me/didit/testing/RecordedRequest.java @@ -0,0 +1,161 @@ +package me.didit.testing; + +import java.net.URI; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import me.didit.core.TransportRequest; +import org.jspecify.annotations.Nullable; + +/** A request seen by {@link MockTransport}, with helpers to read it. */ +public final class RecordedRequest { + private final TransportRequest request; + + RecordedRequest(TransportRequest request) { + this.request = request; + } + + public TransportRequest raw() { + return request; + } + + public String method() { + return request.method(); + } + + public URI uri() { + return request.uri(); + } + + public String origin() { + URI u = request.uri(); + return u.getScheme() + "://" + u.getAuthority(); + } + + /** The decoded path, without the base URL's path prefix for the account API. */ + public String path() { + String path = request.uri().getRawPath(); + if (path.startsWith("/auth/v2/")) { + path = path.substring("/auth/v2".length()); + } + return URLDecoder.decode(path.replace("+", "%2B"), StandardCharsets.UTF_8); + } + + public Map> query() { + Map> out = new LinkedHashMap<>(); + String raw = request.uri().getRawQuery(); + if (raw == null || raw.isEmpty()) { + return out; + } + for (String pair : raw.split("&", -1)) { + int eq = pair.indexOf('='); + String name = URLDecoder.decode(pair.substring(0, eq), StandardCharsets.UTF_8); + String value = URLDecoder.decode(pair.substring(eq + 1), StandardCharsets.UTF_8); + out.computeIfAbsent(name, k -> new ArrayList<>()).add(value); + } + return out; + } + + public @Nullable String header(String name) { + for (Map.Entry> e : request.headers().entrySet()) { + if (e.getKey().equalsIgnoreCase(name)) { + return e.getValue().get(0); + } + } + return null; + } + + public byte[] body() { + return request.body(); + } + + public String bodyText() { + return new String(request.body(), StandardCharsets.UTF_8); + } + + /** Text fields of a multipart body, by name, in order. */ + public Map> multipartFields() { + Map> out = new LinkedHashMap<>(); + for (Part part : parts()) { + if (part.fileName == null) { + out.computeIfAbsent(part.name, k -> new ArrayList<>()).add(part.content); + } + } + return out; + } + + /** File names of a multipart body, by field name. */ + public Map> multipartFiles() { + Map> out = new LinkedHashMap<>(); + for (Part part : parts()) { + if (part.fileName != null) { + out.computeIfAbsent(part.name, k -> new ArrayList<>()).add(part.fileName); + } + } + return out; + } + + /** A multipart part. */ + public static final class Part { + public final String name; + public final @Nullable String fileName; + public final @Nullable String contentType; + public final String content; + + Part(String name, @Nullable String fileName, @Nullable String contentType, String content) { + this.name = name; + this.fileName = fileName; + this.contentType = contentType; + this.content = content; + } + } + + private static final Pattern NAME = Pattern.compile("name=\"([^\"]*)\""); + private static final Pattern FILE = Pattern.compile("filename=\"([^\"]*)\""); + + public List parts() { + String contentType = header("Content-Type"); + if (contentType == null + || !contentType.toLowerCase(Locale.ROOT).startsWith("multipart/form-data")) { + throw new AssertionError("Not a multipart request: " + contentType); + } + String boundary = contentType.substring(contentType.indexOf("boundary=") + 9); + String body = new String(request.body(), StandardCharsets.ISO_8859_1); + List parts = new ArrayList<>(); + for (String chunk : body.split("--" + Pattern.quote(boundary), -1)) { + if (chunk.isEmpty() || chunk.startsWith("--")) { + continue; + } + String c = chunk.startsWith("\r\n") ? chunk.substring(2) : chunk; + int split = c.indexOf("\r\n\r\n"); + String head = c.substring(0, split); + String content = c.substring(split + 4, c.length() - 2); + Matcher name = NAME.matcher(head); + Matcher file = FILE.matcher(head); + String type = null; + for (String line : head.split("\r\n", -1)) { + if (line.toLowerCase(Locale.ROOT).startsWith("content-type:")) { + type = line.substring("content-type:".length()).trim(); + } + } + parts.add( + new Part( + name.find() ? name.group(1) : "", + file.find() ? file.group(1) : null, + type, + new String(content.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8))); + } + return parts; + } + + @Override + public String toString() { + return request.toString(); + } +} diff --git a/src/test/java/me/didit/testing/SpecExamples.java b/src/test/java/me/didit/testing/SpecExamples.java new file mode 100644 index 0000000..b4407a2 --- /dev/null +++ b/src/test/java/me/didit/testing/SpecExamples.java @@ -0,0 +1,71 @@ +package me.didit.testing; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Path; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Reads response examples from the OpenAPI documents in {@code openapi/}, the same way the code + * generator does, so example values never need to be copied into the repository. + */ +public final class SpecExamples { + private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final Map DOCS = new ConcurrentHashMap<>(); + + private SpecExamples() {} + + public static Path repoRoot() { + String root = System.getProperty("didit.repoRoot"); + return root == null ? Path.of("").toAbsolutePath() : Path.of(root); + } + + public static JsonNode document(String file) { + return DOCS.computeIfAbsent( + file, + f -> { + try { + return MAPPER.readTree(repoRoot().resolve("openapi").resolve(f).toFile()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }); + } + + /** The example of the {@code status} JSON response of {@code method path}. */ + public static JsonNode response(String file, String method, String path, String status) { + JsonNode doc = document(file); + JsonNode op = doc.path("paths").path(path).path(method.toLowerCase(java.util.Locale.ROOT)); + JsonNode response = deref(doc, op.path("responses").path(status)); + JsonNode media = response.path("content").path("application/json"); + if (media.has("example")) { + return media.get("example"); + } + JsonNode examples = media.path("examples"); + if (examples.isObject() && examples.size() > 0) { + Iterator values = examples.elements(); + JsonNode first = deref(doc, values.next()); + if (first.has("value")) { + return first.get("value"); + } + } + JsonNode schema = deref(doc, media.path("schema")); + if (schema.has("example")) { + return schema.get("example"); + } + throw new AssertionError("No example for " + method + " " + path + " " + status); + } + + static JsonNode deref(JsonNode doc, JsonNode node) { + JsonNode current = node; + for (int i = 0; i < 20 && current.has("$ref"); i++) { + String ref = current.get("$ref").asText(); + current = doc.at(ref.substring(1)); + } + return current; + } +} diff --git a/src/test/java/me/didit/testing/TestJson.java b/src/test/java/me/didit/testing/TestJson.java new file mode 100644 index 0000000..5e29a1c --- /dev/null +++ b/src/test/java/me/didit/testing/TestJson.java @@ -0,0 +1,65 @@ +package me.didit.testing; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.math.BigDecimal; +import java.util.Comparator; + +/** JSON helpers for tests. Numbers compare by value (1 equals 1.0 and 1L). */ +public final class TestJson { + private static final ObjectMapper MAPPER = + JsonMapper.builder().enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS).build(); + + private static final Comparator NUMBERS = + (a, b) -> { + if (a.isNumber() && b.isNumber()) { + BigDecimal x = a.decimalValue(); + BigDecimal y = b.decimalValue(); + return x.compareTo(y); + } + return a.equals(b) ? 0 : 1; + }; + + private TestJson() {} + + public static JsonNode parse(String text) { + try { + return MAPPER.readTree(text); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + public static JsonNode parse(byte[] bytes) { + try { + return MAPPER.readTree(bytes); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + public static boolean jsonEquals(JsonNode expected, JsonNode actual) { + return expected.equals(NUMBERS, actual); + } + + public static void assertJsonEquals(JsonNode expected, JsonNode actual) { + if (!jsonEquals(expected, actual)) { + assertEquals(expected.toPrettyString(), actual.toPrettyString()); + throw new AssertionError("JSON differs only in number types"); + } + } + + public static void assertJsonEquals(String expected, byte[] actual) { + assertJsonEquals(parse(expected), parse(actual)); + } + + public static void assertJsonEquals(String expected, JsonNode actual) { + assertJsonEquals(parse(expected), actual); + } +} diff --git a/src/test/java/me/didit/testing/TestModels.java b/src/test/java/me/didit/testing/TestModels.java new file mode 100644 index 0000000..cc14e61 --- /dev/null +++ b/src/test/java/me/didit/testing/TestModels.java @@ -0,0 +1,102 @@ +package me.didit.testing; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Collection; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import me.didit.core.JsonModel; +import me.didit.core.JsonUnion; +import me.didit.core.MultiStatusResponse; +import me.didit.core.StringEnum; + +/** + * Calls every getter of a generated value, recursively, so a test fails when a field of a spec + * example does not match its declared type. + */ +public final class TestModels { + private static final Set SKIP = + Set.of( + "toBuilder", + "_json", + "_additionalProperties", + "_files", + "hashCode", + "toString", + "getClass", + "knownFields", + "statusCode", + "notify", + "notifyAll", + "wait"); + + private TestModels() {} + + public static void readAll(Object value) { + read(value, "result", new IdentityHashMap<>()); + } + + private static void read(Object value, String path, Map seen) { + if (value == null || seen.put(value, Boolean.TRUE) != null) { + return; + } + if (value instanceof Optional) { + ((Optional) value).ifPresent(v -> read(v, path, seen)); + return; + } + if (value instanceof Collection) { + int i = 0; + for (Object item : (Collection) value) { + read(item, path + "[" + i++ + "]", seen); + } + return; + } + if (value instanceof Map) { + for (Map.Entry e : ((Map) value).entrySet()) { + read(e.getValue(), path + "." + e.getKey(), seen); + } + return; + } + if (value instanceof StringEnum) { + return; + } + if (!(value instanceof JsonModel + || value instanceof JsonUnion + || value instanceof MultiStatusResponse)) { + return; + } + for (Method method : value.getClass().getMethods()) { + if (method.getParameterCount() != 0 + || Modifier.isStatic(method.getModifiers()) + || SKIP.contains(method.getName()) + || method.getDeclaringClass() == Object.class) { + continue; + } + if (value instanceof JsonUnion || value instanceof MultiStatusResponse) { + String name = method.getName(); + if (name.startsWith("as")) { + String is = "is" + name.substring(2); + try { + if (!(Boolean) value.getClass().getMethod(is).invoke(value)) { + continue; + } + } catch (ReflectiveOperationException e) { + // Not a variant accessor: read it like any other getter. + } + } + } + try { + read(method.invoke(value), path + "." + method.getName() + "()", seen); + } catch (InvocationTargetException e) { + throw new AssertionError( + "Reading " + path + "." + method.getName() + "() failed: " + e.getCause(), + e.getCause()); + } catch (IllegalAccessException e) { + throw new AssertionError(e); + } + } + } +} diff --git a/src/test/java/me/didit/webhooks/CanonicalJsonTest.java b/src/test/java/me/didit/webhooks/CanonicalJsonTest.java new file mode 100644 index 0000000..5feed56 --- /dev/null +++ b/src/test/java/me/didit/webhooks/CanonicalJsonTest.java @@ -0,0 +1,126 @@ +package me.didit.webhooks; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import me.didit.errors.WebhookVerificationException; +import me.didit.testing.TestJson; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +final class CanonicalJsonTest { + @Test + void floatsMatchPythonRepr() throws IOException { + List rows = new ArrayList<>(); + try (BufferedReader in = + new BufferedReader( + new InputStreamReader( + Objects.requireNonNull(getClass().getResourceAsStream("/python-float-repr.txt")), + StandardCharsets.UTF_8))) { + for (String line = in.readLine(); line != null; line = in.readLine()) { + if (!line.startsWith("#") && !line.isBlank()) { + rows.add(line.split(" ", 2)); + } + } + } + assertTrue(rows.size() > 100); + for (String[] row : rows) { + double d = Double.parseDouble(row[0]); + assertEquals(row[1], CanonicalJson.pythonRepr(d), row[0]); + // Through the parser too: the repr reads back to the same canonical text. + assertEquals("{\"v\":" + row[1] + "}", Webhooks.canonicalJson("{\"v\":" + row[1] + "}")); + } + } + + @ParameterizedTest + @CsvSource( + delimiter = '|', + value = { + "1e16|10000000000000000", + "-0.0|0", + "-0|0", + "87.0|87", + "1E2|100", + "2.50|2.5", + "12345678901234567890123|12345678901234567890123", + "1e23|99999999999999991611392", + "0.30000000000000004|0.30000000000000004", + "1.5e-5|1.5e-05", + "[1,2.0,3.25]|[1,2,3.25]", + "true|true", + "null|null" + }) + void numbersFollowShortenFloats(String input, String expected) { + assertEquals("{\"v\":" + expected + "}", Webhooks.canonicalJson("{\"v\":" + input + "}")); + } + + @Test + void hugeIntegralFloatIsWrittenAsItsExactInteger() { + String canonical = Webhooks.canonicalJson("{\"v\":1e300}"); + assertTrue(canonical.startsWith("{\"v\":10000000000000000525047602552044202487")); + assertEquals(301 + 6, canonical.length()); + } + + @Test + void keysAreSortedByCodePoint() { + // U+1F600 (astral) sorts after U+FFFD by code point, before it by UTF-16 unit. + String json = "{\"\\ufffd\":1,\"\\ud83d\\ude00\":2,\"b\":3,\"a\":{\"z\":1,\"y\":2}}"; + assertEquals( + "{\"a\":{\"y\":2,\"z\":1},\"b\":3,\"\ufffd\":1,\"\ud83d\ude00\":2}", + Webhooks.canonicalJson(json)); + } + + @Test + void stringsEscapeLikePython() { + String json = + "{\"s\":\"q\\\" b\\\\ n\\n r\\r t\\t b\\b f\\f c\\u0001 d\\u007f / \\u2028 \\u00e9\"}"; + assertEquals( + "{\"s\":\"q\\\" b\\\\ n\\n r\\r t\\t b\\b f\\f c\\u0001 d\u007f / \u2028 \u00e9\"}", + Webhooks.canonicalJson(json)); + } + + @Test + void duplicateKeysKeepTheLastValue() { + assertEquals("{\"a\":2}", Webhooks.canonicalJson("{\"a\":1,\"a\":2}")); + } + + @ParameterizedTest + @CsvSource( + delimiter = '|', + value = { + "{\"a\":NaN}", + "{\"a\":Infinity}", + "{\"a\":1e400}", + "{\"a\":\"\\ud800\"}", + "[1]", + "nope", + "{\"a\":1} x" + }) + void rejectsWhatPythonCannotHaveSigned(String input) { + WebhookVerificationException e = + assertThrows(WebhookVerificationException.class, () -> Webhooks.canonicalJson(input)); + assertEquals("invalid_payload", e.reason().code()); + } + + @Test + void canonicalOfParsedValue() { + assertEquals( + "{\"a\":[1,0.5]}", Webhooks.canonicalJson(TestJson.parse("{ \"a\" : [ 1.0 , 0.5 ] }"))); + } + + @Test + void codePointOrder() { + assertTrue(CanonicalJson.compareCodePoints("a", "ab") < 0); + assertTrue(CanonicalJson.compareCodePoints("b", "a") > 0); + assertEquals(0, CanonicalJson.compareCodePoints("abc", "abc")); + } +} diff --git a/src/test/java/me/didit/webhooks/WebhookVectorsTest.java b/src/test/java/me/didit/webhooks/WebhookVectorsTest.java new file mode 100644 index 0000000..cf56490 --- /dev/null +++ b/src/test/java/me/didit/webhooks/WebhookVectorsTest.java @@ -0,0 +1,123 @@ +package me.didit.webhooks; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.JsonNode; +import java.nio.charset.StandardCharsets; +import java.time.Clock; +import java.time.Instant; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; +import me.didit.errors.WebhookVerificationException; +import me.didit.testing.SpecExamples; +import me.didit.testing.TestJson; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +/** Runs every vector of openapi/webhook-vectors.json (DESIGN 9.3). */ +final class WebhookVectorsTest { + static Stream vectors() { + JsonNode doc = SpecExamples.document("webhook-vectors.json"); + List out = new ArrayList<>(); + for (JsonNode vector : doc.get("vectors")) { + out.add(Arguments.of(vector.get("name").asText(), vector)); + } + return out.stream(); + } + + private static VerifyOptions options(JsonNode vector, boolean allowSimple) { + return VerifyOptions.builder() + .secret(vector.get("secret").asText()) + .tolerance( + java.time.Duration.ofSeconds( + SpecExamples.document("webhook-vectors.json").get("tolerance_seconds").asLong())) + .allowSimple(allowSimple) + .clock(Clock.fixed(Instant.ofEpochSecond(vector.get("now").asLong()), ZoneOffset.UTC)) + .build(); + } + + private static Map headers(JsonNode vector) { + Map headers = new LinkedHashMap<>(); + for (Map.Entry e : vector.get("headers").properties()) { + headers.put(e.getKey(), e.getValue().asText()); + } + return headers; + } + + @ParameterizedTest(name = "{0}") + @MethodSource("vectors") + void canonicalJsonMatchesTheBackend(String name, JsonNode vector) { + String canonical = Webhooks.canonicalJson(vector.get("body").asText()); + if (name.equals("tampered_body")) { + // The vector keeps the canonical string from before the tampering. + assertNotEquals(vector.get("canonical_v2").asText(), canonical); + } else { + assertEquals(vector.get("canonical_v2").asText(), canonical); + } + } + + @ParameterizedTest(name = "{0}") + @MethodSource("vectors") + void verifiesLikeTheBackend(String name, JsonNode vector) { + String body = vector.get("body").asText(); + Map headers = headers(vector); + String expect = vector.get("expect").asText(); + switch (expect) { + case "valid": + { + WebhookEvent event = Webhooks.verify(body, headers, options(vector, false)); + assertTrue(event.isBodyAuthenticated()); + assertEquals(VerifiedBy.SIGNATURE, event.verifiedBy()); + TestJson.assertJsonEquals(TestJson.parse(body), event._json()); + // The canonical signature alone is enough, also for an already parsed body. + Map v2Only = new LinkedHashMap<>(headers); + v2Only.remove("X-Signature"); + v2Only.remove("X-Signature-Previous"); + WebhookEvent fromV2 = + Webhooks.verify( + body.getBytes(StandardCharsets.UTF_8), v2Only, options(vector, false)); + assertEquals(VerifiedBy.SIGNATURE_V2, fromV2.verifiedBy()); + WebhookEvent parsed = + Webhooks.verifyParsed(TestJson.parse(body), headers, options(vector, false)); + assertEquals(VerifiedBy.SIGNATURE_V2, parsed.verifiedBy()); + break; + } + case "valid_only_with_allow_simple": + { + WebhookVerificationException e = + assertThrows( + WebhookVerificationException.class, + () -> Webhooks.verify(body, headers, options(vector, false))); + assertEquals("invalid_signature", e.reason().code()); + WebhookEvent event = Webhooks.verify(body, headers, options(vector, true)); + assertEquals(VerifiedBy.SIGNATURE_SIMPLE, event.verifiedBy()); + assertFalse(event.isBodyAuthenticated()); + // A parsed body is checked against X-Signature-V2 only (DESIGN 9). + WebhookVerificationException parsed = + assertThrows( + WebhookVerificationException.class, + () -> + Webhooks.verifyParsed(TestJson.parse(body), headers, options(vector, true))); + assertEquals("invalid_signature", parsed.reason().code()); + break; + } + default: + { + WebhookVerificationException e = + assertThrows( + WebhookVerificationException.class, + () -> Webhooks.verify(body, headers, options(vector, false))); + assertEquals(expect, e.reason().code()); + } + } + } +} diff --git a/src/test/java/me/didit/webhooks/WebhooksTest.java b/src/test/java/me/didit/webhooks/WebhooksTest.java new file mode 100644 index 0000000..4737718 --- /dev/null +++ b/src/test/java/me/didit/webhooks/WebhooksTest.java @@ -0,0 +1,431 @@ +package me.didit.webhooks; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.charset.StandardCharsets; +import java.time.Clock; +import java.time.Duration; +import java.time.Instant; +import java.time.ZoneOffset; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import me.didit.Didit; +import me.didit.errors.ConfigurationException; +import me.didit.errors.WebhookVerificationException; +import me.didit.testing.TestJson; +import org.junit.jupiter.api.Test; + +final class WebhooksTest { + // Synthetic test secrets only (allowed by .gitleaks.toml). + static final String SECRET = "whsec_test_unit_0123456789abcdef"; + static final String OTHER = "whsec_test_unit_other_fedcba9876543210"; + static final long NOW = 1_800_000_000L; + + static VerifyOptions.Builder options(String... secrets) { + return VerifyOptions.builder() + .secrets(List.of(secrets)) + .clock(Clock.fixed(Instant.ofEpochSecond(NOW), ZoneOffset.UTC)); + } + + static String body(String type, long timestamp, String extra) { + return "{\"webhook_type\":\"" + + type + + "\",\"timestamp\":" + + timestamp + + ",\"event_id\":\"e-1\"," + + "\"application_id\":\"app-1\",\"environment\":\"sandbox\",\"created_at\":" + + timestamp + + extra + + "}"; + } + + /** Signs like the backend: X-Signature over the bytes, V2 over the canonical JSON. */ + static Map sign(String body, String secret) { + Map h = new LinkedHashMap<>(); + h.put("X-Signature", Webhooks.hmac(secret, body.getBytes(StandardCharsets.UTF_8))); + h.put( + "X-Signature-V2", + Webhooks.hmac(secret, Webhooks.canonicalJson(body).getBytes(StandardCharsets.UTF_8))); + ObjectNode payload = Webhooks.parse(body.getBytes(StandardCharsets.UTF_8)); + h.put( + "X-Signature-Simple", + Webhooks.hmac(secret, Webhooks.simpleString(payload).getBytes(StandardCharsets.UTF_8))); + h.put("X-Timestamp", payload.get("timestamp").asText()); + return h; + } + + static WebhookVerificationException.Reason reject( + String body, Map headers, VerifyOptions o) { + return assertThrows(WebhookVerificationException.class, () -> Webhooks.verify(body, headers, o)) + .reason(); + } + + @Test + void verifiesAndTypesASessionEvent() { + String body = + body( + "status.updated", + NOW, + ",\"session_id\":\"s-1\",\"status\":\"Approved\",\"session_kind\":\"user\"," + + "\"workflow_id\":\"w-1\",\"workflow_version\":3,\"vendor_data\":\"user-42\"," + + "\"metadata\":{\"plan\":\"pro\"},\"business_session_id\":null," + + "\"decision\":{\"session_id\":\"s-1\",\"status\":\"Approved\"}," + + "\"resubmit_info\":{\"reasons\":{}}"); + WebhookEvent event = Webhooks.verify(body, sign(body, SECRET), options(SECRET).build()); + SessionStatusUpdatedEvent e = assertInstanceOf(SessionStatusUpdatedEvent.class, event); + assertEquals("status.updated", e.webhookType()); + assertEquals("s-1", e.sessionId().orElseThrow()); + assertEquals("Approved", e.status().orElseThrow()); + assertEquals("user", e.sessionKind().orElseThrow()); + assertEquals("w-1", e.workflowId().orElseThrow()); + assertEquals(3L, e.workflowVersion().orElseThrow()); + assertEquals("user-42", e.vendorData().orElseThrow()); + assertEquals("pro", e.metadata().orElseThrow().get("plan").asText()); + assertTrue(e.businessSessionId().isEmpty()); + assertEquals("s-1", e.decision().orElseThrow().sessionId().orElseThrow()); + assertTrue(e.resubmitInfo().isPresent()); + assertEquals("e-1", e.eventId().orElseThrow()); + assertEquals(NOW, e.timestamp().orElseThrow()); + assertEquals(NOW, e.createdAt().orElseThrow()); + assertEquals("app-1", e.applicationId().orElseThrow()); + assertEquals("sandbox", e.environment().orElseThrow()); + assertTrue(e.isSandbox()); + assertTrue(e.isBodyAuthenticated()); + assertTrue(e.toString().contains("status.updated")); + } + + @Test + void typesEveryKnownEvent() { + Map> types = new LinkedHashMap<>(); + types.put("data.updated", SessionDataUpdatedEvent.class); + types.put("user.status.updated", UserStatusUpdatedEvent.class); + types.put("user.data.updated", UserDataUpdatedEvent.class); + types.put("business.status.updated", BusinessStatusUpdatedEvent.class); + types.put("business.data.updated", BusinessDataUpdatedEvent.class); + types.put("activity.created", ActivityCreatedEvent.class); + types.put("transaction.created", TransactionCreatedEvent.class); + types.put("transaction.status.updated", TransactionStatusUpdatedEvent.class); + types.put("travel_rule.status.updated", TravelRuleStatusUpdatedEvent.class); + types.put("workflow.compliance_changed", WorkflowComplianceChangedEvent.class); + types.put("auth.user.signed_in", UnknownEvent.class); + for (Map.Entry> t : types.entrySet()) { + String body = body(t.getKey(), NOW, ""); + WebhookEvent event = Webhooks.verify(body, sign(body, SECRET), options(SECRET).build()); + assertInstanceOf(t.getValue(), event, t.getKey()); + } + } + + @Test + void transactionTravelRuleUserAndBusinessFields() { + String tx = + body( + "transaction.status.updated", + NOW, + ",\"transaction_id\":\"t-1\",\"txn_id\":\"ref-1\",\"status\":\"APPROVED\",\"score\":12.5," + + "\"severity\":\"LOW\",\"amount\":\"100.00\",\"currency\":\"EUR\",\"direction\":\"inbound\"," + + "\"action_required\":{\"type\":\"verification_session\",\"url\":\"https://example.com/v\"}"); + TransactionStatusUpdatedEvent t = + (TransactionStatusUpdatedEvent) + Webhooks.verify(tx, sign(tx, SECRET), options(SECRET).build()); + assertEquals("t-1", t.transactionId().orElseThrow()); + assertEquals("ref-1", t.txnId().orElseThrow()); + assertEquals("APPROVED", t.status().orElseThrow()); + assertEquals(12.5, t.score().orElseThrow()); + assertEquals("LOW", t.severity().orElseThrow()); + assertEquals("100.00", t.amount().orElseThrow()); + assertEquals("EUR", t.currency().orElseThrow()); + assertEquals("inbound", t.direction().orElseThrow()); + assertTrue(t.actionRequired().orElseThrow().isVerificationSession()); + + String tr = + body( + "travel_rule.status.updated", + NOW, + ",\"transaction_id\":\"t-1\",\"txn_id\":\"ref-1\",\"travel_rule_status\":\"COMPLETED\"," + + "\"rail\":\"TRP\",\"direction\":\"outbound\""); + TravelRuleStatusUpdatedEvent r = + (TravelRuleStatusUpdatedEvent) + Webhooks.verify(tr, sign(tr, SECRET), options(SECRET).build()); + assertEquals("t-1", r.transactionId().orElseThrow()); + assertEquals("ref-1", r.txnId().orElseThrow()); + assertEquals("COMPLETED", r.travelRuleStatus().orElseThrow()); + assertEquals("TRP", r.rail().orElseThrow()); + assertEquals("outbound", r.direction().orElseThrow()); + + String user = + body( + "user.status.updated", + NOW, + ",\"vendor_user_id\":\"u-1\",\"vendor_data\":\"v\",\"status\":\"ACTIVE\""); + UserStatusUpdatedEvent u = + (UserStatusUpdatedEvent) Webhooks.verify(user, sign(user, SECRET), options(SECRET).build()); + assertEquals("u-1", u.vendorUserId().orElseThrow()); + assertEquals("v", u.vendorData().orElseThrow()); + assertEquals("ACTIVE", u.status().orElseThrow()); + + String biz = + body( + "business.data.updated", + NOW, + ",\"vendor_business_id\":\"b-1\",\"vendor_data\":\"v\",\"status\":\"ACTIVE\""); + BusinessDataUpdatedEvent b = + (BusinessDataUpdatedEvent) Webhooks.verify(biz, sign(biz, SECRET), options(SECRET).build()); + assertEquals("b-1", b.vendorBusinessId().orElseThrow()); + assertEquals("v", b.vendorData().orElseThrow()); + assertEquals("ACTIVE", b.status().orElseThrow()); + + String wf = body("workflow.compliance_changed", NOW, ",\"workflow_id\":\"w-9\""); + WorkflowComplianceChangedEvent w = + (WorkflowComplianceChangedEvent) + Webhooks.verify(wf, sign(wf, SECRET), options(SECRET).build()); + assertEquals("w-9", w.workflowId().orElseThrow()); + } + + @Test + void unknownEventsKeepThePayload() { + String body = body("transaction_rule_suggestions.created", NOW, ",\"extra\":[1,2]"); + UnknownEvent e = + (UnknownEvent) Webhooks.verify(body, sign(body, SECRET), options(SECRET).build()); + assertEquals(2, e.payload().get("extra").size()); + assertEquals("transaction_rule_suggestions.created", e.webhookType()); + } + + @Test + void unsignedRegistrySearchIsRejectedButParsable() { + String body = "{\"event_type\":\"kyb.registry_search.resolved\",\"timestamp\":" + NOW + "}"; + Map headers = Map.of("X-Didit-Unsigned-Callback", "true"); + assertEquals( + WebhookVerificationException.Reason.MISSING_SIGNATURE, + reject(body, headers, options(SECRET).build())); + WebhookEvent event = Webhooks.parseEvent(TestJson.parse(body)); + assertInstanceOf(KybRegistrySearchResolvedEvent.class, event); + assertEquals(VerifiedBy.NONE, event.verifiedBy()); + assertFalse(event.isBodyAuthenticated()); + assertEquals("", Webhooks.parseEvent(TestJson.parse("{}")).webhookType()); + } + + @Test + void rotationAcceptsAnyConfiguredSecretAndPreviousHeaders() { + String body = body("status.updated", NOW, ""); + Map signedWithOld = sign(body, OTHER); + assertEquals( + WebhookVerificationException.Reason.INVALID_SIGNATURE, + reject(body, signedWithOld, options(SECRET).build())); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify(body, signedWithOld, options(SECRET, OTHER).build()).verifiedBy()); + Map previousOnly = new HashMap<>(); + previousOnly.put("X-Signature", "0".repeat(64)); + previousOnly.put("X-Signature-Previous", sign(body, SECRET).get("X-Signature")); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify(body, previousOnly, options(SECRET).build()).verifiedBy()); + Map v2Previous = new HashMap<>(); + v2Previous.put("X-Signature-V2-Previous", sign(body, SECRET).get("X-Signature-V2")); + assertEquals( + VerifiedBy.SIGNATURE_V2, + Webhooks.verify(body, v2Previous, options(SECRET).build()).verifiedBy()); + Map simplePrevious = new HashMap<>(); + simplePrevious.put("X-Signature-Simple-Previous", sign(body, SECRET).get("X-Signature-Simple")); + assertEquals( + VerifiedBy.SIGNATURE_SIMPLE, + Webhooks.verify(body, simplePrevious, options(SECRET).allowSimple(true).build()) + .verifiedBy()); + } + + @Test + void headersAreCaseInsensitiveTrimmedAndMayBeLists() { + String body = body("status.updated", NOW, ""); + Map signed = sign(body, SECRET); + Map headers = new LinkedHashMap<>(); + headers.put("x-signature", List.of(" " + signed.get("X-Signature") + " ")); + headers.put("X-TIMESTAMP", new String[] {String.valueOf(NOW)}); + assertEquals( + VerifiedBy.SIGNATURE, Webhooks.verify(body, headers, options(SECRET).build()).verifiedBy()); + // A function lookup, like request::getHeader. + byte[] bytes = body.getBytes(StandardCharsets.UTF_8); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify(bytes, name -> signed.get(name), options(SECRET).build()).verifiedBy()); + // An empty value counts as absent. + assertEquals( + WebhookVerificationException.Reason.MISSING_SIGNATURE, + reject(body, Map.of("X-Signature", " "), options(SECRET).build())); + assertEquals( + WebhookVerificationException.Reason.MISSING_SIGNATURE, + reject(body, Map.of("X-Signature", List.of()), options(SECRET).build())); + } + + @Test + void onlyWellFormedLowercaseHexIsCompared() { + String body = body("status.updated", NOW, ""); + String upper = sign(body, SECRET).get("X-Signature").toUpperCase(java.util.Locale.ROOT); + assertEquals( + WebhookVerificationException.Reason.INVALID_SIGNATURE, + reject(body, Map.of("X-Signature", upper), options(SECRET).build())); + } + + @Test + void timestampRules() { + String body = body("status.updated", NOW, ""); + Map h = new HashMap<>(sign(body, SECRET)); + h.put("X-Timestamp", "abc"); + assertEquals( + WebhookVerificationException.Reason.TIMESTAMP_MISMATCH, + reject(body, h, options(SECRET).build())); + h.put("X-Timestamp", String.valueOf(NOW + 1)); + assertEquals( + WebhookVerificationException.Reason.TIMESTAMP_MISMATCH, + reject(body, h, options(SECRET).build())); + h.remove("X-Timestamp"); + assertEquals( + VerifiedBy.SIGNATURE, Webhooks.verify(body, h, options(SECRET).build()).verifiedBy()); + + // The tolerance bound is inclusive. + String edge = body("status.updated", NOW - 300, ""); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify(edge, sign(edge, SECRET), options(SECRET).build()).verifiedBy()); + String stale = body("status.updated", NOW - 301, ""); + assertEquals( + WebhookVerificationException.Reason.TIMESTAMP_OUT_OF_TOLERANCE, + reject(stale, sign(stale, SECRET), options(SECRET).build())); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify( + stale, + sign(stale, SECRET), + options(SECRET).tolerance(Duration.ofMinutes(10)).build()) + .verifiedBy()); + + for (String ts : new String[] {"\"1800000000\"", "1800000000.0", "true", "null"}) { + String b = "{\"webhook_type\":\"status.updated\",\"timestamp\":" + ts + "}"; + assertEquals( + WebhookVerificationException.Reason.MISSING_TIMESTAMP, + reject(b, Map.of("X-Signature", "0".repeat(64)), options(SECRET).build()), + ts); + } + String none = "{\"webhook_type\":\"status.updated\"}"; + assertEquals( + WebhookVerificationException.Reason.MISSING_TIMESTAMP, + reject(none, Map.of(), options(SECRET).build())); + } + + @Test + void invalidPayloads() { + VerifyOptions o = options(SECRET).build(); + for (String body : new String[] {"", "[]", "not json", "{\"a\":1}{", "{\"timestamp\":NaN}"}) { + assertEquals( + WebhookVerificationException.Reason.INVALID_PAYLOAD, reject(body, Map.of(), o), body); + } + byte[] notUtf8 = {'{', '"', 'a', '"', ':', '"', (byte) 0xff, '"', '}'}; + assertEquals( + WebhookVerificationException.Reason.INVALID_PAYLOAD, + assertThrows( + WebhookVerificationException.class, () -> Webhooks.verify(notUtf8, Map.of(), o)) + .reason()); + assertEquals( + WebhookVerificationException.Reason.INVALID_PAYLOAD, + assertThrows( + WebhookVerificationException.class, + () -> Webhooks.verifyParsed(TestJson.parse("[1]"), Map.of(), o)) + .reason()); + assertThrows( + WebhookVerificationException.class, () -> Webhooks.parseEvent(TestJson.parse("1"))); + } + + @Test + void simpleSignatureOnlyWhenAllowedAndNeverAuthenticatesTheBody() { + String body = body("status.updated", NOW, ",\"session_id\":null,\"status\":true"); + Map simple = + Map.of("X-Signature-Simple", sign(body, SECRET).get("X-Signature-Simple")); + assertEquals( + WebhookVerificationException.Reason.INVALID_SIGNATURE, + reject(body, simple, options(SECRET).build())); + WebhookEvent event = Webhooks.verify(body, simple, options(SECRET).allowSimple(true).build()); + assertEquals(VerifiedBy.SIGNATURE_SIMPLE, event.verifiedBy()); + assertFalse(event.isBodyAuthenticated()); + // Python's str(): None and True. + assertEquals( + NOW + ":None:True:status.updated", + Webhooks.simpleString(Webhooks.parse(body.getBytes(StandardCharsets.UTF_8)))); + } + + @Test + void pythonStrOfOtherValues() { + assertEquals("", Webhooks.pythonStr(null)); + assertEquals("False", Webhooks.pythonStr(TestJson.parse("false"))); + assertEquals("1.5", Webhooks.pythonStr(TestJson.parse("1.5"))); + assertEquals("1e+16", Webhooks.pythonStr(TestJson.parse("1e16"))); + assertEquals("[1, 'a', None]", Webhooks.pythonStr(TestJson.parse("[1,\"a\",null]"))); + assertEquals("{'k': \"it's\"}", Webhooks.pythonStr(TestJson.parse("{\"k\":\"it's\"}"))); + } + + @Test + void configurationErrors() { + String body = body("status.updated", NOW, ""); + assertThrows(ConfigurationException.class, () -> Webhooks.verify(body, Map.of(), " ")); + assertThrows( + ConfigurationException.class, + () -> Webhooks.verify(body, Map.of(), VerifyOptions.builder().build())); + assertThrows( + IllegalArgumentException.class, + () -> VerifyOptions.builder().tolerance(Duration.ofSeconds(-1))); + assertTrue(VerifyOptions.of(SECRET).toString().contains("secrets=1")); + assertFalse(VerifyOptions.of(SECRET).toString().contains(SECRET)); + } + + @Test + void parsedBodiesCheckTheCanonicalSignatureOnly() { + String body = body("status.updated", Instant.now().getEpochSecond(), ",\"score\":0.1"); + Map signed = sign(body, SECRET); + Map payload = new LinkedHashMap<>(); + TestJson.parse(body).properties().forEach(e -> payload.put(e.getKey(), e.getValue())); + assertEquals( + VerifiedBy.SIGNATURE_V2, Webhooks.verifyParsed(payload, signed, SECRET).verifiedBy()); + Map rawOnly = Map.of("X-Signature", signed.get("X-Signature")); + assertEquals( + WebhookVerificationException.Reason.INVALID_SIGNATURE, + assertThrows( + WebhookVerificationException.class, + () -> Webhooks.verifyParsed(TestJson.parse(body), rawOnly, SECRET)) + .reason()); + } + + @Test + void clientHelpersDelegate() { + Didit client = Didit.builder().environment(name -> null).build(); + String body = body("status.updated", Instant.now().getEpochSecond(), ""); + Map signed = sign(body, SECRET); + assertInstanceOf( + SessionStatusUpdatedEvent.class, client.webhooks().verify(body, signed, SECRET)); + assertInstanceOf( + SessionStatusUpdatedEvent.class, + client + .webhooks() + .verify(body.getBytes(StandardCharsets.UTF_8), signed, VerifyOptions.of(SECRET))); + assertInstanceOf( + SessionStatusUpdatedEvent.class, + client + .webhooks() + .verify(body.getBytes(StandardCharsets.UTF_8), signed::get, VerifyOptions.of(SECRET))); + assertInstanceOf( + SessionStatusUpdatedEvent.class, + client.webhooks().verifyParsed(TestJson.parse(body), signed, SECRET)); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify(body.getBytes(StandardCharsets.UTF_8), signed, SECRET).verifiedBy()); + assertEquals( + VerifiedBy.SIGNATURE, Webhooks.verify(body, signed, VerifyOptions.of(SECRET)).verifiedBy()); + assertEquals( + VerifiedBy.SIGNATURE, + Webhooks.verify(body.getBytes(StandardCharsets.UTF_8), signed::get, SECRET).verifiedBy()); + } +} diff --git a/src/test/resources/python-float-repr.txt b/src/test/resources/python-float-repr.txt new file mode 100644 index 0000000..aac43df --- /dev/null +++ b/src/test/resources/python-float-repr.txt @@ -0,0 +1,111 @@ +# Python repr() of doubles: . Generated with CPython 3.11 float.hex() and repr(). +0x1.999999999999ap-4 0.1 +0x1.999999999999ap-3 0.2 +0x1.3333333333333p-2 0.3 +0x1.5555555555555p-2 0.3333333333333333 +0x1.5555555555555p-1 0.6666666666666666 +0x1.4f8b588e368f1p-17 1e-05 +0x1.f75104d551d69p-17 1.5e-05 +0x1.ad7f29abcaf48p-24 1e-07 +0x1.0f5c0635643a8p-33 1.234e-10 +0x0.0000000000001p-1022 5e-324 +0x1.0000000000000p-1022 2.2250738585072014e-308 +0x1.a36e2eb1c432dp-14 0.0001 +0x1.02e4b6ce5dc68p-13 0.00012345 +0x1.d6f34547df3b6p+26 123456789.123 +0x1.1f71fb04cb74fp+40 1234567890123.4568 +0x1.0624dd2f1a9fcp+43 9007199254740.992 +0x1.3333333333334p-2 0.30000000000000004 +0x1.9200000000000p+6 100.5 +-0x1.4000000000000p+1 -2.5 +-0x1.01f31f46ed246p-13 -0.000123 +0x1.921fb54442d18p+1 3.141592653589793 +0x1.5bf0a8b145769p+1 2.718281828459045 +0x1.a36e2eb1c432cp-14 9.999999999999999e-05 +0x1.edd2f1a9fbe77p+6 123.456 +0x1.1666666666666p+2 4.35 +0x1.1eb851eb851ecp-4 0.07 +0x1.199999999999ap+0 1.1 +0x1.c6bf526340004p+49 1000000000000000.5 +0x1.fffffffffffffp+51 4503599627370495.5 +0x1.b55e571438094p+19 895730.7212181264 +0x1.26cb3c8c91e6cp+18 301868.9460797075 +-0x1.f902bd23f0824p-877 -1.9577373031172786e-264 +-0x1.1985d5d9dc9f8p-684 -1.3701135617873088e-206 +-0x1.74ef5e8e25d94p-993 -1.7402335083810205e-299 +0x1.0a35a099950d8p-671 1.0613447212142254e-202 +-0x1.3fa3d93fc4128p+17 -163655.69725848106 +-0x1.16ece1738f7d9p-814 -9.973130378568733e-246 +-0x1.ae8e5f9c66df2p+19 -881778.9878420217 +0x1.103e4eea4d3b9p-33 1.238019611496456e-10 +0x1.6136a82774400p-41 6.274332224055893e-13 +0x1.49a1698937b0fp-41 5.855414226403868e-13 +-0x1.1973e0becd7b0p-791 -8.441872792105456e-239 +0x1.7a1c08a6a63ecp-541 2.0518706419806528e-163 +0x1.0f57ee707ac58p-35 3.084818241019344e-11 +-0x1.a736994e3bf91p-732 -7.317495976062606e-221 +0x1.0867abc002727p-39 1.878710267871435e-12 +0x1.7559e3999e72bp-11 0.0007121107657461536 +0x1.9b5df9e7769b1p-180 1.0485529451675802e-54 +0x1.6057fc913883cp+18 360799.9463635718 +0x1.0ebb319949194p+19 554457.549961614 +0x1.4e39dd0ed62c0p+17 171123.72701527737 +-0x1.0e58d27068904p+18 -276835.2881108674 +0x1.5319acb5c7427p-287 5.326960081783017e-87 +0x1.1260cf054649bp-37 7.798296305842437e-12 +0x1.92fccfc400827p-19 3.002491185456253e-06 +0x1.c022a50c58230p+18 458890.5788784353 +0x1.a99f04df91db0p+17 217918.03807280725 +-0x1.e07bc1e398f10p-975 -5.877500503097409e-294 +-0x1.472f795de758ap+19 -670075.7927128535 +-0x1.53dbddc81f4e6p+19 -696030.9306789904 +-0x1.31dda54103180p+17 -156603.29104651138 +0x1.04737c8ad265ap-17 7.762048218079555e-06 +0x1.52e9d25ab1d86p-24 7.890941714903549e-08 +0x1.7d6faee20e260p+18 390590.73254731856 +0x1.4d50148195043p-18 4.966747952989876e-06 +0x1.5e837d70820fep-640 3.0010119427191346e-193 +-0x1.94b6a67b76f80p+15 -51803.32516071107 +0x1.655755502922cp-31 6.499997571609484e-10 +0x1.83da68094051ap-18 5.7794623071771816e-06 +0x1.a719e5aed7f70p+18 433255.5887966072 +0x1.d1be1915120fap-19 3.470052556884507e-06 +-0x1.442be7bffec3cp+19 -663903.2421869109 +0x1.7a3007e62aa0ap-782 5.807787720339311e-236 +0x1.3af83bd0561e6p-9 0.0024030278220090627 +-0x1.a9fa4bff75f90p+17 -218100.59373354586 +-0x1.9996acb9230dcp+19 -838837.3975997227 +-0x1.8033be60e0030p+17 -196711.48733139178 +0x1.7665f4e46af10p+19 766767.6528830249 +0x1.63741e0f8a5c6p+19 727968.9393970303 +0x1.931e5ad0c8084p+18 412793.4189930039 +0x1.64e1879a020d4p+18 365446.11877490324 +0x1.bf00cd0dbefc0p+19 915462.4079279825 +0x1.c9af0153e7c2ap-302 2.194151990927755e-91 +-0x1.48c893b618676p-374 -3.337733639824717e-113 +0x1.f53863f8fd530p-30 1.8234287398119731e-09 +0x1.8330c04fede8dp-12 0.00036925357289472536 +0x1.ba7a7b3bcd9c0p+19 906195.8510501906 +0x1.c278222e123d3p-11 0.0008592019492051857 +0x1.7caab3ba257c9p-41 6.762000824495014e-13 +0x1.862b40a4ca1bep+19 799066.0201159043 +0x1.ac5ad8c69e9cbp-21 7.97873121196566e-07 +-0x1.8a9d2aed0effcp+17 -202042.33535945404 +-0x1.0cd0b7b45145cp-473 -4.3055245926028695e-143 +-0x1.ab7e0b6a9973cp+19 -875504.3567626248 +0x1.1810afc132d0dp-168 2.9240169314463046e-51 +-0x1.49c833fb8abdap+19 -675393.6244558052 +0x1.897742b06bf38p+17 201454.52100896253 +-0x1.8bb16000f49c8p-750 -2.6098858497543247e-226 +0x1.9919c895fd7b3p-608 1.5043639291391467e-183 +0x1.bc4943525b9c0p+17 227474.5259508621 +0x1.c631cdfd43f37p-172 2.9637577225244357e-52 +0x1.028af822e95bdp-28 3.76229361806441e-09 +0x1.8f87305fd06d8p+17 204558.37792401644 +-0x1.7051713b3133fp+19 -754315.5384756102 +0x1.e18bae3068f7ep+19 986205.4434094278 +-0x1.325394dfa2ac0p+15 -39209.79076870298 +-0x1.9468d5a910541p+19 -828230.6768876688 +0x1.d1c3e7653655cp-36 2.647568917171801e-11 +0x1.35fc4b12a9604p-19 2.309572104524815e-06 +-0x1.591d5d82ad636p+19 -706794.9222018186